libmicrohttpd

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

commit 16cab0b43a38181e7b8a7ae669db3c7ab7fe8891
parent de9b039ee54816165e05309fc158d3d67b6ed052
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  2 Mar 2013 02:46:47 +0000

-test case for %A0-issue reported on the list

Diffstat:
Msrc/testcurl/daemontest_process_arguments.c | 20+++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/testcurl/daemontest_process_arguments.c b/src/testcurl/daemontest_process_arguments.c @@ -1,11 +1,10 @@ - /* This file is part of libmicrohttpd - (C) 2007 Christian Grothoff + (C) 2007, 2013 Christian Grothoff libmicrohttpd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your + by the Free Software Foundation; either version 3, or (at your option) any later version. libmicrohttpd is distributed in the hope that it will be useful, but @@ -46,6 +45,7 @@ struct CBC size_t size; }; + static size_t copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) { @@ -58,6 +58,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) return size * nmemb; } + static int ahc_echo (void *cls, struct MHD_Connection *connection, @@ -86,7 +87,15 @@ ahc_echo (void *cls, abort (); hdr = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "hash"); - if ((hdr == NULL) || (0 != strcmp (hdr, "#"))) + if ((hdr == NULL) || (0 != strcmp (hdr, "#foo"))) + abort (); + hdr = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, "space"); + if ((hdr == NULL) || (0 != strcmp (hdr, "\240bar"))) + abort (); + if (3 != MHD_get_connection_values (connection, + MHD_GET_ARGUMENT_KIND, + NULL, NULL)) abort (); response = MHD_create_response_from_buffer (strlen (url), (void *) url, @@ -98,6 +107,7 @@ ahc_echo (void *cls, return ret; } + static int testExternalGet () { @@ -126,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=%23"); + "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);