diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-11-18 13:24:00 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-11-18 13:24:00 +0100 |
commit | a78bc73beb1c34421659258801569128b256f797 (patch) | |
tree | 95021bdd67361554161ec1a9717e86ece86a962d /src | |
parent | 488615cea6ccb5437ebde23c03a5e52fdbc95436 (diff) | |
download | libmicrohttpd-a78bc73beb1c34421659258801569128b256f797.tar.gz libmicrohttpd-a78bc73beb1c34421659258801569128b256f797.zip |
releasing 0.9.61v0.9.61
Diffstat (limited to 'src')
-rw-r--r-- | src/examples/suspend_resume_epoll.c | 3 | ||||
-rw-r--r-- | src/include/microhttpd.h | 6 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 38 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 9 | ||||
-rw-r--r-- | src/microhttpd/digestauth.c | 26 |
5 files changed, 48 insertions, 34 deletions
diff --git a/src/examples/suspend_resume_epoll.c b/src/examples/suspend_resume_epoll.c index 73ac6e45..0f9f66bf 100644 --- a/src/examples/suspend_resume_epoll.c +++ b/src/examples/suspend_resume_epoll.c | |||
@@ -123,7 +123,8 @@ connection_done (void *cls, | |||
123 | struct Request *req = *con_cls; | 123 | struct Request *req = *con_cls; |
124 | 124 | ||
125 | if (-1 != req->timerfd) | 125 | if (-1 != req->timerfd) |
126 | close (req->timerfd); | 126 | if (0 != close (req->timerfd)) |
127 | abort (); | ||
127 | free(req); | 128 | free(req); |
128 | } | 129 | } |
129 | 130 | ||
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 5d51e6d4..7eccccf2 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -126,7 +126,7 @@ typedef intptr_t ssize_t; | |||
126 | * Current version of the library. | 126 | * Current version of the library. |
127 | * 0x01093001 = 1.9.30-1. | 127 | * 0x01093001 = 1.9.30-1. |
128 | */ | 128 | */ |
129 | #define MHD_VERSION 0x00096000 | 129 | #define MHD_VERSION 0x00096100 |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * MHD-internal return code for "YES". | 132 | * MHD-internal return code for "YES". |
@@ -1176,7 +1176,7 @@ typedef void | |||
1176 | * @param psk[out] to be set to the pre-shared-key; should be allocated with malloc(), | 1176 | * @param psk[out] to be set to the pre-shared-key; should be allocated with malloc(), |
1177 | * will be freed by MHD | 1177 | * will be freed by MHD |
1178 | * @param psk_size[out] to be set to the number of bytes in @a psk | 1178 | * @param psk_size[out] to be set to the number of bytes in @a psk |
1179 | * @return 0 on success, -1 on errors | 1179 | * @return 0 on success, -1 on errors |
1180 | */ | 1180 | */ |
1181 | typedef int | 1181 | typedef int |
1182 | (*MHD_PskServerCredentialsCallback)(void *cls, | 1182 | (*MHD_PskServerCredentialsCallback)(void *cls, |
@@ -1511,7 +1511,7 @@ enum MHD_OPTION | |||
1511 | MHD_OPTION_STRICT_FOR_CLIENT = 29, | 1511 | MHD_OPTION_STRICT_FOR_CLIENT = 29, |
1512 | 1512 | ||
1513 | /** | 1513 | /** |
1514 | * This should be a pointer to callback of type | 1514 | * This should be a pointer to callback of type |
1515 | * gnutls_psk_server_credentials_function that will be given to | 1515 | * gnutls_psk_server_credentials_function that will be given to |
1516 | * gnutls_psk_set_server_credentials_function. It is used to | 1516 | * gnutls_psk_set_server_credentials_function. It is used to |
1517 | * retrieve the shared key for a given username. | 1517 | * retrieve the shared key for a given username. |
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 3e641d15..abc622e2 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2236,6 +2236,7 @@ parse_initial_message_line (struct MHD_Connection *connection, | |||
2236 | uri++; | 2236 | uri++; |
2237 | if ((size_t)(uri - line) == line_len) | 2237 | if ((size_t)(uri - line) == line_len) |
2238 | { | 2238 | { |
2239 | /* No URI and no http version given */ | ||
2239 | curi = ""; | 2240 | curi = ""; |
2240 | uri_len = 0; | 2241 | uri_len = 0; |
2241 | uri = NULL; | 2242 | uri = NULL; |
@@ -2257,29 +2258,36 @@ parse_initial_message_line (struct MHD_Connection *connection, | |||
2257 | http_version--; | 2258 | http_version--; |
2258 | if (http_version > uri) | 2259 | if (http_version > uri) |
2259 | { | 2260 | { |
2261 | /* http_version points to string before HTTP version string */ | ||
2260 | http_version[0] = '\0'; | 2262 | http_version[0] = '\0'; |
2261 | connection->version = http_version + 1; | 2263 | connection->version = http_version + 1; |
2262 | args = memchr (uri, | 2264 | uri_len = http_version - uri; |
2263 | '?', | ||
2264 | http_version - uri); | ||
2265 | } | 2265 | } |
2266 | else | 2266 | else |
2267 | { | 2267 | { |
2268 | connection->version = ""; | 2268 | connection->version = ""; |
2269 | args = memchr (uri, | 2269 | uri_len = line_len - (uri - line); |
2270 | '?', | ||
2271 | line_len - (uri - line)); | ||
2272 | } | 2270 | } |
2273 | uri_len = http_version - uri; | 2271 | /* check for spaces in URI if we are "strict" */ |
2274 | } | 2272 | if ( (1 <= daemon->strict_for_client) && |
2275 | if ( (1 <= daemon->strict_for_client) && | 2273 | (NULL != memchr (uri, |
2276 | (NULL != memchr (curi, | 2274 | ' ', |
2277 | ' ', | 2275 | uri_len)) ) |
2278 | uri_len)) ) | 2276 | { |
2279 | { | 2277 | /* space exists in URI and we are supposed to be strict, reject */ |
2280 | /* space exists in URI and we are supposed to be strict, reject */ | 2278 | return MHD_NO; |
2281 | return MHD_NO; | 2279 | } |
2280 | |||
2281 | /* unescape URI before searching for arguments */ | ||
2282 | daemon->unescape_callback (daemon->unescape_callback_cls, | ||
2283 | connection, | ||
2284 | uri); | ||
2285 | uri_len = strlen (uri); /* recalculate: may have changed! */ | ||
2286 | args = memchr (uri, | ||
2287 | '?', | ||
2288 | uri_len); | ||
2282 | } | 2289 | } |
2290 | |||
2283 | if (NULL != daemon->uri_log_callback) | 2291 | if (NULL != daemon->uri_log_callback) |
2284 | { | 2292 | { |
2285 | connection->client_aware = true; | 2293 | connection->client_aware = true; |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 90c09d29..4f6f4128 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1711,7 +1711,8 @@ thread_main_connection_upgrade (struct MHD_Connection *con) | |||
1711 | #endif | 1711 | #endif |
1712 | break; | 1712 | break; |
1713 | } | 1713 | } |
1714 | urh_from_pollfd(urh, p); | 1714 | urh_from_pollfd (urh, |
1715 | p); | ||
1715 | process_urh (urh); | 1716 | process_urh (urh); |
1716 | } | 1717 | } |
1717 | } | 1718 | } |
@@ -3670,7 +3671,8 @@ MHD_poll_all (struct MHD_Daemon *daemon, | |||
3670 | struct pollfd *p; | 3671 | struct pollfd *p; |
3671 | MHD_socket ls; | 3672 | MHD_socket ls; |
3672 | 3673 | ||
3673 | p = MHD_calloc_ ((2 + num_connections), sizeof (struct pollfd)); | 3674 | p = MHD_calloc_ ((2 + num_connections), |
3675 | sizeof (struct pollfd)); | ||
3674 | if (NULL == p) | 3676 | if (NULL == p) |
3675 | { | 3677 | { |
3676 | #ifdef HAVE_MESSAGES | 3678 | #ifdef HAVE_MESSAGES |
@@ -3809,7 +3811,8 @@ MHD_poll_all (struct MHD_Daemon *daemon, | |||
3809 | if ((p[poll_server+i].fd != urh->connection->socket_fd) || | 3811 | if ((p[poll_server+i].fd != urh->connection->socket_fd) || |
3810 | (p[poll_server+i+1].fd != urh->mhd.socket)) | 3812 | (p[poll_server+i+1].fd != urh->mhd.socket)) |
3811 | break; | 3813 | break; |
3812 | urh_from_pollfd(urh, &(p[poll_server+i])); | 3814 | urh_from_pollfd (urh, |
3815 | &p[poll_server+i]); | ||
3813 | i += 2; | 3816 | i += 2; |
3814 | process_urh (urh); | 3817 | process_urh (urh); |
3815 | /* Finished forwarding? */ | 3818 | /* Finished forwarding? */ |
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c index 0c5baffb..33352bc7 100644 --- a/src/microhttpd/digestauth.c +++ b/src/microhttpd/digestauth.c | |||
@@ -112,12 +112,12 @@ digest_calc_ha1_from_digest (const char *alg, | |||
112 | char sessionkey[HASH_MD5_HEX_LEN + 1]) | 112 | char sessionkey[HASH_MD5_HEX_LEN + 1]) |
113 | { | 113 | { |
114 | struct MD5Context md5; | 114 | struct MD5Context md5; |
115 | 115 | ||
116 | if (MHD_str_equal_caseless_(alg, | 116 | if (MHD_str_equal_caseless_(alg, |
117 | "md5-sess")) | 117 | "md5-sess")) |
118 | { | 118 | { |
119 | unsigned char ha1[MHD_MD5_DIGEST_SIZE]; | 119 | unsigned char ha1[MHD_MD5_DIGEST_SIZE]; |
120 | 120 | ||
121 | MD5Init (&md5); | 121 | MD5Init (&md5); |
122 | MD5Update (&md5, | 122 | MD5Update (&md5, |
123 | digest, | 123 | digest, |
@@ -680,7 +680,9 @@ check_argument_match (struct MHD_Connection *connection, | |||
680 | &num_headers); | 680 | &num_headers); |
681 | free (argb); | 681 | free (argb); |
682 | if (MHD_YES != ret) | 682 | if (MHD_YES != ret) |
683 | return MHD_NO; | 683 | { |
684 | return MHD_NO; | ||
685 | } | ||
684 | /* also check that the number of headers matches */ | 686 | /* also check that the number of headers matches */ |
685 | for (pos = connection->headers_received; NULL != pos; pos = pos->next) | 687 | for (pos = connection->headers_received; NULL != pos; pos = pos->next) |
686 | { | 688 | { |
@@ -690,7 +692,7 @@ check_argument_match (struct MHD_Connection *connection, | |||
690 | } | 692 | } |
691 | if (0 != num_headers) | 693 | if (0 != num_headers) |
692 | { | 694 | { |
693 | /* argument count mismatch */ | 695 | /* argument count missmatch */ |
694 | return MHD_NO; | 696 | return MHD_NO; |
695 | } | 697 | } |
696 | return MHD_YES; | 698 | return MHD_YES; |
@@ -978,8 +980,8 @@ digest_auth_check_all (struct MHD_Connection *connection, | |||
978 | } | 980 | } |
979 | } | 981 | } |
980 | free (uri); | 982 | free (uri); |
981 | return (0 == strcmp(response, | 983 | return (0 == strcmp (response, |
982 | respexp)) | 984 | respexp)) |
983 | ? MHD_YES | 985 | ? MHD_YES |
984 | : MHD_NO; | 986 | : MHD_NO; |
985 | } | 987 | } |
@@ -1006,12 +1008,12 @@ MHD_digest_auth_check (struct MHD_Connection *connection, | |||
1006 | const char *password, | 1008 | const char *password, |
1007 | unsigned int nonce_timeout) | 1009 | unsigned int nonce_timeout) |
1008 | { | 1010 | { |
1009 | return digest_auth_check_all(connection, | 1011 | return digest_auth_check_all (connection, |
1010 | realm, | 1012 | realm, |
1011 | username, | 1013 | username, |
1012 | password, | 1014 | password, |
1013 | NULL, | 1015 | NULL, |
1014 | nonce_timeout); | 1016 | nonce_timeout); |
1015 | } | 1017 | } |
1016 | 1018 | ||
1017 | 1019 | ||