[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 10/10: gen_auth: simplified value assignment
From: |
gnunet |
Subject: |
[libmicrohttpd] 10/10: gen_auth: simplified value assignment |
Date: |
Mon, 06 Jun 2022 18:41:36 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 8d5ebaec91133120088d829cfb58c02e869ccd8b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Jun 6 19:11:06 2022 +0300
gen_auth: simplified value assignment
---
src/microhttpd/basicauth.h | 2 +-
src/microhttpd/digestauth.h | 2 +-
src/microhttpd/gen_auth.c | 11 ++++-------
src/microhttpd/mhd_str.h | 9 +++++++++
4 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/microhttpd/basicauth.h b/src/microhttpd/basicauth.h
index c46fe27a..e0bbeec5 100644
--- a/src/microhttpd/basicauth.h
+++ b/src/microhttpd/basicauth.h
@@ -37,7 +37,7 @@
struct MHD_RqBAuth
{
- struct _MHD_cstr_w_len token68;
+ struct _MHD_str_w_len token68;
};
#endif /* ! MHD_BASICAUTH_H */
diff --git a/src/microhttpd/digestauth.h b/src/microhttpd/digestauth.h
index 77c7c402..367e8e01 100644
--- a/src/microhttpd/digestauth.h
+++ b/src/microhttpd/digestauth.h
@@ -51,7 +51,7 @@
struct MHD_RqDAuthParam
{
- struct _MHD_cstr_w_len value;
+ struct _MHD_str_w_len value;
bool quoted;
};
diff --git a/src/microhttpd/gen_auth.c b/src/microhttpd/gen_auth.c
index 2cdfb3d3..67bd9dc6 100644
--- a/src/microhttpd/gen_auth.c
+++ b/src/microhttpd/gen_auth.c
@@ -91,8 +91,8 @@ parse_bauth_params (const char *str,
else
{
/* No more data in the string, only single token68. */
- const struct _MHD_cstr_w_len tkn = { str + token68_start, token68_len};
- memcpy (&pbauth->token68, &tkn, sizeof(tkn));
+ pbauth->token68.str = str + token68_start;
+ pbauth->token68.len = token68_len;
}
}
return true;
@@ -251,11 +251,8 @@ parse_dauth_params (const char *str,
/* Have valid parameter name and value */
mhd_assert (! quoted || 0 != value_len);
- if (1)
- {
- const struct _MHD_cstr_w_len val = {str + value_start, value_len};
- memcpy (&aparam->param->value, &val, sizeof(val));
- }
+ aparam->param->value.str = str + value_start;
+ aparam->param->value.len = value_len;
aparam->param->quoted = quoted;
break; /* Found matching parameter name */
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h
index 7cf827ab..67b2d044 100644
--- a/src/microhttpd/mhd_str.h
+++ b/src/microhttpd/mhd_str.h
@@ -63,6 +63,15 @@ struct _MHD_cstr_w_len
const size_t len;
};
+/**
+ * String with length
+ */
+struct _MHD_str_w_len
+{
+ const char *str;
+ size_t len;
+};
+
/**
* Static string initialiser for struct _MHD_str_w_len
*/
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (56c4b4ae -> 8d5ebaec), gnunet, 2022/06/06
- [libmicrohttpd] 01/10: test_auth_parse: minor formatting imrpovement, gnunet, 2022/06/06
- [libmicrohttpd] 02/10: mhd_str: fixed doxy again, gnunet, 2022/06/06
- [libmicrohttpd] 03/10: MHD_str_equal_quoted_bin_n(): added new internal function, gnunet, 2022/06/06
- [libmicrohttpd] 04/10: test_str_quote: added new test, gnunet, 2022/06/06
- [libmicrohttpd] 06/10: MHD_str_equal_caseless_quoted_bin_n(): added new internal function, gnunet, 2022/06/06
- [libmicrohttpd] 09/10: digestauth: avoid repetitive calculations of some strings' length, gnunet, 2022/06/06
- [libmicrohttpd] 08/10: Simplified Digest Auth code by using the new string processing functions, gnunet, 2022/06/06
- [libmicrohttpd] 05/10: Excluded build on the new string functions when they are unused, gnunet, 2022/06/06
- [libmicrohttpd] 10/10: gen_auth: simplified value assignment,
gnunet <=
- [libmicrohttpd] 07/10: test_str_quote: added testing of the new function, gnunet, 2022/06/06