aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-04-08 15:12:45 +0200
committerChristian Grothoff <christian@grothoff.org>2019-04-08 15:12:45 +0200
commit312713c3634aa22d538c09d0146b5ac1d62c206b (patch)
treeadeb696c8a3339d231b78f3a0c9893a7124e45a2
parent83a86be948420f7bd902ceee9d661fc208eec1cd (diff)
parent1b610e5b13b7b96e7b3f372c8da1ec9d840f896a (diff)
downloadlibmicrohttpd-312713c3634aa22d538c09d0146b5ac1d62c206b.tar.gz
libmicrohttpd-312713c3634aa22d538c09d0146b5ac1d62c206b.zip
merge
-rw-r--r--ChangeLog19
-rw-r--r--configure.ac6
-rw-r--r--doc/examples/logging.c17
-rw-r--r--doc/libmicrohttpd.texi13
-rw-r--r--po/libmicrohttpd.pot266
-rw-r--r--src/examples/Makefile.am8
-rw-r--r--src/examples/http_chunked_compression.c199
-rw-r--r--src/include/microhttpd.h56
-rw-r--r--src/microhttpd/connection.c108
-rw-r--r--src/microhttpd/digestauth.c23
-rw-r--r--src/microhttpd/internal.c19
-rw-r--r--src/microhttpd/internal.h9
-rw-r--r--src/microhttpd/response.c3
-rw-r--r--src/testcurl/test_get.c94
-rw-r--r--src/testcurl/test_process_headers.c8
-rw-r--r--src/testcurl/test_urlparse.c9
16 files changed, 648 insertions, 209 deletions
diff --git a/ChangeLog b/ChangeLog
index dee553f1..58b87e3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,25 @@ Mon 08 Apr 2019 03:06:05 PM CEST
2 Fix close() checks as suggested by MK on the mailinglist 2 Fix close() checks as suggested by MK on the mailinglist
3 (#3926). -MK/CG 3 (#3926). -MK/CG
4 4
5Wed 20 Mar 2019 10:20:24 AM CET
6 Adding additional "value_length" argument to MHD_KeyValueIterator
7 callback to support binary zeros in values. This is done in a
8 backwards-compatible way, but may require adding a cast to existing
9 code to avoid a compiler warning. -CG
10
11Sun Feb 10 21:00:37 BRT 2019
12 Added example for how to compress a chunked HTTP response. -SC
13
14Sun 10 Feb 2019 05:03:44 PM CET
15 Releasing libmicrohttpd 0.9.63. -CG
16
17Sat 09 Feb 2019 01:51:02 PM CET
18 Extended test_get to test URI logging and query string parsing
19 to avoid regression fixed in previous patch in the future. -CG
20
21Thu Feb 7 16:16:12 CET 2019
22 Preliminary patch for the raw query string issue, to be tested. -CG
23
5Tue Jan 8 02:57:21 BRT 2019 24Tue Jan 8 02:57:21 BRT 2019
6 Added minimal example for how to compress HTTP response. -SC 25 Added minimal example for how to compress HTTP response. -SC
7 26
diff --git a/configure.ac b/configure.ac
index cfe7af90..62f5ed5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,15 +22,15 @@
22# 22#
23AC_PREREQ([2.64]) 23AC_PREREQ([2.64])
24LT_PREREQ([2.4.0]) 24LT_PREREQ([2.4.0])
25AC_INIT([GNU Libmicrohttpd],[0.9.62],[libmicrohttpd@gnu.org]) 25AC_INIT([GNU Libmicrohttpd],[0.9.63],[libmicrohttpd@gnu.org])
26AC_CONFIG_AUX_DIR([build-aux]) 26AC_CONFIG_AUX_DIR([build-aux])
27AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) 27AM_INIT_AUTOMAKE([silent-rules] [subdir-objects])
28AC_CONFIG_HEADERS([MHD_config.h]) 28AC_CONFIG_HEADERS([MHD_config.h])
29AC_CONFIG_MACRO_DIR([m4]) 29AC_CONFIG_MACRO_DIR([m4])
30 30
31LIB_VERSION_CURRENT=61 31LIB_VERSION_CURRENT=62
32LIB_VERSION_REVISION=0 32LIB_VERSION_REVISION=0
33LIB_VERSION_AGE=49 33LIB_VERSION_AGE=50
34AC_SUBST(LIB_VERSION_CURRENT) 34AC_SUBST(LIB_VERSION_CURRENT)
35AC_SUBST(LIB_VERSION_REVISION) 35AC_SUBST(LIB_VERSION_REVISION)
36AC_SUBST(LIB_VERSION_AGE) 36AC_SUBST(LIB_VERSION_AGE)
diff --git a/doc/examples/logging.c b/doc/examples/logging.c
index 239fbe7d..a88f461e 100644
--- a/doc/examples/logging.c
+++ b/doc/examples/logging.c
@@ -15,11 +15,16 @@
15 15
16 16
17static int 17static int
18print_out_key (void *cls, enum MHD_ValueKind kind, const char *key, 18print_out_key (void *cls,
19 const char *value) 19 enum MHD_ValueKind kind,
20 const char *key,
21 const char *value,
22 size_t value_size)
20{ 23{
21 (void)cls; /* Unused. Silent compiler warning. */ 24 (void) cls; /* Unused. Silent compiler warning. */
22 (void)kind; /* Unused. Silent compiler warning. */ 25 (void) kind; /* Unused. Silent compiler warning. */
26 (void) value_size;
27
23 printf ("%s: %s\n", key, value); 28 printf ("%s: %s\n", key, value);
24 return MHD_YES; 29 return MHD_YES;
25} 30}
@@ -38,7 +43,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
38 (void)con_cls; /* Unused. Silent compiler warning. */ 43 (void)con_cls; /* Unused. Silent compiler warning. */
39 printf ("New %s request for %s using version %s\n", method, url, version); 44 printf ("New %s request for %s using version %s\n", method, url, version);
40 45
41 MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, 46 MHD_get_connection_values (connection,
47 MHD_HEADER_KIND,
48 &print_out_key,
42 NULL); 49 NULL);
43 50
44 return MHD_NO; 51 return MHD_NO;
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index f2e3576c..97a79bdc 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -1356,7 +1356,7 @@ reason for request termination see @code{MHD_OPTION_NOTIFY_COMPLETED}.
1356@end deftypefn 1356@end deftypefn
1357 1357
1358 1358
1359@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) 1359@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size)
1360Iterator over key-value pairs. This iterator can be used to iterate 1360Iterator over key-value pairs. This iterator can be used to iterate
1361over all of the cookies, headers, or @code{POST}-data fields of a 1361over all of the cookies, headers, or @code{POST}-data fields of a
1362request, and also to iterate over the headers that have been added to a 1362request, and also to iterate over the headers that have been added to a
@@ -1375,6 +1375,17 @@ key for the value, can be an empty string
1375@item value 1375@item value
1376value corresponding value, can be NULL 1376value corresponding value, can be NULL
1377 1377
1378@item value_size
1379number of bytes in @code{value}. This argument was introduced in
1380@code{MHD_VERSION} 0x00096301 to allow applications to use binary
1381zeros in values. Applications using this argument must ensure that
1382they are using a sufficiently recent version of MHD, i.e. by testing
1383@code{MHD_get_version()} for values above or equal to 0.9.64.
1384Applications that do not need zeros in values and that want to compile
1385without warnings against newer versions of MHD should not declare this
1386argument and cast the function pointer argument to
1387@code{MHD_KeyValueIterator}.
1388
1378@end table 1389@end table
1379 1390
1380Return @code{MHD_YES} to continue iterating, @code{MHD_NO} to abort the 1391Return @code{MHD_YES} to continue iterating, @code{MHD_NO} to abort the
diff --git a/po/libmicrohttpd.pot b/po/libmicrohttpd.pot
index 9825d043..7906e9ec 100644
--- a/po/libmicrohttpd.pot
+++ b/po/libmicrohttpd.pot
@@ -6,9 +6,9 @@
6#, fuzzy 6#, fuzzy
7msgid "" 7msgid ""
8msgstr "" 8msgstr ""
9"Project-Id-Version: GNU libmicrohttpd 0.9.62\n" 9"Project-Id-Version: GNU libmicrohttpd 0.9.63\n"
10"Report-Msgid-Bugs-To: libmicrohttpd@gnu.org\n" 10"Report-Msgid-Bugs-To: libmicrohttpd@gnu.org\n"
11"POT-Creation-Date: 2018-12-08 23:11+0100\n" 11"POT-Creation-Date: 2019-02-10 17:12+0100\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n" 14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -37,53 +37,53 @@ msgstr ""
37msgid "Failed to close FD.\n" 37msgid "Failed to close FD.\n"
38msgstr "" 38msgstr ""
39 39
40#: src/microhttpd/digestauth.c:563 40#: src/microhttpd/digestauth.c:599
41msgid "" 41msgid ""
42"Stale nonce received. If this happens a lot, you should probably increase " 42"Stale nonce received. If this happens a lot, you should probably increase "
43"the size of the nonce array.\n" 43"the size of the nonce array.\n"
44msgstr "" 44msgstr ""
45 45
46#: src/microhttpd/digestauth.c:755 46#: src/microhttpd/digestauth.c:792
47msgid "Failed to allocate memory for copy of URI arguments\n" 47msgid "Failed to allocate memory for copy of URI arguments\n"
48msgstr "" 48msgstr ""
49 49
50#: src/microhttpd/digestauth.c:893 50#: src/microhttpd/digestauth.c:932
51msgid "Authentication failed, invalid timestamp format.\n" 51msgid "Authentication failed, invalid timestamp format.\n"
52msgstr "" 52msgstr ""
53 53
54#: src/microhttpd/digestauth.c:956 54#: src/microhttpd/digestauth.c:995
55msgid "Authentication failed, invalid format.\n" 55msgid "Authentication failed, invalid format.\n"
56msgstr "" 56msgstr ""
57 57
58#: src/microhttpd/digestauth.c:966 58#: src/microhttpd/digestauth.c:1005
59msgid "Authentication failed, invalid nc format.\n" 59msgid "Authentication failed, invalid nc format.\n"
60msgstr "" 60msgstr ""
61 61
62#: src/microhttpd/digestauth.c:992 62#: src/microhttpd/digestauth.c:1031
63msgid "Failed to allocate memory for auth header processing\n" 63msgid "Failed to allocate memory for auth header processing\n"
64msgstr "" 64msgstr ""
65 65
66#: src/microhttpd/digestauth.c:1049 66#: src/microhttpd/digestauth.c:1090
67msgid "Authentication failed, URI does not match.\n" 67msgid "Authentication failed, URI does not match.\n"
68msgstr "" 68msgstr ""
69 69
70#: src/microhttpd/digestauth.c:1069 70#: src/microhttpd/digestauth.c:1109
71msgid "Authentication failed, arguments do not match.\n" 71msgid "Authentication failed, arguments do not match.\n"
72msgstr "" 72msgstr ""
73 73
74#: src/microhttpd/digestauth.c:1224 74#: src/microhttpd/digestauth.c:1264
75msgid "digest size missmatch" 75msgid "digest size missmatch"
76msgstr "" 76msgstr ""
77 77
78#: src/microhttpd/digestauth.c:1314 78#: src/microhttpd/digestauth.c:1356
79msgid "Could not register nonce (is the nonce array size zero?).\n" 79msgid "Could not register nonce (is the nonce array size zero?).\n"
80msgstr "" 80msgstr ""
81 81
82#: src/microhttpd/digestauth.c:1339 82#: src/microhttpd/digestauth.c:1381
83msgid "Failed to allocate memory for auth response header\n" 83msgid "Failed to allocate memory for auth response header\n"
84msgstr "" 84msgstr ""
85 85
86#: src/microhttpd/digestauth.c:1375 86#: src/microhttpd/digestauth.c:1417
87msgid "Failed to add Digest auth header\n" 87msgid "Failed to add Digest auth header\n"
88msgstr "" 88msgstr ""
89 89
@@ -126,7 +126,7 @@ msgid ""
126"unsupported.\n" 126"unsupported.\n"
127msgstr "" 127msgstr ""
128 128
129#: src/microhttpd/daemon.c:1279 src/microhttpd/daemon.c:6454 129#: src/microhttpd/daemon.c:1279 src/microhttpd/daemon.c:6469
130msgid "" 130msgid ""
131"Initiated daemon shutdown while \"upgraded\" connection was not closed.\n" 131"Initiated daemon shutdown while \"upgraded\" connection was not closed.\n"
132msgstr "" 132msgstr ""
@@ -180,7 +180,7 @@ msgstr ""
180msgid "PSK authentication failed: gnutls_malloc failed to allocate memory\n" 180msgid "PSK authentication failed: gnutls_malloc failed to allocate memory\n"
181msgstr "" 181msgstr ""
182 182
183#: src/microhttpd/daemon.c:2318 src/microhttpd/daemon.c:6104 183#: src/microhttpd/daemon.c:2318 src/microhttpd/daemon.c:6113
184#, c-format 184#, c-format
185msgid "Socket descriptor larger than FD_SETSIZE: %d > %d\n" 185msgid "Socket descriptor larger than FD_SETSIZE: %d > %d\n"
186msgstr "" 186msgstr ""
@@ -190,7 +190,7 @@ msgstr ""
190msgid "Failed to set SO_NOSIGPIPE on accepted socket: %s\n" 190msgid "Failed to set SO_NOSIGPIPE on accepted socket: %s\n"
191msgstr "" 191msgstr ""
192 192
193#: src/microhttpd/daemon.c:2351 src/microhttpd/daemon.c:3155 193#: src/microhttpd/daemon.c:2351 src/microhttpd/daemon.c:3164
194#, c-format 194#, c-format
195msgid "Accepted connection on socket %d\n" 195msgid "Accepted connection on socket %d\n"
196msgstr "" 196msgstr ""
@@ -204,7 +204,7 @@ msgid "Connection rejected by application. Closing connection.\n"
204msgstr "" 204msgstr ""
205 205
206#: src/microhttpd/daemon.c:2414 src/microhttpd/daemon.c:2434 206#: src/microhttpd/daemon.c:2414 src/microhttpd/daemon.c:2434
207#: src/microhttpd/daemon.c:3741 207#: src/microhttpd/daemon.c:3750
208#, c-format 208#, c-format
209msgid "Error allocating memory: %s\n" 209msgid "Error allocating memory: %s\n"
210msgstr "" 210msgstr ""
@@ -218,9 +218,9 @@ msgstr ""
218msgid "Unknown credential type" 218msgid "Unknown credential type"
219msgstr "" 219msgstr ""
220 220
221#: src/microhttpd/daemon.c:2607 src/microhttpd/daemon.c:4231 221#: src/microhttpd/daemon.c:2607 src/microhttpd/daemon.c:4240
222#: src/microhttpd/daemon.c:4264 src/microhttpd/daemon.c:5409 222#: src/microhttpd/daemon.c:4273 src/microhttpd/daemon.c:5418
223#: src/microhttpd/daemon.c:5426 src/microhttpd/connection.c:3867 223#: src/microhttpd/daemon.c:5435 src/microhttpd/connection.c:3857
224#: src/microhttpd/response.c:968 src/microhttpd/response.c:994 224#: src/microhttpd/response.c:968 src/microhttpd/response.c:994
225#, c-format 225#, c-format
226msgid "Call to epoll_ctl failed: %s\n" 226msgid "Call to epoll_ctl failed: %s\n"
@@ -230,9 +230,9 @@ msgstr ""
230msgid "Failed to signal new connection via inter-thread communication channel." 230msgid "Failed to signal new connection via inter-thread communication channel."
231msgstr "" 231msgstr ""
232 232
233#: src/microhttpd/daemon.c:2737 src/microhttpd/daemon.c:3239 233#: src/microhttpd/daemon.c:2737 src/microhttpd/daemon.c:3248
234#: src/microhttpd/daemon.c:6350 src/microhttpd/connection.c:992 234#: src/microhttpd/daemon.c:6359 src/microhttpd/connection.c:979
235#: src/microhttpd/connection.c:1011 235#: src/microhttpd/connection.c:998
236msgid "Failed to remove FD from epoll set\n" 236msgid "Failed to remove FD from epoll set\n"
237msgstr "" 237msgstr ""
238 238
@@ -266,474 +266,478 @@ msgstr ""
266msgid "Failed to set noninheritable mode on new client socket.\n" 266msgid "Failed to set noninheritable mode on new client socket.\n"
267msgstr "" 267msgstr ""
268 268
269#: src/microhttpd/daemon.c:3093 269#: src/microhttpd/daemon.c:3029
270msgid "Failed to reset buffering mode on new client socket.\n"
271msgstr ""
272
273#: src/microhttpd/daemon.c:3102
270#, c-format 274#, c-format
271msgid "Error accepting connection: %s\n" 275msgid "Error accepting connection: %s\n"
272msgstr "" 276msgstr ""
273 277
274#: src/microhttpd/daemon.c:3110 278#: src/microhttpd/daemon.c:3119
275msgid "" 279msgid ""
276"Hit process or system resource limit at FIRST connection. This is really bad " 280"Hit process or system resource limit at FIRST connection. This is really bad "
277"as there is no sane way to proceed. Will try busy waiting for system " 281"as there is no sane way to proceed. Will try busy waiting for system "
278"resources to become magically available.\n" 282"resources to become magically available.\n"
279msgstr "" 283msgstr ""
280 284
281#: src/microhttpd/daemon.c:3124 285#: src/microhttpd/daemon.c:3133
282#, c-format 286#, c-format
283msgid "" 287msgid ""
284"Hit process or system resource limit at %u connections, temporarily " 288"Hit process or system resource limit at %u connections, temporarily "
285"suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n" 289"suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n"
286msgstr "" 290msgstr ""
287 291
288#: src/microhttpd/daemon.c:3136 292#: src/microhttpd/daemon.c:3145
289#, c-format 293#, c-format
290msgid "Failed to set nonblocking mode on incoming connection socket: %s\n" 294msgid "Failed to set nonblocking mode on incoming connection socket: %s\n"
291msgstr "" 295msgstr ""
292 296
293#: src/microhttpd/daemon.c:3148 297#: src/microhttpd/daemon.c:3157
294msgid "Failed to set noninheritable mode on incoming connection socket.\n" 298msgid "Failed to set noninheritable mode on incoming connection socket.\n"
295msgstr "" 299msgstr ""
296 300
297#: src/microhttpd/daemon.c:3196 src/microhttpd/daemon.c:6496 301#: src/microhttpd/daemon.c:3205 src/microhttpd/daemon.c:6511
298#: src/microhttpd/daemon.c:6528 src/microhttpd/daemon.c:6628 302#: src/microhttpd/daemon.c:6543 src/microhttpd/daemon.c:6643
299msgid "Failed to join a thread\n" 303msgid "Failed to join a thread\n"
300msgstr "" 304msgstr ""
301 305
302#: src/microhttpd/daemon.c:3300 306#: src/microhttpd/daemon.c:3309
303msgid "Illegal call to MHD_get_timeout\n" 307msgid "Illegal call to MHD_get_timeout\n"
304msgstr "" 308msgstr ""
305 309
306#: src/microhttpd/daemon.c:3497 310#: src/microhttpd/daemon.c:3506
307msgid "" 311msgid ""
308"MHD_run_from_select() called with except_fd_set set to NULL. Such behavior " 312"MHD_run_from_select() called with except_fd_set set to NULL. Such behavior "
309"is deprecated.\n" 313"is deprecated.\n"
310msgstr "" 314msgstr ""
311 315
312#: src/microhttpd/daemon.c:3577 316#: src/microhttpd/daemon.c:3586
313msgid "Could not obtain daemon fdsets" 317msgid "Could not obtain daemon fdsets"
314msgstr "" 318msgstr ""
315 319
316#: src/microhttpd/daemon.c:3594 320#: src/microhttpd/daemon.c:3603
317msgid "Could not add listen socket to fdset" 321msgid "Could not add listen socket to fdset"
318msgstr "" 322msgstr ""
319 323
320#: src/microhttpd/daemon.c:3622 324#: src/microhttpd/daemon.c:3631
321msgid "Could not add control inter-thread communication channel FD to fdset" 325msgid "Could not add control inter-thread communication channel FD to fdset"
322msgstr "" 326msgstr ""
323 327
324#: src/microhttpd/daemon.c:3678 328#: src/microhttpd/daemon.c:3687
325#, c-format 329#, c-format
326msgid "select failed: %s\n" 330msgid "select failed: %s\n"
327msgstr "" 331msgstr ""
328 332
329#: src/microhttpd/daemon.c:3823 src/microhttpd/daemon.c:3970 333#: src/microhttpd/daemon.c:3832 src/microhttpd/daemon.c:3979
330#, c-format 334#, c-format
331msgid "poll failed: %s\n" 335msgid "poll failed: %s\n"
332msgstr "" 336msgstr ""
333 337
334#: src/microhttpd/daemon.c:4100 src/microhttpd/daemon.c:4331 338#: src/microhttpd/daemon.c:4109 src/microhttpd/daemon.c:4340
335#, c-format 339#, c-format
336msgid "Call to epoll_wait failed: %s\n" 340msgid "Call to epoll_wait failed: %s\n"
337msgstr "" 341msgstr ""
338 342
339#: src/microhttpd/daemon.c:4283 src/microhttpd/daemon.c:4740 343#: src/microhttpd/daemon.c:4292 src/microhttpd/daemon.c:4749
340msgid "Failed to remove listen FD from epoll set\n" 344msgid "Failed to remove listen FD from epoll set\n"
341msgstr "" 345msgstr ""
342 346
343#: src/microhttpd/daemon.c:4748 347#: src/microhttpd/daemon.c:4757
344msgid "Failed to signal quiesce via inter-thread communication channel" 348msgid "Failed to signal quiesce via inter-thread communication channel"
345msgstr "" 349msgstr ""
346 350
347#: src/microhttpd/daemon.c:4770 351#: src/microhttpd/daemon.c:4779
348msgid "failed to signal quiesce via inter-thread communication channel" 352msgid "failed to signal quiesce via inter-thread communication channel"
349msgstr "" 353msgstr ""
350 354
351#: src/microhttpd/daemon.c:4878 355#: src/microhttpd/daemon.c:4887
352msgid "Warning: Too large timeout value, ignored.\n" 356msgid "Warning: Too large timeout value, ignored.\n"
353msgstr "" 357msgstr ""
354 358
355#: src/microhttpd/daemon.c:4919 359#: src/microhttpd/daemon.c:4928
356msgid "" 360msgid ""
357"Warning: Zero size, specified for thread pool size, is ignored. Thread pool " 361"Warning: Zero size, specified for thread pool size, is ignored. Thread pool "
358"is not used.\n" 362"is not used.\n"
359msgstr "" 363msgstr ""
360 364
361#: src/microhttpd/daemon.c:4927 365#: src/microhttpd/daemon.c:4936
362msgid "" 366msgid ""
363"Warning: \"1\", specified for thread pool size, is ignored. Thread pool is " 367"Warning: \"1\", specified for thread pool size, is ignored. Thread pool is "
364"not used.\n" 368"not used.\n"
365msgstr "" 369msgstr ""
366 370
367#: src/microhttpd/daemon.c:4939 371#: src/microhttpd/daemon.c:4948
368#, c-format 372#, c-format
369msgid "Specified thread pool size (%u) too big\n" 373msgid "Specified thread pool size (%u) too big\n"
370msgstr "" 374msgstr ""
371 375
372#: src/microhttpd/daemon.c:4950 376#: src/microhttpd/daemon.c:4959
373msgid "" 377msgid ""
374"MHD_OPTION_THREAD_POOL_SIZE option is specified but " 378"MHD_OPTION_THREAD_POOL_SIZE option is specified but "
375"MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n" 379"MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n"
376msgstr "" 380msgstr ""
377 381
378#: src/microhttpd/daemon.c:4959 382#: src/microhttpd/daemon.c:4968
379msgid "" 383msgid ""
380"Both MHD_OPTION_THREAD_POOL_SIZE option and MHD_USE_THREAD_PER_CONNECTION " 384"Both MHD_OPTION_THREAD_POOL_SIZE option and MHD_USE_THREAD_PER_CONNECTION "
381"flag are specified.\n" 385"flag are specified.\n"
382msgstr "" 386msgstr ""
383 387
384#: src/microhttpd/daemon.c:4976 src/microhttpd/daemon.c:4988 388#: src/microhttpd/daemon.c:4985 src/microhttpd/daemon.c:4997
385#: src/microhttpd/daemon.c:5000 src/microhttpd/daemon.c:5012 389#: src/microhttpd/daemon.c:5009 src/microhttpd/daemon.c:5021
386#: src/microhttpd/daemon.c:5053 src/microhttpd/daemon.c:5081 390#: src/microhttpd/daemon.c:5062 src/microhttpd/daemon.c:5090
387#: src/microhttpd/daemon.c:5100 391#: src/microhttpd/daemon.c:5109
388#, c-format 392#, c-format
389msgid "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n" 393msgid "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"
390msgstr "" 394msgstr ""
391 395
392#: src/microhttpd/daemon.c:5031 396#: src/microhttpd/daemon.c:5040
393msgid "Error initializing DH parameters\n" 397msgid "Error initializing DH parameters\n"
394msgstr "" 398msgstr ""
395 399
396#: src/microhttpd/daemon.c:5043 400#: src/microhttpd/daemon.c:5052
397msgid "Bad Diffie-Hellman parameters format\n" 401msgid "Bad Diffie-Hellman parameters format\n"
398msgstr "" 402msgstr ""
399 403
400#: src/microhttpd/daemon.c:5070 404#: src/microhttpd/daemon.c:5079
401#, c-format 405#, c-format
402msgid "Setting priorities to `%s' failed: %s\n" 406msgid "Setting priorities to `%s' failed: %s\n"
403msgstr "" 407msgstr ""
404 408
405#: src/microhttpd/daemon.c:5089 409#: src/microhttpd/daemon.c:5098
406msgid "" 410msgid ""
407"MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n" 411"MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n"
408msgstr "" 412msgstr ""
409 413
410#: src/microhttpd/daemon.c:5123 414#: src/microhttpd/daemon.c:5132
411msgid "" 415msgid ""
412"MHD_OPTION_LISTEN_SOCKET specified for daemon with MHD_USE_NO_LISTEN_SOCKET " 416"MHD_OPTION_LISTEN_SOCKET specified for daemon with MHD_USE_NO_LISTEN_SOCKET "
413"flag set.\n" 417"flag set.\n"
414msgstr "" 418msgstr ""
415 419
416#: src/microhttpd/daemon.c:5172 420#: src/microhttpd/daemon.c:5181
417msgid "" 421msgid ""
418"Flag MHD_USE_PEDANTIC_CHECKS is ignored because another behavior is " 422"Flag MHD_USE_PEDANTIC_CHECKS is ignored because another behavior is "
419"specified by MHD_OPTION_STRICT_CLIENT.\n" 423"specified by MHD_OPTION_STRICT_CLIENT.\n"
420msgstr "" 424msgstr ""
421 425
422#: src/microhttpd/daemon.c:5304 426#: src/microhttpd/daemon.c:5313
423#, c-format 427#, c-format
424msgid "MHD HTTPS option %d passed to MHD compiled without GNUtls >= 3\n" 428msgid "MHD HTTPS option %d passed to MHD compiled without GNUtls >= 3\n"
425msgstr "" 429msgstr ""
426 430
427#: src/microhttpd/daemon.c:5317 431#: src/microhttpd/daemon.c:5326
428#, c-format 432#, c-format
429msgid "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n" 433msgid "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n"
430msgstr "" 434msgstr ""
431 435
432#: src/microhttpd/daemon.c:5323 436#: src/microhttpd/daemon.c:5332
433#, c-format 437#, c-format
434msgid "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n" 438msgid "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n"
435msgstr "" 439msgstr ""
436 440
437#: src/microhttpd/daemon.c:5353 441#: src/microhttpd/daemon.c:5362
438#, c-format 442#, c-format
439msgid "Call to epoll_create1 failed: %s\n" 443msgid "Call to epoll_create1 failed: %s\n"
440msgstr "" 444msgstr ""
441 445
442#: src/microhttpd/daemon.c:5363 446#: src/microhttpd/daemon.c:5372
443msgid "Failed to set noninheritable mode on epoll FD.\n" 447msgid "Failed to set noninheritable mode on epoll FD.\n"
444msgstr "" 448msgstr ""
445 449
446#: src/microhttpd/daemon.c:5606 450#: src/microhttpd/daemon.c:5615
447msgid "" 451msgid ""
448"Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " 452"Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with "
449"MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD was " 453"MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD was "
450"added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n" 454"added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n"
451msgstr "" 455msgstr ""
452 456
453#: src/microhttpd/daemon.c:5654 457#: src/microhttpd/daemon.c:5663
454msgid "Using debug build of libmicrohttpd.\n" 458msgid "Using debug build of libmicrohttpd.\n"
455msgstr "" 459msgstr ""
456 460
457#: src/microhttpd/daemon.c:5668 461#: src/microhttpd/daemon.c:5677
458#, c-format 462#, c-format
459msgid "Failed to create inter-thread communication channel: %s\n" 463msgid "Failed to create inter-thread communication channel: %s\n"
460msgstr "" 464msgstr ""
461 465
462#: src/microhttpd/daemon.c:5684 466#: src/microhttpd/daemon.c:5693
463msgid "" 467msgid ""
464"file descriptor for inter-thread communication channel exceeds maximum " 468"file descriptor for inter-thread communication channel exceeds maximum "
465"value\n" 469"value\n"
466msgstr "" 470msgstr ""
467 471
468#: src/microhttpd/daemon.c:5704 472#: src/microhttpd/daemon.c:5713
469msgid "Specified value for NC_SIZE too large\n" 473msgid "Specified value for NC_SIZE too large\n"
470msgstr "" 474msgstr ""
471 475
472#: src/microhttpd/daemon.c:5718 476#: src/microhttpd/daemon.c:5727
473#, c-format 477#, c-format
474msgid "Failed to allocate memory for nonce-nc map: %s\n" 478msgid "Failed to allocate memory for nonce-nc map: %s\n"
475msgstr "" 479msgstr ""
476 480
477#: src/microhttpd/daemon.c:5735 481#: src/microhttpd/daemon.c:5744
478msgid "MHD failed to initialize nonce-nc mutex\n" 482msgid "MHD failed to initialize nonce-nc mutex\n"
479msgstr "" 483msgstr ""
480 484
481#: src/microhttpd/daemon.c:5755 485#: src/microhttpd/daemon.c:5764
482msgid "MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n" 486msgid "MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n"
483msgstr "" 487msgstr ""
484 488
485#: src/microhttpd/daemon.c:5779 489#: src/microhttpd/daemon.c:5788
486#, c-format 490#, c-format
487msgid "Failed to create socket for listening: %s\n" 491msgid "Failed to create socket for listening: %s\n"
488msgstr "" 492msgstr ""
489 493
490#: src/microhttpd/daemon.c:5800 src/microhttpd/daemon.c:5819 494#: src/microhttpd/daemon.c:5809 src/microhttpd/daemon.c:5828
491#: src/microhttpd/daemon.c:5842 src/microhttpd/daemon.c:5879 495#: src/microhttpd/daemon.c:5851 src/microhttpd/daemon.c:5888
492#: src/microhttpd/daemon.c:5956 src/microhttpd/daemon.c:5987 496#: src/microhttpd/daemon.c:5965 src/microhttpd/daemon.c:5996
493#, c-format 497#, c-format
494msgid "setsockopt failed: %s\n" 498msgid "setsockopt failed: %s\n"
495msgstr "" 499msgstr ""
496 500
497#: src/microhttpd/daemon.c:5852 501#: src/microhttpd/daemon.c:5861
498msgid "Cannot allow listening address reuse: SO_REUSEPORT not defined\n" 502msgid "Cannot allow listening address reuse: SO_REUSEPORT not defined\n"
499msgstr "" 503msgstr ""
500 504
501#: src/microhttpd/daemon.c:5887 505#: src/microhttpd/daemon.c:5896
502msgid "" 506msgid ""
503"Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n" 507"Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n"
504msgstr "" 508msgstr ""
505 509
506#: src/microhttpd/daemon.c:5967 510#: src/microhttpd/daemon.c:5976
507#, c-format 511#, c-format
508msgid "Failed to bind to port %u: %s\n" 512msgid "Failed to bind to port %u: %s\n"
509msgstr "" 513msgstr ""
510 514
511#: src/microhttpd/daemon.c:5998 515#: src/microhttpd/daemon.c:6007
512#, c-format 516#, c-format
513msgid "Failed to listen for connections: %s\n" 517msgid "Failed to listen for connections: %s\n"
514msgstr "" 518msgstr ""
515 519
516#: src/microhttpd/daemon.c:6025 520#: src/microhttpd/daemon.c:6034
517#, c-format 521#, c-format
518msgid "Failed to get listen port number: %s\n" 522msgid "Failed to get listen port number: %s\n"
519msgstr "" 523msgstr ""
520 524
521#: src/microhttpd/daemon.c:6035 525#: src/microhttpd/daemon.c:6044
522msgid "" 526msgid ""
523"Failed to get listen port number (`struct sockaddr_storage` too small!?)\n" 527"Failed to get listen port number (`struct sockaddr_storage` too small!?)\n"
524msgstr "" 528msgstr ""
525 529
526#: src/microhttpd/daemon.c:6068 530#: src/microhttpd/daemon.c:6077
527msgid "Unknown address family!\n" 531msgid "Unknown address family!\n"
528msgstr "" 532msgstr ""
529 533
530#: src/microhttpd/daemon.c:6081 534#: src/microhttpd/daemon.c:6090
531#, c-format 535#, c-format
532msgid "Failed to set nonblocking mode on listening socket: %s\n" 536msgid "Failed to set nonblocking mode on listening socket: %s\n"
533msgstr "" 537msgstr ""
534 538
535#: src/microhttpd/daemon.c:6123 539#: src/microhttpd/daemon.c:6132
536msgid "" 540msgid ""
537"Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n" 541"Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n"
538msgstr "" 542msgstr ""
539 543
540#: src/microhttpd/daemon.c:6137 src/microhttpd/daemon.c:6150 544#: src/microhttpd/daemon.c:6146 src/microhttpd/daemon.c:6159
541msgid "MHD failed to initialize IP connection limit mutex\n" 545msgid "MHD failed to initialize IP connection limit mutex\n"
542msgstr "" 546msgstr ""
543 547
544#: src/microhttpd/daemon.c:6169 548#: src/microhttpd/daemon.c:6178
545msgid "Failed to initialize TLS support\n" 549msgid "Failed to initialize TLS support\n"
546msgstr "" 550msgstr ""
547 551
548#: src/microhttpd/daemon.c:6196 552#: src/microhttpd/daemon.c:6205
549#, c-format 553#, c-format
550msgid "Failed to create listen thread: %s\n" 554msgid "Failed to create listen thread: %s\n"
551msgstr "" 555msgstr ""
552 556
553#: src/microhttpd/daemon.c:6244 557#: src/microhttpd/daemon.c:6253
554#, c-format 558#, c-format
555msgid "Failed to create worker inter-thread communication channel: %s\n" 559msgid "Failed to create worker inter-thread communication channel: %s\n"
556msgstr "" 560msgstr ""
557 561
558#: src/microhttpd/daemon.c:6255 562#: src/microhttpd/daemon.c:6264
559msgid "" 563msgid ""
560"File descriptor for worker inter-thread communication channel exceeds " 564"File descriptor for worker inter-thread communication channel exceeds "
561"maximum value\n" 565"maximum value\n"
562msgstr "" 566msgstr ""
563 567
564#: src/microhttpd/daemon.c:6280 568#: src/microhttpd/daemon.c:6289
565msgid "MHD failed to initialize cleanup connection mutex\n" 569msgid "MHD failed to initialize cleanup connection mutex\n"
566msgstr "" 570msgstr ""
567 571
568#: src/microhttpd/daemon.c:6294 572#: src/microhttpd/daemon.c:6303
569#, c-format 573#, c-format
570msgid "Failed to create pool thread: %s\n" 574msgid "Failed to create pool thread: %s\n"
571msgstr "" 575msgstr ""
572 576
573#: src/microhttpd/daemon.c:6441 src/microhttpd/daemon.c:6472 577#: src/microhttpd/daemon.c:6456 src/microhttpd/daemon.c:6487
574msgid "MHD_stop_daemon() called while we have suspended connections.\n" 578msgid "MHD_stop_daemon() called while we have suspended connections.\n"
575msgstr "" 579msgstr ""
576 580
577#: src/microhttpd/daemon.c:6481 src/microhttpd/daemon.c:6610 581#: src/microhttpd/daemon.c:6496 src/microhttpd/daemon.c:6625
578msgid "Failed to signal shutdown via inter-thread communication channel" 582msgid "Failed to signal shutdown via inter-thread communication channel"
579msgstr "" 583msgstr ""
580 584
581#: src/microhttpd/daemon.c:6573 585#: src/microhttpd/daemon.c:6588
582msgid "Failed to signal shutdown via inter-thread communication channel." 586msgid "Failed to signal shutdown via inter-thread communication channel."
583msgstr "" 587msgstr ""
584 588
585#: src/microhttpd/daemon.c:7040 589#: src/microhttpd/daemon.c:7055
586msgid "Failed to initialize winsock\n" 590msgid "Failed to initialize winsock\n"
587msgstr "" 591msgstr ""
588 592
589#: src/microhttpd/daemon.c:7043 593#: src/microhttpd/daemon.c:7058
590msgid "Winsock version 2.2 is not available\n" 594msgid "Winsock version 2.2 is not available\n"
591msgstr "" 595msgstr ""
592 596
593#: src/microhttpd/daemon.c:7051 src/microhttpd/daemon.c:7055 597#: src/microhttpd/daemon.c:7066 src/microhttpd/daemon.c:7070
594msgid "Failed to initialise multithreading in libgcrypt\n" 598msgid "Failed to initialise multithreading in libgcrypt\n"
595msgstr "" 599msgstr ""
596 600
597#: src/microhttpd/daemon.c:7060 601#: src/microhttpd/daemon.c:7075
598msgid "libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n" 602msgid "libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n"
599msgstr "" 603msgstr ""
600 604
601#: src/microhttpd/mhd_sockets.h:248 605#: src/microhttpd/mhd_sockets.h:261
602msgid "Close socket failed.\n" 606msgid "Close socket failed.\n"
603msgstr "" 607msgstr ""
604 608
605#: src/microhttpd/connection.c:1117 609#: src/microhttpd/connection.c:1104
606msgid "Closing connection (application reported error generating data)\n" 610msgid "Closing connection (application reported error generating data)\n"
607msgstr "" 611msgstr ""
608 612
609#: src/microhttpd/connection.c:1170 613#: src/microhttpd/connection.c:1157
610msgid "Closing connection (out of memory)\n" 614msgid "Closing connection (out of memory)\n"
611msgstr "" 615msgstr ""
612 616
613#: src/microhttpd/connection.c:1217 617#: src/microhttpd/connection.c:1204
614msgid "Closing connection (application error generating response)\n" 618msgid "Closing connection (application error generating response)\n"
615msgstr "" 619msgstr ""
616 620
617#: src/microhttpd/connection.c:1799 621#: src/microhttpd/connection.c:1786
618#, c-format 622#, c-format
619msgid "" 623msgid ""
620"Error processing request (HTTP response code is %u (`%s')). Closing " 624"Error processing request (HTTP response code is %u (`%s')). Closing "
621"connection.\n" 625"connection.\n"
622msgstr "" 626msgstr ""
623 627
624#: src/microhttpd/connection.c:1825 src/microhttpd/connection.c:2810 628#: src/microhttpd/connection.c:1812 src/microhttpd/connection.c:2800
625msgid "Closing connection (failed to queue response)\n" 629msgid "Closing connection (failed to queue response)\n"
626msgstr "" 630msgstr ""
627 631
628#: src/microhttpd/connection.c:1835 src/microhttpd/connection.c:3579 632#: src/microhttpd/connection.c:1822 src/microhttpd/connection.c:3569
629#: src/microhttpd/connection.c:3702 633#: src/microhttpd/connection.c:3692
630msgid "Closing connection (failed to create response header)\n" 634msgid "Closing connection (failed to create response header)\n"
631msgstr "" 635msgstr ""
632 636
633#: src/microhttpd/connection.c:1881 src/microhttpd/connection.c:2960 637#: src/microhttpd/connection.c:1868 src/microhttpd/connection.c:2950
634#: src/microhttpd/connection.c:3028 src/microhttpd/connection.c:3344 638#: src/microhttpd/connection.c:3018 src/microhttpd/connection.c:3334
635#, c-format 639#, c-format
636msgid "In function %s handling connection at state: %s\n" 640msgid "In function %s handling connection at state: %s\n"
637msgstr "" 641msgstr ""
638 642
639#: src/microhttpd/connection.c:2093 643#: src/microhttpd/connection.c:2080
640msgid "Not enough memory in pool to allocate header record!\n" 644msgid "Not enough memory in pool to allocate header record!\n"
641msgstr "" 645msgstr ""
642 646
643#: src/microhttpd/connection.c:2135 647#: src/microhttpd/connection.c:2122
644msgid "Not enough memory in pool to parse cookies!\n" 648msgid "Not enough memory in pool to parse cookies!\n"
645msgstr "" 649msgstr ""
646 650
647#: src/microhttpd/connection.c:2356 src/microhttpd/connection.c:2541 651#: src/microhttpd/connection.c:2346 src/microhttpd/connection.c:2531
648msgid "Application reported internal error, closing connection.\n" 652msgid "Application reported internal error, closing connection.\n"
649msgstr "" 653msgstr ""
650 654
651#: src/microhttpd/connection.c:2409 src/microhttpd/connection.c:2486 655#: src/microhttpd/connection.c:2399 src/microhttpd/connection.c:2476
652msgid "" 656msgid ""
653"Received malformed HTTP request (bad chunked encoding). Closing connection.\n" 657"Received malformed HTTP request (bad chunked encoding). Closing connection.\n"
654msgstr "" 658msgstr ""
655 659
656#: src/microhttpd/connection.c:2549 660#: src/microhttpd/connection.c:2539
657msgid "libmicrohttpd API violation" 661msgid "libmicrohttpd API violation"
658msgstr "" 662msgstr ""
659 663
660#: src/microhttpd/connection.c:2564 664#: src/microhttpd/connection.c:2554
661msgid "" 665msgid ""
662"WARNING: incomplete upload processing and connection not suspended may " 666"WARNING: incomplete upload processing and connection not suspended may "
663"result in hung connection.\n" 667"result in hung connection.\n"
664msgstr "" 668msgstr ""
665 669
666#: src/microhttpd/connection.c:2634 670#: src/microhttpd/connection.c:2624
667msgid "Received malformed line (no colon). Closing connection.\n" 671msgid "Received malformed line (no colon). Closing connection.\n"
668msgstr "" 672msgstr ""
669 673
670#: src/microhttpd/connection.c:2788 674#: src/microhttpd/connection.c:2778
671msgid "Received HTTP 1.1 request without `Host' header.\n" 675msgid "Received HTTP 1.1 request without `Host' header.\n"
672msgstr "" 676msgstr ""
673 677
674#: src/microhttpd/connection.c:2799 678#: src/microhttpd/connection.c:2789
675msgid "Closing connection (failed to create response)\n" 679msgid "Closing connection (failed to create response)\n"
676msgstr "" 680msgstr ""
677 681
678#: src/microhttpd/connection.c:2939 682#: src/microhttpd/connection.c:2929
679msgid "Socket disconnected while reading request.\n" 683msgid "Socket disconnected while reading request.\n"
680msgstr "" 684msgstr ""
681 685
682#: src/microhttpd/connection.c:2945 686#: src/microhttpd/connection.c:2935
683msgid "Connection socket is closed due to error when reading request.\n" 687msgid "Connection socket is closed due to error when reading request.\n"
684msgstr "" 688msgstr ""
685 689
686#: src/microhttpd/connection.c:3054 690#: src/microhttpd/connection.c:3044
687#, c-format 691#, c-format
688msgid "Failed to send data in request for %s.\n" 692msgid "Failed to send data in request for %s.\n"
689msgstr "" 693msgstr ""
690 694
691#: src/microhttpd/connection.c:3063 695#: src/microhttpd/connection.c:3053
692#, c-format 696#, c-format
693msgid "Sent 100 continue response: `%.*s'\n" 697msgid "Sent 100 continue response: `%.*s'\n"
694msgstr "" 698msgstr ""
695 699
696#: src/microhttpd/connection.c:3087 700#: src/microhttpd/connection.c:3077
697msgid "Connection was closed while sending response headers.\n" 701msgid "Connection was closed while sending response headers.\n"
698msgstr "" 702msgstr ""
699 703
700#: src/microhttpd/connection.c:3128 704#: src/microhttpd/connection.c:3118
701msgid "Data offset exceeds limit" 705msgid "Data offset exceeds limit"
702msgstr "" 706msgstr ""
703 707
704#: src/microhttpd/connection.c:3137 708#: src/microhttpd/connection.c:3127
705#, c-format 709#, c-format
706msgid "Sent %d-byte DATA response: `%.*s'\n" 710msgid "Sent %d-byte DATA response: `%.*s'\n"
707msgstr "" 711msgstr ""
708 712
709#: src/microhttpd/connection.c:3154 713#: src/microhttpd/connection.c:3144
710#, c-format 714#, c-format
711msgid "Failed to send data in request for `%s'.\n" 715msgid "Failed to send data in request for `%s'.\n"
712msgstr "" 716msgstr ""
713 717
714#: src/microhttpd/connection.c:3182 src/microhttpd/connection.c:3210 718#: src/microhttpd/connection.c:3172 src/microhttpd/connection.c:3200
715msgid "Connection was closed while sending response body.\n" 719msgid "Connection was closed while sending response body.\n"
716msgstr "" 720msgstr ""
717 721
718#: src/microhttpd/connection.c:3233 722#: src/microhttpd/connection.c:3223
719msgid "Internal error\n" 723msgid "Internal error\n"
720msgstr "" 724msgstr ""
721 725
722#: src/microhttpd/connection.c:3306 726#: src/microhttpd/connection.c:3296
723msgid "" 727msgid ""
724"Failed to signal end of connection via inter-thread communication channel" 728"Failed to signal end of connection via inter-thread communication channel"
725msgstr "" 729msgstr ""
726 730
727#: src/microhttpd/connection.c:4053 731#: src/microhttpd/connection.c:4043
728msgid "Attempted to queue response on wrong thread!\n" 732msgid "Attempted to queue response on wrong thread!\n"
729msgstr "" 733msgstr ""
730 734
731#: src/microhttpd/connection.c:4064 735#: src/microhttpd/connection.c:4054
732msgid "" 736msgid ""
733"Attempted 'upgrade' connection on daemon without MHD_ALLOW_UPGRADE option!\n" 737"Attempted 'upgrade' connection on daemon without MHD_ALLOW_UPGRADE option!\n"
734msgstr "" 738msgstr ""
735 739
736#: src/microhttpd/connection.c:4073 740#: src/microhttpd/connection.c:4063
737msgid "Application used invalid status code for 'upgrade' response!\n" 741msgid "Application used invalid status code for 'upgrade' response!\n"
738msgstr "" 742msgstr ""
739 743
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index ce01107a..f934d6ad 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -70,7 +70,8 @@ endif
70 70
71if HAVE_ZLIB 71if HAVE_ZLIB
72noinst_PROGRAMS += \ 72noinst_PROGRAMS += \
73 http_compression 73 http_compression \
74 http_chunked_compression
74endif 75endif
75 76
76if HAVE_W32 77if HAVE_W32
@@ -206,8 +207,13 @@ https_fileserver_example_LDADD = \
206 207
207http_compression_SOURCES = \ 208http_compression_SOURCES = \
208 http_compression.c 209 http_compression.c
210http_chunked_compression_SOURCES = \
211 http_chunked_compression.c
209http_compression_LDADD = \ 212http_compression_LDADD = \
210 $(top_builddir)/src/microhttpd/libmicrohttpd.la 213 $(top_builddir)/src/microhttpd/libmicrohttpd.la
214http_chunked_compression_LDADD = \
215 $(top_builddir)/src/microhttpd/libmicrohttpd.la
211if HAVE_ZLIB 216if HAVE_ZLIB
212 http_compression_LDADD += -lz 217 http_compression_LDADD += -lz
218 http_chunked_compression_LDADD += -lz
213endif \ No newline at end of file 219endif \ No newline at end of file
diff --git a/src/examples/http_chunked_compression.c b/src/examples/http_chunked_compression.c
new file mode 100644
index 00000000..167771fa
--- /dev/null
+++ b/src/examples/http_chunked_compression.c
@@ -0,0 +1,199 @@
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2019 Christian Grothoff (and other contributing authors)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19/**
20 * @file http_chunked_compression.c
21 * @brief example for how to compress a chunked HTTP response
22 * @author Silvio Clecio (silvioprog)
23 */
24
25#include "platform.h"
26#include <zlib.h>
27#include <microhttpd.h>
28
29#define CHUNK 16384
30
31struct Holder {
32 FILE *file;
33 z_stream stream;
34 void *buf;
35};
36
37static int
38compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset, void **dest, size_t *dest_size,
39 void *tmp)
40{
41 unsigned int have;
42 int ret;
43 int flush;
44 *dest = NULL;
45 *dest_size = 0;
46 do
47 {
48 if (src_size > CHUNK)
49 {
50 strm->avail_in = CHUNK;
51 src_size -= CHUNK;
52 flush = Z_NO_FLUSH;
53 }
54 else
55 {
56 strm->avail_in = (uInt) src_size;
57 flush = Z_SYNC_FLUSH;
58 }
59 *offset += strm->avail_in;
60 strm->next_in = (Bytef *) src;
61 do
62 {
63 strm->avail_out = CHUNK;
64 strm->next_out = tmp;
65 ret = deflate (strm, flush);
66 have = CHUNK - strm->avail_out;
67 *dest_size += have;
68 *dest = realloc (*dest, *dest_size);
69 if (NULL == *dest)
70 return MHD_NO;
71 memcpy ((*dest) + ((*dest_size) - have), tmp, have);
72 }
73 while (0 == strm->avail_out);
74 }
75 while (flush != Z_SYNC_FLUSH);
76 return (Z_OK == ret) ? MHD_YES : MHD_NO;
77}
78
79static ssize_t
80read_cb (void *cls, uint64_t pos, char *mem, size_t size)
81{
82 struct Holder *holder = cls;
83 void *src;
84 void *buf;
85 src = malloc (size);
86 if (NULL == src)
87 return MHD_CONTENT_READER_END_WITH_ERROR;
88 size = fread (src, 1, size, holder->file);
89 if (size < 0)
90 {
91 size = MHD_CONTENT_READER_END_WITH_ERROR;
92 goto done;
93 }
94 if (0 == size)
95 {
96 size = MHD_CONTENT_READER_END_OF_STREAM;
97 goto done;
98 }
99 if (MHD_YES != compress_buf (&holder->stream, src, size, &pos, &buf, &size, holder->buf))
100 size = MHD_CONTENT_READER_END_WITH_ERROR;
101 else
102 {
103 memcpy (mem, buf, size);
104 free (buf);
105 }
106done:
107 free (src);
108 return size;
109}
110
111static void
112free_cb (void *cls)
113{
114 struct Holder *holder = cls;
115 fclose (holder->file);
116 deflateEnd (&holder->stream);
117 free (holder->buf);
118 free (holder);
119}
120
121static int
122ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const char *method, const char *version,
123 const char *upload_data, size_t *upload_size, void **ptr)
124{
125 struct Holder *holder;
126 struct MHD_Response *res;
127 int ret;
128 (void) cls;
129 (void) url;
130 (void) method;
131 (void) version;
132 (void) upload_data;
133 (void) upload_size;
134 if (NULL == *ptr)
135 {
136 *ptr = (void *) 1;
137 return MHD_YES;
138 }
139 *ptr = NULL;
140 holder = calloc (1, sizeof (struct Holder));
141 if (!holder)
142 return MHD_NO;
143 holder->file = fopen (__FILE__, "rb");
144 if (NULL == holder->file)
145 goto file_error;
146 ret = deflateInit(&holder->stream, Z_BEST_COMPRESSION);
147 if (ret != Z_OK)
148 goto stream_error;
149 holder->buf = malloc (CHUNK);
150 if (NULL == holder->buf)
151 goto buf_error;
152 res = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024, &read_cb, holder, &free_cb);
153 if (NULL == res)
154 goto error;
155 ret = MHD_add_response_header (res, MHD_HTTP_HEADER_CONTENT_ENCODING, "deflate");
156 if (MHD_YES != ret)
157 goto res_error;
158 ret = MHD_add_response_header (res, MHD_HTTP_HEADER_CONTENT_TYPE, "text/x-c");
159 if (MHD_YES != ret)
160 goto res_error;
161 ret = MHD_queue_response (con, MHD_HTTP_OK, res);
162res_error:
163 MHD_destroy_response (res);
164 return ret;
165error:
166 free (holder->buf);
167buf_error:
168 deflateEnd (&holder->stream);
169stream_error:
170 fclose (holder->file);
171file_error:
172 free (holder);
173 return MHD_NO;
174}
175
176int
177main (int argc, char *const *argv)
178{
179 struct MHD_Daemon *d;
180 unsigned int port;
181 if ((argc != 2) ||
182 (1 != sscanf (argv[1], "%u", &port)) ||
183 (UINT16_MAX < port))
184 {
185 fprintf (stderr, "%s PORT\n", argv[0]);
186 return 1;
187 }
188 d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, (uint16_t) port, NULL, NULL,
189 &ahc_echo, NULL,
190 MHD_OPTION_END);
191 if (NULL == d)
192 return 1;
193 if (0 == port)
194 MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT, &port);
195 fprintf (stdout, "HTTP server running at http://localhost:%u\n\nPress ENTER to stop the server ...\n", port);
196 (void) getc (stdin);
197 MHD_stop_daemon (d);
198 return 0;
199}
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index f654d1d7..4917f62b 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 Copyright (C) 2006-2018 Christian Grothoff (and other contributing authors) 3 Copyright (C) 2006--2019 Christian Grothoff (and other contributing authors)
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -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 0x00096301
130 130
131/** 131/**
132 * MHD-internal return code for "YES". 132 * MHD-internal return code for "YES".
@@ -1380,10 +1380,12 @@ enum MHD_OPTION
1380 * struct MHD_Connection *c, 1380 * struct MHD_Connection *c,
1381 * char *s) 1381 * char *s)
1382 * 1382 *
1383 * where the return value must be "strlen(s)" and "s" should be 1383 * where the return value must be the length of the value left in
1384 * updated. Note that the unescape function must not lengthen "s" 1384 * "s" (without the 0-terminator) and "s" should be updated. Note
1385 * (the result must be shorter than the input and still be 1385 * that the unescape function must not lengthen "s" (the result must
1386 * 0-terminated). "cls" will be set to the second argument 1386 * be shorter than the input and must still be 0-terminated).
1387 * However, it may also include binary zeros before the
1388 * 0-termination. "cls" will be set to the second argument
1387 * following #MHD_OPTION_UNESCAPE_CALLBACK. 1389 * following #MHD_OPTION_UNESCAPE_CALLBACK.
1388 */ 1390 */
1389 MHD_OPTION_UNESCAPE_CALLBACK = 16, 1391 MHD_OPTION_UNESCAPE_CALLBACK = 16,
@@ -2025,6 +2027,8 @@ typedef void
2025 * @param kind kind of the header we are looking at 2027 * @param kind kind of the header we are looking at
2026 * @param key key for the value, can be an empty string 2028 * @param key key for the value, can be an empty string
2027 * @param value corresponding value, can be NULL 2029 * @param value corresponding value, can be NULL
2030 * @param value_size number of bytes in @a value, NEW since #MHD_VERSION 0x00096301;
2031 * for C-strings, the length excludes the 0-terminator
2028 * @return #MHD_YES to continue iterating, 2032 * @return #MHD_YES to continue iterating,
2029 * #MHD_NO to abort the iteration 2033 * #MHD_NO to abort the iteration
2030 * @ingroup request 2034 * @ingroup request
@@ -2033,7 +2037,8 @@ typedef int
2033(*MHD_KeyValueIterator) (void *cls, 2037(*MHD_KeyValueIterator) (void *cls,
2034 enum MHD_ValueKind kind, 2038 enum MHD_ValueKind kind,
2035 const char *key, 2039 const char *key,
2036 const char *value); 2040 const char *value,
2041 size_t value_size);
2037 2042
2038 2043
2039/** 2044/**
@@ -2494,6 +2499,40 @@ MHD_set_connection_value (struct MHD_Connection *connection,
2494 2499
2495 2500
2496/** 2501/**
2502 * This function can be used to add an entry to the HTTP headers of a
2503 * connection (so that the #MHD_get_connection_values function will
2504 * return them -- and the `struct MHD_PostProcessor` will also see
2505 * them). This maybe required in certain situations (see Mantis
2506 * #1399) where (broken) HTTP implementations fail to supply values
2507 * needed by the post processor (or other parts of the application).
2508 *
2509 * This function MUST only be called from within the
2510 * #MHD_AccessHandlerCallback (otherwise, access maybe improperly
2511 * synchronized). Furthermore, the client must guarantee that the key
2512 * and value arguments are 0-terminated strings that are NOT freed
2513 * until the connection is closed. (The easiest way to do this is by
2514 * passing only arguments to permanently allocated strings.).
2515 *
2516 * @param connection the connection for which a
2517 * value should be set
2518 * @param kind kind of the value
2519 * @param key key for the value
2520 * @param value the value itself
2521 * @param value_size number of bytes in @a value (excluding 0-terminator for C-strings)
2522 * @return #MHD_NO if the operation could not be
2523 * performed due to insufficient memory;
2524 * #MHD_YES on success
2525 * @ingroup request
2526 */
2527int
2528MHD_set_connection_value2 (struct MHD_Connection *connection,
2529 enum MHD_ValueKind kind,
2530 const char *key,
2531 const char *value,
2532 size_t value_size);
2533
2534
2535/**
2497 * Sets the global error handler to a different implementation. @a cb 2536 * Sets the global error handler to a different implementation. @a cb
2498 * will only be called in the case of typically fatal, serious 2537 * will only be called in the case of typically fatal, serious
2499 * internal consistency issues. These issues should only arise in the 2538 * internal consistency issues. These issues should only arise in the
@@ -3075,7 +3114,8 @@ MHD_del_response_header (struct MHD_Response *response,
3075 */ 3114 */
3076_MHD_EXTERN int 3115_MHD_EXTERN int
3077MHD_get_response_headers (struct MHD_Response *response, 3116MHD_get_response_headers (struct MHD_Response *response,
3078 MHD_KeyValueIterator iterator, void *iterator_cls); 3117 MHD_KeyValueIterator iterator,
3118 void *iterator_cls);
3079 3119
3080 3120
3081/** 3121/**
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index e06ae993..4fe66805 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 Copyright (C) 2007-2017 Daniel Pittman and Christian Grothoff 3 Copyright (C) 2007-2019 Daniel Pittman and Christian Grothoff
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -706,7 +706,8 @@ MHD_get_connection_values (struct MHD_Connection *connection,
706 (MHD_YES != iterator (iterator_cls, 706 (MHD_YES != iterator (iterator_cls,
707 pos->kind, 707 pos->kind,
708 pos->header, 708 pos->header,
709 pos->value)) ) 709 pos->value,
710 pos->value_size)) )
710 return ret; 711 return ret;
711 } 712 }
712 return ret; 713 return ret;
@@ -733,16 +734,18 @@ MHD_get_connection_values (struct MHD_Connection *connection,
733 * @param kind kind of the value 734 * @param kind kind of the value
734 * @param key key for the value 735 * @param key key for the value
735 * @param value the value itself 736 * @param value the value itself
737 * @param value_size number of bytes in @a value
736 * @return #MHD_NO if the operation could not be 738 * @return #MHD_NO if the operation could not be
737 * performed due to insufficient memory; 739 * performed due to insufficient memory;
738 * #MHD_YES on success 740 * #MHD_YES on success
739 * @ingroup request 741 * @ingroup request
740 */ 742 */
741int 743int
742MHD_set_connection_value (struct MHD_Connection *connection, 744MHD_set_connection_value2 (struct MHD_Connection *connection,
743 enum MHD_ValueKind kind, 745 enum MHD_ValueKind kind,
744 const char *key, 746 const char *key,
745 const char *value) 747 const char *value,
748 size_t value_size)
746{ 749{
747 struct MHD_HTTP_Header *pos; 750 struct MHD_HTTP_Header *pos;
748 751
@@ -753,6 +756,7 @@ MHD_set_connection_value (struct MHD_Connection *connection,
753 return MHD_NO; 756 return MHD_NO;
754 pos->header = (char *) key; 757 pos->header = (char *) key;
755 pos->value = (char *) value; 758 pos->value = (char *) value;
759 pos->value_size = value_size;
756 pos->kind = kind; 760 pos->kind = kind;
757 pos->next = NULL; 761 pos->next = NULL;
758 /* append 'pos' to the linked list of headers */ 762 /* append 'pos' to the linked list of headers */
@@ -771,6 +775,47 @@ MHD_set_connection_value (struct MHD_Connection *connection,
771 775
772 776
773/** 777/**
778 * This function can be used to add an entry to the HTTP headers of a
779 * connection (so that the #MHD_get_connection_values function will
780 * return them -- and the `struct MHD_PostProcessor` will also see
781 * them). This maybe required in certain situations (see Mantis
782 * #1399) where (broken) HTTP implementations fail to supply values
783 * needed by the post processor (or other parts of the application).
784 *
785 * This function MUST only be called from within the
786 * #MHD_AccessHandlerCallback (otherwise, access maybe improperly
787 * synchronized). Furthermore, the client must guarantee that the key
788 * and value arguments are 0-terminated strings that are NOT freed
789 * until the connection is closed. (The easiest way to do this is by
790 * passing only arguments to permanently allocated strings.).
791 *
792 * @param connection the connection for which a
793 * value should be set
794 * @param kind kind of the value
795 * @param key key for the value
796 * @param value the value itself
797 * @return #MHD_NO if the operation could not be
798 * performed due to insufficient memory;
799 * #MHD_YES on success
800 * @ingroup request
801 */
802int
803MHD_set_connection_value (struct MHD_Connection *connection,
804 enum MHD_ValueKind kind,
805 const char *key,
806 const char *value)
807{
808 return MHD_set_connection_value2 (connection,
809 kind,
810 key,
811 value,
812 NULL != value
813 ? strlen (value)
814 : 0);
815}
816
817
818/**
774 * Get a particular header value. If multiple 819 * Get a particular header value. If multiple
775 * values match the kind, return any one of them. 820 * values match the kind, return any one of them.
776 * 821 *
@@ -2061,19 +2106,22 @@ get_next_header_line (struct MHD_Connection *connection,
2061 * @param kind kind of the value 2106 * @param kind kind of the value
2062 * @param key key for the value 2107 * @param key key for the value
2063 * @param value the value itself 2108 * @param value the value itself
2109 * @param value_size number of bytes in @a value
2064 * @return #MHD_NO on failure (out of memory), #MHD_YES for success 2110 * @return #MHD_NO on failure (out of memory), #MHD_YES for success
2065 */ 2111 */
2066static int 2112static int
2067connection_add_header (struct MHD_Connection *connection, 2113connection_add_header (struct MHD_Connection *connection,
2068 const char *key, 2114 const char *key,
2069 const char *value, 2115 const char *value,
2116 size_t value_size,
2070 enum MHD_ValueKind kind) 2117 enum MHD_ValueKind kind)
2071{ 2118{
2072 if (MHD_NO == 2119 if (MHD_NO ==
2073 MHD_set_connection_value (connection, 2120 MHD_set_connection_value2 (connection,
2074 kind, 2121 kind,
2075 key, 2122 key,
2076 value)) 2123 value,
2124 value_size))
2077 { 2125 {
2078#ifdef HAVE_MESSAGES 2126#ifdef HAVE_MESSAGES
2079 MHD_DLOG (connection->daemon, 2127 MHD_DLOG (connection->daemon,
@@ -2104,6 +2152,7 @@ parse_cookie_header (struct MHD_Connection *connection)
2104 char *semicolon; 2152 char *semicolon;
2105 char *equals; 2153 char *equals;
2106 char *ekill; 2154 char *ekill;
2155 char *end;
2107 char old; 2156 char old;
2108 int quotes; 2157 int quotes;
2109 2158
@@ -2155,6 +2204,7 @@ parse_cookie_header (struct MHD_Connection *connection)
2155 connection_add_header (connection, 2204 connection_add_header (connection,
2156 pos, 2205 pos,
2157 "", 2206 "",
2207 0,
2158 MHD_COOKIE_KIND)) 2208 MHD_COOKIE_KIND))
2159 return MHD_NO; 2209 return MHD_NO;
2160 if (old == '\0') 2210 if (old == '\0')
@@ -2174,6 +2224,7 @@ parse_cookie_header (struct MHD_Connection *connection)
2174 quotes = (quotes + 1) & 1; 2224 quotes = (quotes + 1) & 1;
2175 semicolon++; 2225 semicolon++;
2176 } 2226 }
2227 end = semicolon;
2177 if ('\0' == semicolon[0]) 2228 if ('\0' == semicolon[0])
2178 semicolon = NULL; 2229 semicolon = NULL;
2179 if (NULL != semicolon) 2230 if (NULL != semicolon)
@@ -2183,15 +2234,17 @@ parse_cookie_header (struct MHD_Connection *connection)
2183 } 2234 }
2184 /* remove quotes */ 2235 /* remove quotes */
2185 if ( ('"' == equals[0]) && 2236 if ( ('"' == equals[0]) &&
2186 ('"' == equals[strlen (equals) - 1]) ) 2237 ('"' == end[-1]) )
2187 { 2238 {
2188 equals[strlen (equals) - 1] = '\0';
2189 equals++; 2239 equals++;
2240 end--;
2241 *end = '\0';
2190 } 2242 }
2191 if (MHD_NO == 2243 if (MHD_NO ==
2192 connection_add_header (connection, 2244 connection_add_header (connection,
2193 pos, 2245 pos,
2194 equals, 2246 equals,
2247 end - equals,
2195 MHD_COOKIE_KIND)) 2248 MHD_COOKIE_KIND))
2196 return MHD_NO; 2249 return MHD_NO;
2197 pos = semicolon; 2250 pos = semicolon;
@@ -2257,7 +2310,7 @@ parse_initial_message_line (struct MHD_Connection *connection,
2257 http_version--; 2310 http_version--;
2258 if (http_version > uri) 2311 if (http_version > uri)
2259 { 2312 {
2260 /* http_version points to string before HTTP version string */ 2313 /* http_version points to character before HTTP version string */
2261 http_version[0] = '\0'; 2314 http_version[0] = '\0';
2262 connection->version = http_version + 1; 2315 connection->version = http_version + 1;
2263 uri_len = http_version - uri; 2316 uri_len = http_version - uri;
@@ -2277,24 +2330,21 @@ parse_initial_message_line (struct MHD_Connection *connection,
2277 return MHD_NO; 2330 return MHD_NO;
2278 } 2331 }
2279 2332
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, 2333 args = memchr (uri,
2286 '?', 2334 '?',
2287 uri_len); 2335 uri_len);
2288 } 2336 }
2289 2337
2338 /* log callback before we modify URI *or* args */
2290 if (NULL != daemon->uri_log_callback) 2339 if (NULL != daemon->uri_log_callback)
2291 { 2340 {
2292 connection->client_aware = true; 2341 connection->client_aware = true;
2293 connection->client_context 2342 connection->client_context
2294 = daemon->uri_log_callback (daemon->uri_log_callback_cls, 2343 = daemon->uri_log_callback (daemon->uri_log_callback_cls,
2295 curi, 2344 uri,
2296 connection); 2345 connection);
2297 } 2346 }
2347
2298 if (NULL != args) 2348 if (NULL != args)
2299 { 2349 {
2300 args[0] = '\0'; 2350 args[0] = '\0';
@@ -2306,6 +2356,12 @@ parse_initial_message_line (struct MHD_Connection *connection,
2306 &connection_add_header, 2356 &connection_add_header,
2307 &unused_num_headers); 2357 &unused_num_headers);
2308 } 2358 }
2359
2360 /* unescape URI *after* searching for arguments and log callback */
2361 if (NULL != uri)
2362 daemon->unescape_callback (daemon->unescape_callback_cls,
2363 connection,
2364 uri);
2309 connection->url = curi; 2365 connection->url = curi;
2310 return MHD_YES; 2366 return MHD_YES;
2311} 2367}
@@ -2708,16 +2764,20 @@ process_broken_line (struct MHD_Connection *connection,
2708 REQUEST_TOO_BIG); 2764 REQUEST_TOO_BIG);
2709 return MHD_NO; 2765 return MHD_NO;
2710 } 2766 }
2711 memcpy (&last[last_len], tmp, tmp_len + 1); 2767 memcpy (&last[last_len],
2768 tmp,
2769 tmp_len + 1);
2712 connection->last = last; 2770 connection->last = last;
2713 return MHD_YES; /* possibly more than 2 lines... */ 2771 return MHD_YES; /* possibly more than 2 lines... */
2714 } 2772 }
2715 mhd_assert ( (NULL != last) && 2773 mhd_assert ( (NULL != last) &&
2716 (NULL != connection->colon) ); 2774 (NULL != connection->colon) );
2717 if ((MHD_NO == connection_add_header (connection, 2775 if (MHD_NO ==
2718 last, 2776 connection_add_header (connection,
2719 connection->colon, 2777 last,
2720 kind))) 2778 connection->colon,
2779 strlen (connection->colon),
2780 kind))
2721 { 2781 {
2722 transmit_error_response (connection, 2782 transmit_error_response (connection,
2723 MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, 2783 MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index d4e23fef..8f04bf38 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -732,6 +732,7 @@ calculate_nonce (uint32_t nonce_time,
732 * @param connection the connection 732 * @param connection the connection
733 * @param key the key 733 * @param key the key
734 * @param value the value, can be NULL 734 * @param value the value, can be NULL
735 * @param value_size number of bytes in @a value
735 * @param kind type of the header 736 * @param kind type of the header
736 * @return #MHD_YES if the key-value pair is in the headers, 737 * @return #MHD_YES if the key-value pair is in the headers,
737 * #MHD_NO if not 738 * #MHD_NO if not
@@ -740,6 +741,7 @@ static int
740test_header (struct MHD_Connection *connection, 741test_header (struct MHD_Connection *connection,
741 const char *key, 742 const char *key,
742 const char *value, 743 const char *value,
744 size_t value_size,
743 enum MHD_ValueKind kind) 745 enum MHD_ValueKind kind)
744{ 746{
745 struct MHD_HTTP_Header *pos; 747 struct MHD_HTTP_Header *pos;
@@ -748,6 +750,8 @@ test_header (struct MHD_Connection *connection,
748 { 750 {
749 if (kind != pos->kind) 751 if (kind != pos->kind)
750 continue; 752 continue;
753 if (value_size != pos->value_size)
754 continue;
751 if (0 != strcmp (key, 755 if (0 != strcmp (key,
752 pos->header)) 756 pos->header))
753 continue; 757 continue;
@@ -756,8 +760,9 @@ test_header (struct MHD_Connection *connection,
756 return MHD_YES; 760 return MHD_YES;
757 if ( (NULL == value) || 761 if ( (NULL == value) ||
758 (NULL == pos->value) || 762 (NULL == pos->value) ||
759 (0 != strcmp (value, 763 (0 != memcmp (value,
760 pos->value)) ) 764 pos->value,
765 value_size)) )
761 continue; 766 continue;
762 return MHD_YES; 767 return MHD_YES;
763 } 768 }
@@ -862,6 +867,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
862 uint32_t t; 867 uint32_t t;
863 size_t left; /* number of characters left in 'header' for 'uri' */ 868 size_t left; /* number of characters left in 'header' for 'uri' */
864 uint64_t nci; 869 uint64_t nci;
870 char *qmark;
865 871
866 VLA_CHECK_LEN_DIGEST(da->digest_size); 872 VLA_CHECK_LEN_DIGEST(da->digest_size);
867 header = MHD_lookup_connection_value (connection, 873 header = MHD_lookup_connection_value (connection,
@@ -1072,15 +1078,17 @@ digest_auth_check_all (struct MHD_Connection *connection,
1072 uri, 1078 uri,
1073 hentity, 1079 hentity,
1074 da); 1080 da);
1075 1081 qmark = strchr (uri,
1082 '?');
1083 if (NULL != qmark)
1084 *qmark = '\0';
1076 1085
1077 /* Need to unescape URI before comparing with connection->url */ 1086 /* Need to unescape URI before comparing with connection->url */
1078 daemon->unescape_callback (daemon->unescape_callback_cls, 1087 daemon->unescape_callback (daemon->unescape_callback_cls,
1079 connection, 1088 connection,
1080 uri); 1089 uri);
1081 if (0 != strncmp (uri, 1090 if (0 != strcmp (uri,
1082 connection->url, 1091 connection->url))
1083 strlen (connection->url)))
1084 { 1092 {
1085#ifdef HAVE_MESSAGES 1093#ifdef HAVE_MESSAGES
1086 MHD_DLOG (daemon, 1094 MHD_DLOG (daemon,
@@ -1091,8 +1099,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
1091 } 1099 }
1092 1100
1093 { 1101 {
1094 const char *args = strchr (uri, 1102 const char *args = qmark;
1095 '?');
1096 1103
1097 if (NULL == args) 1104 if (NULL == args)
1098 args = ""; 1105 args = "";
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index d2532c54..8e9e0aac 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -162,7 +162,7 @@ MHD_http_unescape (char *val)
162 } 162 }
163 } 163 }
164 *wpos = '\0'; /* add 0-terminator */ 164 *wpos = '\0'; /* add 0-terminator */
165 return wpos - val; /* = strlen(val) */ 165 return wpos - val;
166} 166}
167 167
168 168
@@ -190,6 +190,7 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
190 struct MHD_Daemon *daemon = connection->daemon; 190 struct MHD_Daemon *daemon = connection->daemon;
191 char *equals; 191 char *equals;
192 char *amper; 192 char *amper;
193 size_t len;
193 194
194 *num_headers = 0; 195 *num_headers = 0;
195 while ( (NULL != args) && 196 while ( (NULL != args) &&
@@ -210,6 +211,7 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
210 if (MHD_YES != cb (connection, 211 if (MHD_YES != cb (connection,
211 args, 212 args,
212 NULL, 213 NULL,
214 0,
213 kind)) 215 kind))
214 return MHD_NO; 216 return MHD_NO;
215 (*num_headers)++; 217 (*num_headers)++;
@@ -223,12 +225,13 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
223 connection, 225 connection,
224 args); 226 args);
225 MHD_unescape_plus (equals); 227 MHD_unescape_plus (equals);
226 daemon->unescape_callback (daemon->unescape_callback_cls, 228 len = daemon->unescape_callback (daemon->unescape_callback_cls,
227 connection, 229 connection,
228 equals); 230 equals);
229 if (MHD_YES != cb (connection, 231 if (MHD_YES != cb (connection,
230 args, 232 args,
231 equals, 233 equals,
234 len,
232 kind)) 235 kind))
233 return MHD_NO; 236 return MHD_NO;
234 (*num_headers)++; 237 (*num_headers)++;
@@ -248,6 +251,7 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
248 if (MHD_YES != cb (connection, 251 if (MHD_YES != cb (connection,
249 args, 252 args,
250 NULL, 253 NULL,
254 0,
251 kind)) 255 kind))
252 return MHD_NO; 256 return MHD_NO;
253 /* continue with 'bar' */ 257 /* continue with 'bar' */
@@ -264,12 +268,13 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
264 connection, 268 connection,
265 args); 269 args);
266 MHD_unescape_plus (equals); 270 MHD_unescape_plus (equals);
267 daemon->unescape_callback (daemon->unescape_callback_cls, 271 len = daemon->unescape_callback (daemon->unescape_callback_cls,
268 connection, 272 connection,
269 equals); 273 equals);
270 if (MHD_YES != cb (connection, 274 if (MHD_YES != cb (connection,
271 args, 275 args,
272 equals, 276 equals,
277 len,
273 kind)) 278 kind))
274 return MHD_NO; 279 return MHD_NO;
275 (*num_headers)++; 280 (*num_headers)++;
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index d09de610..f77ebd10 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -276,6 +276,11 @@ struct MHD_HTTP_Header
276 char *value; 276 char *value;
277 277
278 /** 278 /**
279 * Number of bytes in @a value.
280 */
281 size_t value_size;
282
283 /**
279 * Type of the header (where in the HTTP protocol is this header 284 * Type of the header (where in the HTTP protocol is this header
280 * from). 285 * from).
281 */ 286 */
@@ -1881,7 +1886,8 @@ MHD_unescape_plus (char *arg);
1881 * 1886 *
1882 * @param connection context of the iteration 1887 * @param connection context of the iteration
1883 * @param key 0-terminated key string, never NULL 1888 * @param key 0-terminated key string, never NULL
1884 * @param value 0-terminated value string, may be NULL 1889 * @param value 0-terminated binary data, may include binary zeros, may be NULL
1890 * @param value_size number of bytes in value
1885 * @param kind origin of the key-value pair 1891 * @param kind origin of the key-value pair
1886 * @return #MHD_YES on success (continue to iterate) 1892 * @return #MHD_YES on success (continue to iterate)
1887 * #MHD_NO to signal failure (and abort iteration) 1893 * #MHD_NO to signal failure (and abort iteration)
@@ -1890,6 +1896,7 @@ typedef int
1890(*MHD_ArgumentIterator_)(struct MHD_Connection *connection, 1896(*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
1891 const char *key, 1897 const char *key,
1892 const char *value, 1898 const char *value,
1899 size_t value_size,
1893 enum MHD_ValueKind kind); 1900 enum MHD_ValueKind kind);
1894 1901
1895 1902
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 263f8303..9f328eef 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -240,7 +240,8 @@ MHD_get_response_headers (struct MHD_Response *response,
240 (MHD_YES != iterator (iterator_cls, 240 (MHD_YES != iterator (iterator_cls,
241 pos->kind, 241 pos->kind,
242 pos->header, 242 pos->header,
243 pos->value))) 243 pos->value,
244 pos->value_size)))
244 break; 245 break;
245 } 246 }
246 return numHeaders; 247 return numHeaders;
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index cb81283f..7e4fd4c6 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -35,6 +35,8 @@
35#include "mhd_sockets.h" /* only macros used */ 35#include "mhd_sockets.h" /* only macros used */
36 36
37 37
38#define EXPECTED_URI_PATH "/hello_world?a=%26&b=c"
39
38#ifdef _WIN32 40#ifdef _WIN32
39#ifndef WIN32_LEAN_AND_MEAN 41#ifndef WIN32_LEAN_AND_MEAN
40#define WIN32_LEAN_AND_MEAN 1 42#define WIN32_LEAN_AND_MEAN 1
@@ -64,6 +66,7 @@ struct CBC
64 size_t size; 66 size_t size;
65}; 67};
66 68
69
67static size_t 70static size_t
68copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 71copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
69{ 72{
@@ -76,6 +79,24 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
76 return size * nmemb; 79 return size * nmemb;
77} 80}
78 81
82
83static void *
84log_cb (void *cls,
85 const char *uri,
86 struct MHD_Connection *con)
87{
88 if (0 != strcmp (uri,
89 EXPECTED_URI_PATH))
90 {
91 fprintf (stderr,
92 "Wrong URI: `%s'\n",
93 uri);
94 abort ();
95 }
96 return NULL;
97}
98
99
79static int 100static int
80ahc_echo (void *cls, 101ahc_echo (void *cls,
81 struct MHD_Connection *connection, 102 struct MHD_Connection *connection,
@@ -89,7 +110,10 @@ ahc_echo (void *cls,
89 const char *me = cls; 110 const char *me = cls;
90 struct MHD_Response *response; 111 struct MHD_Response *response;
91 int ret; 112 int ret;
92 (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ 113 const char *v;
114 (void) version;
115 (void) upload_data;
116 (void) upload_data_size; /* Unused. Silence compiler warning. */
93 117
94 if (0 != strcasecmp (me, method)) 118 if (0 != strcasecmp (me, method))
95 return MHD_NO; /* unexpected method */ 119 return MHD_NO; /* unexpected method */
@@ -99,10 +123,26 @@ ahc_echo (void *cls,
99 return MHD_YES; 123 return MHD_YES;
100 } 124 }
101 *unused = NULL; 125 *unused = NULL;
126 v = MHD_lookup_connection_value (connection,
127 MHD_GET_ARGUMENT_KIND,
128 "a");
129 if ( (NULL == v) ||
130 (0 != strcmp ("&",
131 v)) )
132 abort ();
133 v = MHD_lookup_connection_value (connection,
134 MHD_GET_ARGUMENT_KIND,
135 "b");
136 if ( (NULL == v) ||
137 (0 != strcmp ("c",
138 v)) )
139 abort ();
102 response = MHD_create_response_from_buffer (strlen (url), 140 response = MHD_create_response_from_buffer (strlen (url),
103 (void *) url, 141 (void *) url,
104 MHD_RESPMEM_MUST_COPY); 142 MHD_RESPMEM_MUST_COPY);
105 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 143 ret = MHD_queue_response (connection,
144 MHD_HTTP_OK,
145 response);
106 MHD_destroy_response (response); 146 MHD_destroy_response (response);
107 if (ret == MHD_NO) 147 if (ret == MHD_NO)
108 abort (); 148 abort ();
@@ -131,7 +171,10 @@ testInternalGet (int poll_flag)
131 cbc.size = 2048; 171 cbc.size = 2048;
132 cbc.pos = 0; 172 cbc.pos = 0;
133 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 173 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
134 global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 174 global_port, NULL, NULL,
175 &ahc_echo, "GET",
176 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
177 MHD_OPTION_END);
135 if (d == NULL) 178 if (d == NULL)
136 return 1; 179 return 1;
137 if (0 == global_port) 180 if (0 == global_port)
@@ -143,7 +186,7 @@ testInternalGet (int poll_flag)
143 global_port = (int)dinfo->port; 186 global_port = (int)dinfo->port;
144 } 187 }
145 c = curl_easy_init (); 188 c = curl_easy_init ();
146 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); 189 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1" EXPECTED_URI_PATH);
147 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); 190 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
148 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 191 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
149 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 192 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
@@ -198,7 +241,10 @@ testMultithreadedGet (int poll_flag)
198 cbc.size = 2048; 241 cbc.size = 2048;
199 cbc.pos = 0; 242 cbc.pos = 0;
200 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 243 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
201 global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 244 global_port, NULL, NULL,
245 &ahc_echo, "GET",
246 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
247 MHD_OPTION_END);
202 if (d == NULL) 248 if (d == NULL)
203 return 16; 249 return 16;
204 if (0 == global_port) 250 if (0 == global_port)
@@ -210,7 +256,7 @@ testMultithreadedGet (int poll_flag)
210 global_port = (int)dinfo->port; 256 global_port = (int)dinfo->port;
211 } 257 }
212 c = curl_easy_init (); 258 c = curl_easy_init ();
213 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); 259 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1" EXPECTED_URI_PATH);
214 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); 260 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
215 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 261 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
216 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 262 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
@@ -265,8 +311,11 @@ testMultithreadedPoolGet (int poll_flag)
265 cbc.size = 2048; 311 cbc.size = 2048;
266 cbc.pos = 0; 312 cbc.pos = 0;
267 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 313 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
268 global_port, NULL, NULL, &ahc_echo, "GET", 314 global_port, NULL, NULL,
269 MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); 315 &ahc_echo, "GET",
316 MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT,
317 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
318 MHD_OPTION_END);
270 if (d == NULL) 319 if (d == NULL)
271 return 16; 320 return 16;
272 if (0 == global_port) 321 if (0 == global_port)
@@ -278,7 +327,7 @@ testMultithreadedPoolGet (int poll_flag)
278 global_port = (int)dinfo->port; 327 global_port = (int)dinfo->port;
279 } 328 }
280 c = curl_easy_init (); 329 c = curl_easy_init ();
281 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); 330 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1" EXPECTED_URI_PATH);
282 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); 331 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
283 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 332 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
284 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 333 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
@@ -348,7 +397,10 @@ testExternalGet ()
348 cbc.size = 2048; 397 cbc.size = 2048;
349 cbc.pos = 0; 398 cbc.pos = 0;
350 d = MHD_start_daemon (MHD_USE_ERROR_LOG, 399 d = MHD_start_daemon (MHD_USE_ERROR_LOG,
351 global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 400 global_port, NULL, NULL,
401 &ahc_echo, "GET",
402 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
403 MHD_OPTION_END);
352 if (d == NULL) 404 if (d == NULL)
353 return 256; 405 return 256;
354 if (0 == global_port) 406 if (0 == global_port)
@@ -360,7 +412,7 @@ testExternalGet ()
360 global_port = (int)dinfo->port; 412 global_port = (int)dinfo->port;
361 } 413 }
362 c = curl_easy_init (); 414 c = curl_easy_init ();
363 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); 415 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1" EXPECTED_URI_PATH);
364 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); 416 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
365 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 417 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
366 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 418 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
@@ -494,6 +546,7 @@ testUnknownPortGet (int poll_flag)
494 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 546 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
495 0, NULL, NULL, &ahc_echo, "GET", 547 0, NULL, NULL, &ahc_echo, "GET",
496 MHD_OPTION_SOCK_ADDR, &addr, 548 MHD_OPTION_SOCK_ADDR, &addr,
549 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
497 MHD_OPTION_END); 550 MHD_OPTION_END);
498 if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) 551 if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
499 { 552 {
@@ -517,8 +570,11 @@ testUnknownPortGet (int poll_flag)
517 port = (int)dinfo->port; 570 port = (int)dinfo->port;
518 } 571 }
519 572
520 snprintf(buf, sizeof(buf), "http://127.0.0.1:%d/hello_world", 573 snprintf(buf,
521 port); 574 sizeof(buf),
575 "http://127.0.0.1:%d%s",
576 port,
577 EXPECTED_URI_PATH);
522 578
523 c = curl_easy_init (); 579 c = curl_easy_init ();
524 curl_easy_setopt (c, CURLOPT_URL, buf); 580 curl_easy_setopt (c, CURLOPT_URL, buf);
@@ -570,7 +626,10 @@ testStopRace (int poll_flag)
570 } 626 }
571 627
572 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 628 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
573 global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 629 global_port, NULL, NULL,
630 &ahc_echo, "GET",
631 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
632 MHD_OPTION_END);
574 if (d == NULL) 633 if (d == NULL)
575 return 16; 634 return 16;
576 if (0 == global_port) 635 if (0 == global_port)
@@ -686,7 +745,10 @@ testEmptyGet (int poll_flag)
686 cbc.size = 2048; 745 cbc.size = 2048;
687 cbc.pos = 0; 746 cbc.pos = 0;
688 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 747 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
689 global_port, NULL, NULL, &ahc_empty, NULL, MHD_OPTION_END); 748 global_port, NULL, NULL,
749 &ahc_empty, NULL,
750 MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
751 MHD_OPTION_END);
690 if (d == NULL) 752 if (d == NULL)
691 return 4194304; 753 return 4194304;
692 if (0 == global_port) 754 if (0 == global_port)
@@ -698,7 +760,7 @@ testEmptyGet (int poll_flag)
698 global_port = (int)dinfo->port; 760 global_port = (int)dinfo->port;
699 } 761 }
700 c = curl_easy_init (); 762 c = curl_easy_init ();
701 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); 763 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1" EXPECTED_URI_PATH);
702 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); 764 curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
703 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 765 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
704 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 766 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c
index f9c7cd03..3be814e2 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -65,8 +65,13 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
65 return size * nmemb; 65 return size * nmemb;
66} 66}
67 67
68
68static int 69static int
69kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) 70kv_cb (void *cls,
71 enum MHD_ValueKind kind,
72 const char *key,
73 const char *value,
74 size_t value_size)
70{ 75{
71 if ((0 == strcmp (key, MHD_HTTP_HEADER_HOST)) && 76 if ((0 == strcmp (key, MHD_HTTP_HEADER_HOST)) &&
72 (0 == strncmp (value, "127.0.0.1", strlen("127.0.0.1"))) && (kind == MHD_HEADER_KIND)) 77 (0 == strncmp (value, "127.0.0.1", strlen("127.0.0.1"))) && (kind == MHD_HEADER_KIND))
@@ -77,6 +82,7 @@ kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
77 return MHD_YES; 82 return MHD_YES;
78} 83}
79 84
85
80static int 86static int
81ahc_echo (void *cls, 87ahc_echo (void *cls,
82 struct MHD_Connection *connection, 88 struct MHD_Connection *connection,
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index 8675f19c..1e6cc28c 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -67,13 +67,18 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
67 return size * nmemb; 67 return size * nmemb;
68} 68}
69 69
70
70static int 71static int
71test_values (void *cls, 72test_values (void *cls,
72 enum MHD_ValueKind kind, 73 enum MHD_ValueKind kind,
73 const char *key, 74 const char *key,
74 const char *value) 75 const char *value,
76 size_t value_size)
75{ 77{
76 (void)cls;(void)kind; /* Unused. Silent compiler warning. */ 78 (void) cls;
79 (void) kind;
80 (void) value_size;
81
77 if ( (0 == strcmp (key, "a")) && 82 if ( (0 == strcmp (key, "a")) &&
78 (0 == strcmp (value, "b")) ) 83 (0 == strcmp (value, "b")) )
79 matches += 1; 84 matches += 1;