aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-04-16 14:20:24 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-04-17 15:24:37 +0300
commit3ebb98295631a662bdb66b9148f4f43000dc3671 (patch)
tree549bd9390a8332518a3d7392666225a87a783409 /src
parente76fc7f8aaf4907aa6ca0200e9682830f94a9ac2 (diff)
downloadlibmicrohttpd-3ebb98295631a662bdb66b9148f4f43000dc3671.tar.gz
libmicrohttpd-3ebb98295631a662bdb66b9148f4f43000dc3671.zip
Refactoring: different types for response and request headers
Request headers are always read-only (const char *), while response headers are modifiable. Should help with catching errors in code.
Diffstat (limited to 'src')
-rw-r--r--src/microhttpd/connection.c28
-rw-r--r--src/microhttpd/digestauth.c4
-rw-r--r--src/microhttpd/internal.h62
-rw-r--r--src/microhttpd/response.c28
-rw-r--r--src/microhttpd/response.h2
-rw-r--r--src/microhttpd/test_postprocessor.c32
-rw-r--r--src/microhttpd/test_postprocessor_amp.c4
-rw-r--r--src/microhttpd/test_postprocessor_large.c4
8 files changed, 101 insertions, 63 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 513d6415..798c285c 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -387,7 +387,7 @@ MHD_get_connection_values (struct MHD_Connection *connection,
387 void *iterator_cls) 387 void *iterator_cls)
388{ 388{
389 int ret; 389 int ret;
390 struct MHD_HTTP_Header *pos; 390 struct MHD_HTTP_Req_Header *pos;
391 391
392 if (NULL == connection) 392 if (NULL == connection)
393 return -1; 393 return -1;
@@ -426,7 +426,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection,
426 void *iterator_cls) 426 void *iterator_cls)
427{ 427{
428 int ret; 428 int ret;
429 struct MHD_HTTP_Header *pos; 429 struct MHD_HTTP_Req_Header *pos;
430 430
431 if (NULL == connection) 431 if (NULL == connection)
432 return -1; 432 return -1;
@@ -480,10 +480,10 @@ MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection,
480 const char *value, 480 const char *value,
481 size_t value_size) 481 size_t value_size)
482{ 482{
483 struct MHD_HTTP_Header *pos; 483 struct MHD_HTTP_Req_Header *pos;
484 484
485 pos = connection_alloc_memory (connection, 485 pos = connection_alloc_memory (connection,
486 sizeof (struct MHD_HTTP_Header)); 486 sizeof (struct MHD_HTTP_Res_Header));
487 if (NULL == pos) 487 if (NULL == pos)
488 return MHD_NO; 488 return MHD_NO;
489 pos->header = (char *) key; 489 pos->header = (char *) key;
@@ -653,7 +653,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection,
653 const char **value_ptr, 653 const char **value_ptr,
654 size_t *value_size_ptr) 654 size_t *value_size_ptr)
655{ 655{
656 struct MHD_HTTP_Header *pos; 656 struct MHD_HTTP_Req_Header *pos;
657 657
658 if (NULL == connection) 658 if (NULL == connection)
659 return MHD_NO; 659 return MHD_NO;
@@ -716,14 +716,10 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection,
716 const char *token, 716 const char *token,
717 size_t token_len) 717 size_t token_len)
718{ 718{
719 struct MHD_HTTP_Header *pos; 719 struct MHD_HTTP_Req_Header *pos;
720 720
721 if ((NULL == connection) || (NULL == header) || (0 == header[0]) || (NULL == 721 if ((NULL == connection) || (NULL == header) || (0 == header[0]) ||
722 token) || 722 (NULL == token) || (0 == token[0]))
723 (0 ==
724 token
725 [
726 0]) )
727 return false; 723 return false;
728 724
729 for (pos = connection->headers_received; NULL != pos; pos = pos->next) 725 for (pos = connection->headers_received; NULL != pos; pos = pos->next)
@@ -1934,7 +1930,7 @@ add_user_headers (char *buf,
1934 bool add_keep_alive) 1930 bool add_keep_alive)
1935{ 1931{
1936 struct MHD_Response *const r = response; /**< a short alias */ 1932 struct MHD_Response *const r = response; /**< a short alias */
1937 struct MHD_HTTP_Header *hdr; /**< Iterates through User-specified headers */ 1933 struct MHD_HTTP_Res_Header *hdr; /**< Iterates through User-specified headers */
1938 size_t el_size; /**< the size of current element to be added to the @a buf */ 1934 size_t el_size; /**< the size of current element to be added to the @a buf */
1939 1935
1940 mhd_assert (! add_close || ! add_keep_alive); 1936 mhd_assert (! add_close || ! add_keep_alive);
@@ -2276,7 +2272,7 @@ build_connection_chunked_response_footer (struct MHD_Connection *connection)
2276 size_t buf_size; /**< the size of the @a buf */ 2272 size_t buf_size; /**< the size of the @a buf */
2277 size_t used_size; /**< the used size of the @a buf */ 2273 size_t used_size; /**< the used size of the @a buf */
2278 struct MHD_Connection *const c = connection; /**< a short alias */ 2274 struct MHD_Connection *const c = connection; /**< a short alias */
2279 struct MHD_HTTP_Header *pos; 2275 struct MHD_HTTP_Res_Header *pos;
2280 2276
2281 mhd_assert (connection->rp_props.chunked); 2277 mhd_assert (connection->rp_props.chunked);
2282 /* TODO: allow combining of the final footer with the last chunk, 2278 /* TODO: allow combining of the final footer with the last chunk,
@@ -5219,7 +5215,7 @@ MHD_queue_response (struct MHD_Connection *connection,
5219#ifdef UPGRADE_SUPPORT 5215#ifdef UPGRADE_SUPPORT
5220 if (NULL != response->upgrade_handler) 5216 if (NULL != response->upgrade_handler)
5221 { 5217 {
5222 struct MHD_HTTP_Header *conn_header; 5218 struct MHD_HTTP_Res_Header *conn_header;
5223 if (0 == (daemon->options & MHD_ALLOW_UPGRADE)) 5219 if (0 == (daemon->options & MHD_ALLOW_UPGRADE))
5224 { 5220 {
5225#ifdef HAVE_MESSAGES 5221#ifdef HAVE_MESSAGES
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index a3244188..8526ae40 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -737,7 +737,7 @@ test_header (struct MHD_Connection *connection,
737 size_t value_size, 737 size_t value_size,
738 enum MHD_ValueKind kind) 738 enum MHD_ValueKind kind)
739{ 739{
740 struct MHD_HTTP_Header *pos; 740 struct MHD_HTTP_Req_Header *pos;
741 741
742 for (pos = connection->headers_received; NULL != pos; pos = pos->next) 742 for (pos = connection->headers_received; NULL != pos; pos = pos->next)
743 { 743 {
@@ -780,7 +780,7 @@ static enum MHD_Result
780check_argument_match (struct MHD_Connection *connection, 780check_argument_match (struct MHD_Connection *connection,
781 const char *args) 781 const char *args)
782{ 782{
783 struct MHD_HTTP_Header *pos; 783 struct MHD_HTTP_Req_Header *pos;
784 char *argb; 784 char *argb;
785 unsigned int num_headers; 785 unsigned int num_headers;
786 enum MHD_Result ret; 786 enum MHD_Result ret;
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 20a406e3..e3d9a433 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -276,19 +276,19 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
276 276
277 277
278/** 278/**
279 * Header or cookie in HTTP request or response. 279 * Header or footer for HTTP response.
280 */ 280 */
281struct MHD_HTTP_Header 281struct MHD_HTTP_Res_Header
282{ 282{
283 /** 283 /**
284 * Headers are kept in a double-linked list. 284 * Headers are kept in a double-linked list.
285 */ 285 */
286 struct MHD_HTTP_Header *next; 286 struct MHD_HTTP_Res_Header *next;
287 287
288 /** 288 /**
289 * Headers are kept in a double-linked list. 289 * Headers are kept in a double-linked list.
290 */ 290 */
291 struct MHD_HTTP_Header *prev; 291 struct MHD_HTTP_Res_Header *prev;
292 292
293 /** 293 /**
294 * The name of the header (key), without the colon. 294 * The name of the header (key), without the colon.
@@ -311,8 +311,50 @@ struct MHD_HTTP_Header
311 size_t value_size; 311 size_t value_size;
312 312
313 /** 313 /**
314 * Type of the header (where in the HTTP protocol is this header 314 * Type of the value.
315 * from). 315 */
316 enum MHD_ValueKind kind;
317
318};
319
320
321/**
322 * Header, footer, or cookie for HTTP request.
323 */
324struct MHD_HTTP_Req_Header
325{
326 /**
327 * Headers are kept in a double-linked list.
328 */
329 struct MHD_HTTP_Req_Header *next;
330
331 /**
332 * Headers are kept in a double-linked list.
333 */
334 struct MHD_HTTP_Req_Header *prev;
335
336 /**
337 * The name of the header (key), without the colon.
338 */
339 const char *header;
340
341 /**
342 * The length of the @a header, not including the final zero termination.
343 */
344 size_t header_size;
345
346 /**
347 * The value of the header.
348 */
349 const char *value;
350
351 /**
352 * The length of the @a value, not including the final zero termination.
353 */
354 size_t value_size;
355
356 /**
357 * Type of the value.
316 */ 358 */
317 enum MHD_ValueKind kind; 359 enum MHD_ValueKind kind;
318 360
@@ -396,12 +438,12 @@ struct MHD_Response
396 /** 438 /**
397 * Head of double-linked list of headers to send for the response. 439 * Head of double-linked list of headers to send for the response.
398 */ 440 */
399 struct MHD_HTTP_Header *first_header; 441 struct MHD_HTTP_Res_Header *first_header;
400 442
401 /** 443 /**
402 * Tail of double-linked list of headers to send for the response. 444 * Tail of double-linked list of headers to send for the response.
403 */ 445 */
404 struct MHD_HTTP_Header *last_header; 446 struct MHD_HTTP_Res_Header *last_header;
405 447
406 /** 448 /**
407 * Buffer pointing to data that we are supposed 449 * Buffer pointing to data that we are supposed
@@ -915,12 +957,12 @@ struct MHD_Connection
915 /** 957 /**
916 * Linked list of parsed headers. 958 * Linked list of parsed headers.
917 */ 959 */
918 struct MHD_HTTP_Header *headers_received; 960 struct MHD_HTTP_Req_Header *headers_received;
919 961
920 /** 962 /**
921 * Tail of linked list of parsed headers. 963 * Tail of linked list of parsed headers.
922 */ 964 */
923 struct MHD_HTTP_Header *headers_received_tail; 965 struct MHD_HTTP_Req_Header *headers_received_tail;
924 966
925 /** 967 /**
926 * Response to transmit (initially NULL). 968 * Response to transmit (initially NULL).
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index c604e14e..8ac0c58e 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -159,7 +159,7 @@ add_response_entry (struct MHD_Response *response,
159 const char *header, 159 const char *header,
160 const char *content) 160 const char *content)
161{ 161{
162 struct MHD_HTTP_Header *hdr; 162 struct MHD_HTTP_Res_Header *hdr;
163 163
164 if ( (NULL == response) || 164 if ( (NULL == response) ||
165 (NULL == header) || 165 (NULL == header) ||
@@ -173,7 +173,7 @@ add_response_entry (struct MHD_Response *response,
173 (NULL != strchr (content, '\r')) || 173 (NULL != strchr (content, '\r')) ||
174 (NULL != strchr (content, '\n')) ) 174 (NULL != strchr (content, '\n')) )
175 return MHD_NO; 175 return MHD_NO;
176 if (NULL == (hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Header)))) 176 if (NULL == (hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Res_Header))))
177 return MHD_NO; 177 return MHD_NO;
178 if (NULL == (hdr->header = strdup (header))) 178 if (NULL == (hdr->header = strdup (header)))
179 { 179 {
@@ -218,7 +218,7 @@ add_response_header_connection (struct MHD_Response *response,
218 size_t buf_size; /**< the size of the buffer */ 218 size_t buf_size; /**< the size of the buffer */
219 ssize_t norm_len; /**< the length of the normalised value */ 219 ssize_t norm_len; /**< the length of the normalised value */
220 char *buf; /**< the temporal buffer */ 220 char *buf; /**< the temporal buffer */
221 struct MHD_HTTP_Header *hdr; /**< existing "Connection" header */ 221 struct MHD_HTTP_Res_Header *hdr; /**< existing "Connection" header */
222 bool value_has_close; /**< the @a value has "close" token */ 222 bool value_has_close; /**< the @a value has "close" token */
223 bool already_has_close; /**< existing "Connection" header has "close" token */ 223 bool already_has_close; /**< existing "Connection" header has "close" token */
224 size_t pos = 0; /**< position of addition in the @a buf */ 224 size_t pos = 0; /**< position of addition in the @a buf */
@@ -340,9 +340,9 @@ add_response_header_connection (struct MHD_Response *response,
340 340
341 if (NULL == hdr) 341 if (NULL == hdr)
342 { 342 {
343 struct MHD_HTTP_Header *new_hdr; /**< new "Connection" header */ 343 struct MHD_HTTP_Res_Header *new_hdr; /**< new "Connection" header */
344 /* Create new response header entry */ 344 /* Create new response header entry */
345 new_hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Header)); 345 new_hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Res_Header));
346 if (NULL != new_hdr) 346 if (NULL != new_hdr)
347 { 347 {
348 new_hdr->header = malloc (key_len + 1); 348 new_hdr->header = malloc (key_len + 1);
@@ -390,7 +390,7 @@ static enum MHD_Result
390del_response_header_connection (struct MHD_Response *response, 390del_response_header_connection (struct MHD_Response *response,
391 const char *value) 391 const char *value)
392{ 392{
393 struct MHD_HTTP_Header *hdr; /**< existing "Connection" header */ 393 struct MHD_HTTP_Res_Header *hdr; /**< existing "Connection" header */
394 394
395 hdr = MHD_get_response_element_n_ (response, MHD_HEADER_KIND, 395 hdr = MHD_get_response_element_n_ (response, MHD_HEADER_KIND,
396 MHD_HTTP_HEADER_CONNECTION, 396 MHD_HTTP_HEADER_CONNECTION,
@@ -522,7 +522,7 @@ MHD_add_response_header (struct MHD_Response *response,
522 { 522 {
523 if (0 != (response->flags_auto & MHD_RAF_HAS_DATE_HDR)) 523 if (0 != (response->flags_auto & MHD_RAF_HAS_DATE_HDR))
524 { 524 {
525 struct MHD_HTTP_Header *hdr; 525 struct MHD_HTTP_Res_Header *hdr;
526 hdr = MHD_get_response_element_n_ (response, MHD_HEADER_KIND, 526 hdr = MHD_get_response_element_n_ (response, MHD_HEADER_KIND,
527 MHD_HTTP_HEADER_DATE, 527 MHD_HTTP_HEADER_DATE,
528 MHD_STATICSTR_LEN_ ( \ 528 MHD_STATICSTR_LEN_ ( \
@@ -615,7 +615,7 @@ MHD_del_response_header (struct MHD_Response *response,
615 const char *header, 615 const char *header,
616 const char *content) 616 const char *content)
617{ 617{
618 struct MHD_HTTP_Header *pos; 618 struct MHD_HTTP_Res_Header *pos;
619 size_t header_len; 619 size_t header_len;
620 size_t content_len; 620 size_t content_len;
621 621
@@ -698,7 +698,7 @@ MHD_get_response_headers (struct MHD_Response *response,
698 void *iterator_cls) 698 void *iterator_cls)
699{ 699{
700 int numHeaders = 0; 700 int numHeaders = 0;
701 struct MHD_HTTP_Header *pos; 701 struct MHD_HTTP_Res_Header *pos;
702 702
703 for (pos = response->first_header; 703 for (pos = response->first_header;
704 NULL != pos; 704 NULL != pos;
@@ -728,7 +728,7 @@ const char *
728MHD_get_response_header (struct MHD_Response *response, 728MHD_get_response_header (struct MHD_Response *response,
729 const char *key) 729 const char *key)
730{ 730{
731 struct MHD_HTTP_Header *pos; 731 struct MHD_HTTP_Res_Header *pos;
732 size_t key_size; 732 size_t key_size;
733 733
734 if (NULL == key) 734 if (NULL == key)
@@ -758,13 +758,13 @@ MHD_get_response_header (struct MHD_Response *response,
758 * @return NULL if header element does not exist 758 * @return NULL if header element does not exist
759 * @ingroup response 759 * @ingroup response
760 */ 760 */
761struct MHD_HTTP_Header * 761struct MHD_HTTP_Res_Header *
762MHD_get_response_element_n_ (struct MHD_Response *response, 762MHD_get_response_element_n_ (struct MHD_Response *response,
763 enum MHD_ValueKind kind, 763 enum MHD_ValueKind kind,
764 const char *key, 764 const char *key,
765 size_t key_len) 765 size_t key_len)
766{ 766{
767 struct MHD_HTTP_Header *pos; 767 struct MHD_HTTP_Res_Header *pos;
768 768
769 mhd_assert (NULL != key); 769 mhd_assert (NULL != key);
770 mhd_assert (0 != key[0]); 770 mhd_assert (0 != key[0]);
@@ -806,7 +806,7 @@ MHD_check_response_header_token_ci (const struct MHD_Response *response,
806 const char *token, 806 const char *token,
807 size_t token_len) 807 size_t token_len)
808{ 808{
809 struct MHD_HTTP_Header *pos; 809 struct MHD_HTTP_Res_Header *pos;
810 810
811 if ( (NULL == key) || 811 if ( (NULL == key) ||
812 ('\0' == key[0]) || 812 ('\0' == key[0]) ||
@@ -2041,7 +2041,7 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
2041void 2041void
2042MHD_destroy_response (struct MHD_Response *response) 2042MHD_destroy_response (struct MHD_Response *response)
2043{ 2043{
2044 struct MHD_HTTP_Header *pos; 2044 struct MHD_HTTP_Res_Header *pos;
2045 2045
2046 if (NULL == response) 2046 if (NULL == response)
2047 return; 2047 return;
diff --git a/src/microhttpd/response.h b/src/microhttpd/response.h
index bc650f66..4d1e84b5 100644
--- a/src/microhttpd/response.h
+++ b/src/microhttpd/response.h
@@ -67,7 +67,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
67 * @return NULL if header element does not exist 67 * @return NULL if header element does not exist
68 * @ingroup response 68 * @ingroup response
69 */ 69 */
70struct MHD_HTTP_Header * 70struct MHD_HTTP_Res_Header *
71MHD_get_response_element_n_ (struct MHD_Response *response, 71MHD_get_response_element_n_ (struct MHD_Response *response,
72 enum MHD_ValueKind kind, 72 enum MHD_ValueKind kind,
73 const char *key, 73 const char *key,
diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c
index 44e79c7e..c4744ec3 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -222,13 +222,13 @@ test_urlencoding_case (unsigned int want_start,
222 for (step = 1; size >= step; ++step) 222 for (step = 1; size >= step; ++step)
223 { 223 {
224 struct MHD_Connection connection; 224 struct MHD_Connection connection;
225 struct MHD_HTTP_Header header; 225 struct MHD_HTTP_Req_Header header;
226 struct MHD_PostProcessor *pp; 226 struct MHD_PostProcessor *pp;
227 unsigned int want_off = want_start; 227 unsigned int want_off = want_start;
228 size_t i; 228 size_t i;
229 229
230 memset (&connection, 0, sizeof (struct MHD_Connection)); 230 memset (&connection, 0, sizeof (struct MHD_Connection));
231 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 231 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
232 connection.headers_received = &header; 232 connection.headers_received = &header;
233 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 233 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
234 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; 234 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;
@@ -361,7 +361,7 @@ static int
361test_multipart_garbage (void) 361test_multipart_garbage (void)
362{ 362{
363 struct MHD_Connection connection; 363 struct MHD_Connection connection;
364 struct MHD_HTTP_Header header; 364 struct MHD_HTTP_Req_Header header;
365 struct MHD_PostProcessor *pp; 365 struct MHD_PostProcessor *pp;
366 unsigned int want_off; 366 unsigned int want_off;
367 size_t size = MHD_STATICSTR_LEN_ (FORM_DATA); 367 size_t size = MHD_STATICSTR_LEN_ (FORM_DATA);
@@ -378,7 +378,7 @@ test_multipart_garbage (void)
378 { 378 {
379 want_off = FORM_START; 379 want_off = FORM_START;
380 memset (&connection, 0, sizeof (struct MHD_Connection)); 380 memset (&connection, 0, sizeof (struct MHD_Connection));
381 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 381 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
382 connection.headers_received = &header; 382 connection.headers_received = &header;
383 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 383 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
384 header.value = 384 header.value =
@@ -429,7 +429,7 @@ static int
429test_multipart_splits (void) 429test_multipart_splits (void)
430{ 430{
431 struct MHD_Connection connection; 431 struct MHD_Connection connection;
432 struct MHD_HTTP_Header header; 432 struct MHD_HTTP_Req_Header header;
433 struct MHD_PostProcessor *pp; 433 struct MHD_PostProcessor *pp;
434 unsigned int want_off; 434 unsigned int want_off;
435 size_t size; 435 size_t size;
@@ -440,7 +440,7 @@ test_multipart_splits (void)
440 { 440 {
441 want_off = FORM_START; 441 want_off = FORM_START;
442 memset (&connection, 0, sizeof (struct MHD_Connection)); 442 memset (&connection, 0, sizeof (struct MHD_Connection));
443 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 443 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
444 connection.headers_received = &header; 444 connection.headers_received = &header;
445 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 445 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
446 header.value = 446 header.value =
@@ -491,7 +491,7 @@ static int
491test_multipart (void) 491test_multipart (void)
492{ 492{
493 struct MHD_Connection connection; 493 struct MHD_Connection connection;
494 struct MHD_HTTP_Header header; 494 struct MHD_HTTP_Req_Header header;
495 struct MHD_PostProcessor *pp; 495 struct MHD_PostProcessor *pp;
496 unsigned int want_off = FORM_START; 496 unsigned int want_off = FORM_START;
497 size_t i; 497 size_t i;
@@ -499,7 +499,7 @@ test_multipart (void)
499 size_t size; 499 size_t size;
500 500
501 memset (&connection, 0, sizeof (struct MHD_Connection)); 501 memset (&connection, 0, sizeof (struct MHD_Connection));
502 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 502 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
503 connection.headers_received = &header; 503 connection.headers_received = &header;
504 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 504 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
505 header.value = 505 header.value =
@@ -548,7 +548,7 @@ static int
548test_nested_multipart (void) 548test_nested_multipart (void)
549{ 549{
550 struct MHD_Connection connection; 550 struct MHD_Connection connection;
551 struct MHD_HTTP_Header header; 551 struct MHD_HTTP_Res_Header header;
552 struct MHD_PostProcessor *pp; 552 struct MHD_PostProcessor *pp;
553 unsigned int want_off = FORM_NESTED_START; 553 unsigned int want_off = FORM_NESTED_START;
554 size_t i; 554 size_t i;
@@ -556,7 +556,7 @@ test_nested_multipart (void)
556 size_t size; 556 size_t size;
557 557
558 memset (&connection, 0, sizeof (struct MHD_Connection)); 558 memset (&connection, 0, sizeof (struct MHD_Connection));
559 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 559 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
560 connection.headers_received = &header; 560 connection.headers_received = &header;
561 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 561 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
562 header.value = 562 header.value =
@@ -623,7 +623,7 @@ static int
623test_overflow () 623test_overflow ()
624{ 624{
625 struct MHD_Connection connection; 625 struct MHD_Connection connection;
626 struct MHD_HTTP_Header header; 626 struct MHD_HTTP_Req_Header header;
627 struct MHD_PostProcessor *pp; 627 struct MHD_PostProcessor *pp;
628 size_t i; 628 size_t i;
629 size_t j; 629 size_t j;
@@ -631,7 +631,7 @@ test_overflow ()
631 char *buf; 631 char *buf;
632 632
633 memset (&connection, 0, sizeof (struct MHD_Connection)); 633 memset (&connection, 0, sizeof (struct MHD_Connection));
634 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 634 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
635 connection.headers_received = &header; 635 connection.headers_received = &header;
636 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 636 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
637 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; 637 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;
@@ -686,10 +686,10 @@ test_empty_key (void)
686 { 686 {
687 size_t i; 687 size_t i;
688 struct MHD_Connection connection; 688 struct MHD_Connection connection;
689 struct MHD_HTTP_Header header; 689 struct MHD_HTTP_Req_Header header;
690 struct MHD_PostProcessor *pp; 690 struct MHD_PostProcessor *pp;
691 memset (&connection, 0, sizeof (struct MHD_Connection)); 691 memset (&connection, 0, sizeof (struct MHD_Connection));
692 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 692 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
693 693
694 connection.headers_received = &header; 694 connection.headers_received = &header;
695 connection.headers_received_tail = &header; 695 connection.headers_received_tail = &header;
@@ -738,12 +738,12 @@ test_double_value (void)
738 { 738 {
739 size_t i; 739 size_t i;
740 struct MHD_Connection connection; 740 struct MHD_Connection connection;
741 struct MHD_HTTP_Header header; 741 struct MHD_HTTP_Req_Header header;
742 struct MHD_PostProcessor *pp; 742 struct MHD_PostProcessor *pp;
743 unsigned int results_off = URL_START; 743 unsigned int results_off = URL_START;
744 unsigned int results_final = results_off + 1; /* First value is correct */ 744 unsigned int results_final = results_off + 1; /* First value is correct */
745 memset (&connection, 0, sizeof (struct MHD_Connection)); 745 memset (&connection, 0, sizeof (struct MHD_Connection));
746 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 746 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
747 747
748 connection.headers_received = &header; 748 connection.headers_received = &header;
749 connection.headers_received_tail = &header; 749 connection.headers_received_tail = &header;
diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c
index 6710bca8..610a3da3 100644
--- a/src/microhttpd/test_postprocessor_amp.c
+++ b/src/microhttpd/test_postprocessor_amp.c
@@ -29,7 +29,7 @@ int
29main (int argc, char *const *argv) 29main (int argc, char *const *argv)
30{ 30{
31 struct MHD_Connection connection; 31 struct MHD_Connection connection;
32 struct MHD_HTTP_Header header; 32 struct MHD_HTTP_Req_Header header;
33 struct MHD_PostProcessor *pp; 33 struct MHD_PostProcessor *pp;
34 const char *post = 34 const char *post =
35 "a=xx+xx+xxx+xxxxx+xxxx+xxxxxxxx+xxx+xxxxxx+xxx+xxx+xxxxxxx+xxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xxxxx%3D%22xxxxx%22%3E%0A+++++++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx%22%3E%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxxxx%3A%3C%2Fx%3E%0A%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxx%3A%3C%2Fx%3E%0A%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%3B+xxxx-xxxxxx%3A+xxxx%3B%22%3Exxxxx+xxxxx%3A%3C%2Fx%3E%0A+++++++++++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++++++%3C%2Fxxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A++++++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3Bxxxx-xxxxxx%3A+xxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxxx.xx%3C%2Fxxxx%3E%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++%3C%2Fxxxxx%3E%0A+++++++%3C%21--%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++xxx+xx+xxxxx+xxxxxxx+xxxxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A+++%3C%2Fxxx%3E%0A%0A%0A%0A+++%3Cxxx+xxxxx%3D%22xxxxxxxxx%22+xx%3D%22xxxxxxxxx%22%3E%3C%2Fxxx%3E%0A%0A+++%3Cxxx+xx%3D%22xxxx%22+xxxxx%3D%22xxxx%22%3E%0A+++++++%3Cxxxxx+xxxxx%3D%22xxxxxxxxx%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xx%3D%22xxxxxxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxxxxxx%22%3E%3C%2Fxx%3E%0A+++++++++++++++%3Cxx+xx%3D%22xxxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++%3C%2Fxxxxx%3E%0A+++%3C%2Fxxx%3E%0A%3C%2Fxxx%3E%0A%0A%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A%0A%3C%2Fxxxx%3E%0A%3C%2Fxxxx%3E+&b=value"; 35 "a=xx+xx+xxx+xxxxx+xxxx+xxxxxxxx+xxx+xxxxxx+xxx+xxx+xxxxxxx+xxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xxxxx%3D%22xxxxx%22%3E%0A+++++++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx%22%3E%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxxxx%3A%3C%2Fx%3E%0A%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxx%3A%3C%2Fx%3E%0A%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%3B+xxxx-xxxxxx%3A+xxxx%3B%22%3Exxxxx+xxxxx%3A%3C%2Fx%3E%0A+++++++++++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++++++%3C%2Fxxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A++++++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3Bxxxx-xxxxxx%3A+xxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxxx.xx%3C%2Fxxxx%3E%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++%3C%2Fxxxxx%3E%0A+++++++%3C%21--%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++xxx+xx+xxxxx+xxxxxxx+xxxxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A+++%3C%2Fxxx%3E%0A%0A%0A%0A+++%3Cxxx+xxxxx%3D%22xxxxxxxxx%22+xx%3D%22xxxxxxxxx%22%3E%3C%2Fxxx%3E%0A%0A+++%3Cxxx+xx%3D%22xxxx%22+xxxxx%3D%22xxxx%22%3E%0A+++++++%3Cxxxxx+xxxxx%3D%22xxxxxxxxx%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xx%3D%22xxxxxxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxxxxxx%22%3E%3C%2Fxx%3E%0A+++++++++++++++%3Cxx+xx%3D%22xxxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++%3C%2Fxxxxx%3E%0A+++%3C%2Fxxx%3E%0A%3C%2Fxxx%3E%0A%0A%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A%0A%3C%2Fxxxx%3E%0A%3C%2Fxxxx%3E+&b=value";
@@ -37,7 +37,7 @@ main (int argc, char *const *argv)
37 37
38 num_errors = 0; 38 num_errors = 0;
39 memset (&connection, 0, sizeof (struct MHD_Connection)); 39 memset (&connection, 0, sizeof (struct MHD_Connection));
40 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 40 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
41 connection.headers_received = &header; 41 connection.headers_received = &header;
42 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 42 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
43 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; 43 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;
diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c
index 4d5f1ece..7fcc5d5a 100644
--- a/src/microhttpd/test_postprocessor_large.c
+++ b/src/microhttpd/test_postprocessor_large.c
@@ -63,7 +63,7 @@ static int
63test_simple_large () 63test_simple_large ()
64{ 64{
65 struct MHD_Connection connection; 65 struct MHD_Connection connection;
66 struct MHD_HTTP_Header header; 66 struct MHD_HTTP_Req_Header header;
67 struct MHD_PostProcessor *pp; 67 struct MHD_PostProcessor *pp;
68 size_t i; 68 size_t i;
69 size_t delta; 69 size_t delta;
@@ -76,7 +76,7 @@ test_simple_large ()
76 memcpy (data, "key=", 4); 76 memcpy (data, "key=", 4);
77 data[sizeof (data) - 1] = '\0'; 77 data[sizeof (data) - 1] = '\0';
78 memset (&connection, 0, sizeof (struct MHD_Connection)); 78 memset (&connection, 0, sizeof (struct MHD_Connection));
79 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 79 memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header));
80 connection.headers_received = &header; 80 connection.headers_received = &header;
81 header.header = MHD_HTTP_HEADER_CONTENT_TYPE; 81 header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
82 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; 82 header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;