diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-12-28 13:30:47 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-12-28 13:30:47 +0300 |
commit | ce1ea19549c8e96f43bfd4b007cb8573fbca5be5 (patch) | |
tree | 632195d88f5da7c08bf2f3bdca947cb36964fa89 | |
parent | ff63d75797ddcaf223197e12b12def2b0803588c (diff) | |
download | libmicrohttpd-ce1ea19549c8e96f43bfd4b007cb8573fbca5be5.tar.gz libmicrohttpd-ce1ea19549c8e96f43bfd4b007cb8573fbca5be5.zip |
Added daemon options for default nonce timeout and max nc values
-rw-r--r-- | src/include/microhttpd.h | 20 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 30 |
2 files changed, 49 insertions, 1 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index c2873056..194a268c 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -96,7 +96,7 @@ extern "C" | |||
96 | * they are parsed as decimal numbers. | 96 | * they are parsed as decimal numbers. |
97 | * Example: 0x01093001 = 1.9.30-1. | 97 | * Example: 0x01093001 = 1.9.30-1. |
98 | */ | 98 | */ |
99 | #define MHD_VERSION 0x00097708 | 99 | #define MHD_VERSION 0x00097709 |
100 | 100 | ||
101 | /* If generic headers don't work on your platform, include headers | 101 | /* If generic headers don't work on your platform, include headers |
102 | which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t', | 102 | which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t', |
@@ -2172,6 +2172,24 @@ enum MHD_OPTION | |||
2172 | * @note Available since #MHD_VERSION 0x00097706 | 2172 | * @note Available since #MHD_VERSION 0x00097706 |
2173 | */ | 2173 | */ |
2174 | MHD_OPTION_SOCK_ADDR_LEN = 40 | 2174 | MHD_OPTION_SOCK_ADDR_LEN = 40 |
2175 | , | ||
2176 | /** | ||
2177 | * Default nonce timeout value used for Digest Auth. | ||
2178 | * This option should be followed by an 'unsigned int' argument. | ||
2179 | * Silently ignored if followed by zero value. | ||
2180 | * @see #MHD_digest_auth_check3(), MHD_digest_auth_check_digest3() | ||
2181 | * @note Available since #MHD_VERSION 0x00097709 | ||
2182 | */ | ||
2183 | MHD_OPTION_DIGEST_AUTH_DEFAULT_NONCE_TIMEOUT = 41 | ||
2184 | , | ||
2185 | /** | ||
2186 | * Default maximum nc (nonce count) value used for Digest Auth. | ||
2187 | * This option should be followed by an 'uint32_t' argument. | ||
2188 | * Silently ignored if followed by zero value. | ||
2189 | * @see #MHD_digest_auth_check3(), MHD_digest_auth_check_digest3() | ||
2190 | * @note Available since #MHD_VERSION 0x00097709 | ||
2191 | */ | ||
2192 | MHD_OPTION_DIGEST_AUTH_DEFAULT_MAX_NC = 42 | ||
2175 | 2193 | ||
2176 | } _MHD_FIXED_ENUM; | 2194 | } _MHD_FIXED_ENUM; |
2177 | 2195 | ||
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index b1640878..f4fd8166 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -6993,6 +6993,26 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
6993 | if (0 != (daemon->dauth_bind_type & MHD_DAUTH_BIND_NONCE_URI_PARAMS)) | 6993 | if (0 != (daemon->dauth_bind_type & MHD_DAUTH_BIND_NONCE_URI_PARAMS)) |
6994 | daemon->dauth_bind_type |= MHD_DAUTH_BIND_NONCE_URI; | 6994 | daemon->dauth_bind_type |= MHD_DAUTH_BIND_NONCE_URI; |
6995 | break; | 6995 | break; |
6996 | case MHD_OPTION_DIGEST_AUTH_DEFAULT_NONCE_TIMEOUT: | ||
6997 | if (1) | ||
6998 | { | ||
6999 | unsigned int val; | ||
7000 | val = va_arg (ap, | ||
7001 | unsigned int); | ||
7002 | if (0 != val) | ||
7003 | daemon->dauth_def_nonce_timeout = val; | ||
7004 | } | ||
7005 | break; | ||
7006 | case MHD_OPTION_DIGEST_AUTH_DEFAULT_MAX_NC: | ||
7007 | if (1) | ||
7008 | { | ||
7009 | uint32_t val; | ||
7010 | val = va_arg (ap, | ||
7011 | uint32_t); | ||
7012 | if (0 != val) | ||
7013 | daemon->dauth_def_max_nc = val; | ||
7014 | } | ||
7015 | break; | ||
6996 | #endif | 7016 | #endif |
6997 | case MHD_OPTION_LISTEN_SOCKET: | 7017 | case MHD_OPTION_LISTEN_SOCKET: |
6998 | params->listen_fd = va_arg (ap, | 7018 | params->listen_fd = va_arg (ap, |
@@ -7105,6 +7125,7 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
7105 | case MHD_OPTION_LISTEN_BACKLOG_SIZE: | 7125 | case MHD_OPTION_LISTEN_BACKLOG_SIZE: |
7106 | case MHD_OPTION_SERVER_INSANITY: | 7126 | case MHD_OPTION_SERVER_INSANITY: |
7107 | case MHD_OPTION_DIGEST_AUTH_NONCE_BIND_TYPE: | 7127 | case MHD_OPTION_DIGEST_AUTH_NONCE_BIND_TYPE: |
7128 | case MHD_OPTION_DIGEST_AUTH_DEFAULT_NONCE_TIMEOUT: | ||
7108 | if (MHD_NO == parse_options (daemon, | 7129 | if (MHD_NO == parse_options (daemon, |
7109 | params, | 7130 | params, |
7110 | opt, | 7131 | opt, |
@@ -7145,6 +7166,15 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
7145 | MHD_OPTION_END)) | 7166 | MHD_OPTION_END)) |
7146 | return MHD_NO; | 7167 | return MHD_NO; |
7147 | break; | 7168 | break; |
7169 | /* all options taking 'uint32_t' */ | ||
7170 | case MHD_OPTION_DIGEST_AUTH_DEFAULT_MAX_NC: | ||
7171 | if (MHD_NO == parse_options (daemon, | ||
7172 | params, | ||
7173 | opt, | ||
7174 | (uint32_t) oa[i].value, | ||
7175 | MHD_OPTION_END)) | ||
7176 | return MHD_NO; | ||
7177 | break; | ||
7148 | /* all options taking one pointer */ | 7178 | /* all options taking one pointer */ |
7149 | case MHD_OPTION_SOCK_ADDR: | 7179 | case MHD_OPTION_SOCK_ADDR: |
7150 | case MHD_OPTION_HTTPS_MEM_KEY: | 7180 | case MHD_OPTION_HTTPS_MEM_KEY: |