libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit d640ad8212caf6223ce164fa627864875da4eae1
parent 302d381133a26e6223766eea094a784993022fc4
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  7 Feb 2019 16:16:56 +0100

preliminary patch for query string issue reported on the ML

Diffstat:
MChangeLog | 3+++
Msrc/include/microhttpd.h | 2+-
Msrc/microhttpd/connection.c | 17++++++++++-------
3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +Thu Feb 7 16:16:12 CET 2019 + Preliminary patch for the raw query string issue, to be tested. -CG + Tue Jan 8 02:57:21 BRT 2019 Added minimal example for how to compress HTTP response. -SC diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -126,7 +126,7 @@ typedef intptr_t ssize_t; * Current version of the library. * 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x00096203 +#define MHD_VERSION 0x00096204 /** * MHD-internal return code for "YES". diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2257,7 +2257,7 @@ parse_initial_message_line (struct MHD_Connection *connection, http_version--; if (http_version > uri) { - /* http_version points to string before HTTP version string */ + /* http_version points to character before HTTP version string */ http_version[0] = '\0'; connection->version = http_version + 1; uri_len = http_version - uri; @@ -2277,24 +2277,21 @@ parse_initial_message_line (struct MHD_Connection *connection, return MHD_NO; } - /* unescape URI before searching for arguments */ - daemon->unescape_callback (daemon->unescape_callback_cls, - connection, - uri); - uri_len = strlen (uri); /* recalculate: may have changed! */ args = memchr (uri, '?', uri_len); } + /* log callback before we modify URI *or* args */ if (NULL != daemon->uri_log_callback) { connection->client_aware = true; connection->client_context = daemon->uri_log_callback (daemon->uri_log_callback_cls, - curi, + uri, connection); } + if (NULL != args) { args[0] = '\0'; @@ -2306,6 +2303,12 @@ parse_initial_message_line (struct MHD_Connection *connection, &connection_add_header, &unused_num_headers); } + + /* unescape URI *after* searching for arguments and log callback */ + if (NULL != uri) + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + uri); connection->url = curi; return MHD_YES; }