diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-02-07 16:16:56 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-02-07 16:16:56 +0100 |
commit | d640ad8212caf6223ce164fa627864875da4eae1 (patch) | |
tree | d7164a428227a29a29d1af08a209a9b9a0dcedca | |
parent | 302d381133a26e6223766eea094a784993022fc4 (diff) | |
download | libmicrohttpd-d640ad8212caf6223ce164fa627864875da4eae1.tar.gz libmicrohttpd-d640ad8212caf6223ce164fa627864875da4eae1.zip |
preliminary patch for query string issue reported on the ML
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/include/microhttpd.h | 2 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 17 |
3 files changed, 14 insertions, 8 deletions
@@ -1,3 +1,6 @@ | |||
1 | Thu Feb 7 16:16:12 CET 2019 | ||
2 | Preliminary patch for the raw query string issue, to be tested. -CG | ||
3 | |||
1 | Tue Jan 8 02:57:21 BRT 2019 | 4 | Tue Jan 8 02:57:21 BRT 2019 |
2 | Added minimal example for how to compress HTTP response. -SC | 5 | Added minimal example for how to compress HTTP response. -SC |
3 | 6 | ||
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index f654d1d7..9049bab5 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 0x00096203 | 129 | #define MHD_VERSION 0x00096204 |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * MHD-internal return code for "YES". | 132 | * MHD-internal return code for "YES". |
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index e06ae993..bb88b969 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2257,7 +2257,7 @@ parse_initial_message_line (struct MHD_Connection *connection, | |||
2257 | http_version--; | 2257 | http_version--; |
2258 | if (http_version > uri) | 2258 | if (http_version > uri) |
2259 | { | 2259 | { |
2260 | /* http_version points to string before HTTP version string */ | 2260 | /* http_version points to character before HTTP version string */ |
2261 | http_version[0] = '\0'; | 2261 | http_version[0] = '\0'; |
2262 | connection->version = http_version + 1; | 2262 | connection->version = http_version + 1; |
2263 | uri_len = http_version - uri; | 2263 | uri_len = http_version - uri; |
@@ -2277,24 +2277,21 @@ parse_initial_message_line (struct MHD_Connection *connection, | |||
2277 | return MHD_NO; | 2277 | return MHD_NO; |
2278 | } | 2278 | } |
2279 | 2279 | ||
2280 | /* unescape URI before searching for arguments */ | ||
2281 | daemon->unescape_callback (daemon->unescape_callback_cls, | ||
2282 | connection, | ||
2283 | uri); | ||
2284 | uri_len = strlen (uri); /* recalculate: may have changed! */ | ||
2285 | args = memchr (uri, | 2280 | args = memchr (uri, |
2286 | '?', | 2281 | '?', |
2287 | uri_len); | 2282 | uri_len); |
2288 | } | 2283 | } |
2289 | 2284 | ||
2285 | /* log callback before we modify URI *or* args */ | ||
2290 | if (NULL != daemon->uri_log_callback) | 2286 | if (NULL != daemon->uri_log_callback) |
2291 | { | 2287 | { |
2292 | connection->client_aware = true; | 2288 | connection->client_aware = true; |
2293 | connection->client_context | 2289 | connection->client_context |
2294 | = daemon->uri_log_callback (daemon->uri_log_callback_cls, | 2290 | = daemon->uri_log_callback (daemon->uri_log_callback_cls, |
2295 | curi, | 2291 | uri, |
2296 | connection); | 2292 | connection); |
2297 | } | 2293 | } |
2294 | |||
2298 | if (NULL != args) | 2295 | if (NULL != args) |
2299 | { | 2296 | { |
2300 | args[0] = '\0'; | 2297 | args[0] = '\0'; |
@@ -2306,6 +2303,12 @@ parse_initial_message_line (struct MHD_Connection *connection, | |||
2306 | &connection_add_header, | 2303 | &connection_add_header, |
2307 | &unused_num_headers); | 2304 | &unused_num_headers); |
2308 | } | 2305 | } |
2306 | |||
2307 | /* unescape URI *after* searching for arguments and log callback */ | ||
2308 | if (NULL != uri) | ||
2309 | daemon->unescape_callback (daemon->unescape_callback_cls, | ||
2310 | connection, | ||
2311 | uri); | ||
2309 | connection->url = curi; | 2312 | connection->url = curi; |
2310 | return MHD_YES; | 2313 | return MHD_YES; |
2311 | } | 2314 | } |