libmicrohttpd

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

commit 14ca1719e9a94a68853fc21e197c04ca4cab5ea8
parent 2bffe00f071d8d52967fdb5ca0e0c4dfcd9dc2df
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 10 Apr 2014 07:43:05 +0000

fix #3371

Diffstat:
MChangeLog | 11+++++++++++
Msrc/microhttpd/connection.c | 2++
Msrc/testcurl/test_process_arguments.c | 10+++++-----
3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,14 @@ +Thu Apr 10 09:39:38 CEST 2014 + Removed unescaping for URI path (#3371) as '+' should not + be converted to space in accordance with + http://www.w3.org/TR/html401/appendix/notes.html#ampersands-in-uris + and http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1 + Note that we now also no longer convert '#38;' to '&'; if needed, + the application needs to apply unescaping to the path of the URI + itself (before, MHD unescaped '#38;' but not '&amp;', so this + inconsistency was now resolved by simply not unescaping anything + before the first '&'). -CG + Tue Apr 08 15:35:44 CET 2014 Added support for W32 native threads. Added --with-threads=LIB configure parameter. -EG diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -1361,9 +1361,11 @@ parse_initial_message_line (struct MHD_Connection *connection, args++; parse_arguments (MHD_GET_ARGUMENT_KIND, connection, args); } +#if 0 connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, connection, uri); +#endif connection->url = uri; if (NULL == http_version) connection->version = ""; diff --git a/src/testcurl/test_process_arguments.c b/src/testcurl/test_process_arguments.c @@ -93,12 +93,12 @@ ahc_echo (void *cls, MHD_GET_ARGUMENT_KIND, "space"); if ((hdr == NULL) || (0 != strcmp (hdr, "\240bar"))) abort (); - if (3 != MHD_get_connection_values (connection, + if (3 != MHD_get_connection_values (connection, MHD_GET_ARGUMENT_KIND, NULL, NULL)) abort (); response = MHD_create_response_from_buffer (strlen (url), - (void *) url, + (void *) url, MHD_RESPMEM_MUST_COPY); ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); @@ -136,7 +136,7 @@ testExternalGet () return 256; c = curl_easy_init (); curl_easy_setopt (c, CURLOPT_URL, - "http://127.0.0.1:21080/hello_world?k=v+x&hash=%23foo&space=%A0bar"); + "http://127.0.0.1:21080/hello+world?k=v+x&hash=%23foo&space=%A0bar"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -224,9 +224,9 @@ testExternalGet () curl_multi_cleanup (multi); } MHD_stop_daemon (d); - if (cbc.pos != strlen ("/hello_world")) + if (cbc.pos != strlen ("/hello+world")) return 8192; - if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + if (0 != strncmp ("/hello+world", cbc.buf, strlen ("/hello+world"))) return 16384; return 0; }