libmicrohttpd

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

commit 3ebb98295631a662bdb66b9148f4f43000dc3671
parent e76fc7f8aaf4907aa6ca0200e9682830f94a9ac2
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sat, 16 Apr 2022 14:20:24 +0300

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:
Msrc/microhttpd/connection.c | 28++++++++++++----------------
Msrc/microhttpd/digestauth.c | 4++--
Msrc/microhttpd/internal.h | 62++++++++++++++++++++++++++++++++++++++++++++++++++++----------
Msrc/microhttpd/response.c | 28++++++++++++++--------------
Msrc/microhttpd/response.h | 2+-
Msrc/microhttpd/test_postprocessor.c | 32++++++++++++++++----------------
Msrc/microhttpd/test_postprocessor_amp.c | 4++--
Msrc/microhttpd/test_postprocessor_large.c | 4++--
8 files changed, 101 insertions(+), 63 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -387,7 +387,7 @@ MHD_get_connection_values (struct MHD_Connection *connection, void *iterator_cls) { int ret; - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Req_Header *pos; if (NULL == connection) return -1; @@ -426,7 +426,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection, void *iterator_cls) { int ret; - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Req_Header *pos; if (NULL == connection) return -1; @@ -480,10 +480,10 @@ MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection, const char *value, size_t value_size) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Req_Header *pos; pos = connection_alloc_memory (connection, - sizeof (struct MHD_HTTP_Header)); + sizeof (struct MHD_HTTP_Res_Header)); if (NULL == pos) return MHD_NO; pos->header = (char *) key; @@ -653,7 +653,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection, const char **value_ptr, size_t *value_size_ptr) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Req_Header *pos; if (NULL == connection) return MHD_NO; @@ -716,14 +716,10 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection, const char *token, size_t token_len) { - struct MHD_HTTP_Header *pos; - - if ((NULL == connection) || (NULL == header) || (0 == header[0]) || (NULL == - token) || - (0 == - token - [ - 0]) ) + struct MHD_HTTP_Req_Header *pos; + + if ((NULL == connection) || (NULL == header) || (0 == header[0]) || + (NULL == token) || (0 == token[0])) return false; for (pos = connection->headers_received; NULL != pos; pos = pos->next) @@ -1934,7 +1930,7 @@ add_user_headers (char *buf, bool add_keep_alive) { struct MHD_Response *const r = response; /**< a short alias */ - struct MHD_HTTP_Header *hdr; /**< Iterates through User-specified headers */ + struct MHD_HTTP_Res_Header *hdr; /**< Iterates through User-specified headers */ size_t el_size; /**< the size of current element to be added to the @a buf */ mhd_assert (! add_close || ! add_keep_alive); @@ -2276,7 +2272,7 @@ build_connection_chunked_response_footer (struct MHD_Connection *connection) size_t buf_size; /**< the size of the @a buf */ size_t used_size; /**< the used size of the @a buf */ struct MHD_Connection *const c = connection; /**< a short alias */ - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Res_Header *pos; mhd_assert (connection->rp_props.chunked); /* TODO: allow combining of the final footer with the last chunk, @@ -5219,7 +5215,7 @@ MHD_queue_response (struct MHD_Connection *connection, #ifdef UPGRADE_SUPPORT if (NULL != response->upgrade_handler) { - struct MHD_HTTP_Header *conn_header; + struct MHD_HTTP_Res_Header *conn_header; if (0 == (daemon->options & MHD_ALLOW_UPGRADE)) { #ifdef HAVE_MESSAGES diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c @@ -737,7 +737,7 @@ test_header (struct MHD_Connection *connection, size_t value_size, enum MHD_ValueKind kind) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Req_Header *pos; for (pos = connection->headers_received; NULL != pos; pos = pos->next) { @@ -780,7 +780,7 @@ static enum MHD_Result check_argument_match (struct MHD_Connection *connection, const char *args) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Req_Header *pos; char *argb; unsigned int num_headers; enum MHD_Result ret; diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h @@ -276,19 +276,19 @@ MHD_DLOG (const struct MHD_Daemon *daemon, /** - * Header or cookie in HTTP request or response. + * Header or footer for HTTP response. */ -struct MHD_HTTP_Header +struct MHD_HTTP_Res_Header { /** * Headers are kept in a double-linked list. */ - struct MHD_HTTP_Header *next; + struct MHD_HTTP_Res_Header *next; /** * Headers are kept in a double-linked list. */ - struct MHD_HTTP_Header *prev; + struct MHD_HTTP_Res_Header *prev; /** * The name of the header (key), without the colon. @@ -311,8 +311,50 @@ struct MHD_HTTP_Header size_t value_size; /** - * Type of the header (where in the HTTP protocol is this header - * from). + * Type of the value. + */ + enum MHD_ValueKind kind; + +}; + + +/** + * Header, footer, or cookie for HTTP request. + */ +struct MHD_HTTP_Req_Header +{ + /** + * Headers are kept in a double-linked list. + */ + struct MHD_HTTP_Req_Header *next; + + /** + * Headers are kept in a double-linked list. + */ + struct MHD_HTTP_Req_Header *prev; + + /** + * The name of the header (key), without the colon. + */ + const char *header; + + /** + * The length of the @a header, not including the final zero termination. + */ + size_t header_size; + + /** + * The value of the header. + */ + const char *value; + + /** + * The length of the @a value, not including the final zero termination. + */ + size_t value_size; + + /** + * Type of the value. */ enum MHD_ValueKind kind; @@ -396,12 +438,12 @@ struct MHD_Response /** * Head of double-linked list of headers to send for the response. */ - struct MHD_HTTP_Header *first_header; + struct MHD_HTTP_Res_Header *first_header; /** * Tail of double-linked list of headers to send for the response. */ - struct MHD_HTTP_Header *last_header; + struct MHD_HTTP_Res_Header *last_header; /** * Buffer pointing to data that we are supposed @@ -915,12 +957,12 @@ struct MHD_Connection /** * Linked list of parsed headers. */ - struct MHD_HTTP_Header *headers_received; + struct MHD_HTTP_Req_Header *headers_received; /** * Tail of linked list of parsed headers. */ - struct MHD_HTTP_Header *headers_received_tail; + struct MHD_HTTP_Req_Header *headers_received_tail; /** * Response to transmit (initially NULL). diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c @@ -159,7 +159,7 @@ add_response_entry (struct MHD_Response *response, const char *header, const char *content) { - struct MHD_HTTP_Header *hdr; + struct MHD_HTTP_Res_Header *hdr; if ( (NULL == response) || (NULL == header) || @@ -173,7 +173,7 @@ add_response_entry (struct MHD_Response *response, (NULL != strchr (content, '\r')) || (NULL != strchr (content, '\n')) ) return MHD_NO; - if (NULL == (hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Header)))) + if (NULL == (hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Res_Header)))) return MHD_NO; if (NULL == (hdr->header = strdup (header))) { @@ -218,7 +218,7 @@ add_response_header_connection (struct MHD_Response *response, size_t buf_size; /**< the size of the buffer */ ssize_t norm_len; /**< the length of the normalised value */ char *buf; /**< the temporal buffer */ - struct MHD_HTTP_Header *hdr; /**< existing "Connection" header */ + struct MHD_HTTP_Res_Header *hdr; /**< existing "Connection" header */ bool value_has_close; /**< the @a value has "close" token */ bool already_has_close; /**< existing "Connection" header has "close" token */ size_t pos = 0; /**< position of addition in the @a buf */ @@ -340,9 +340,9 @@ add_response_header_connection (struct MHD_Response *response, if (NULL == hdr) { - struct MHD_HTTP_Header *new_hdr; /**< new "Connection" header */ + struct MHD_HTTP_Res_Header *new_hdr; /**< new "Connection" header */ /* Create new response header entry */ - new_hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Header)); + new_hdr = MHD_calloc_ (1, sizeof (struct MHD_HTTP_Res_Header)); if (NULL != new_hdr) { new_hdr->header = malloc (key_len + 1); @@ -390,7 +390,7 @@ static enum MHD_Result del_response_header_connection (struct MHD_Response *response, const char *value) { - struct MHD_HTTP_Header *hdr; /**< existing "Connection" header */ + struct MHD_HTTP_Res_Header *hdr; /**< existing "Connection" header */ hdr = MHD_get_response_element_n_ (response, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONNECTION, @@ -522,7 +522,7 @@ MHD_add_response_header (struct MHD_Response *response, { if (0 != (response->flags_auto & MHD_RAF_HAS_DATE_HDR)) { - struct MHD_HTTP_Header *hdr; + struct MHD_HTTP_Res_Header *hdr; hdr = MHD_get_response_element_n_ (response, MHD_HEADER_KIND, MHD_HTTP_HEADER_DATE, MHD_STATICSTR_LEN_ ( \ @@ -615,7 +615,7 @@ MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Res_Header *pos; size_t header_len; size_t content_len; @@ -698,7 +698,7 @@ MHD_get_response_headers (struct MHD_Response *response, void *iterator_cls) { int numHeaders = 0; - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Res_Header *pos; for (pos = response->first_header; NULL != pos; @@ -728,7 +728,7 @@ const char * MHD_get_response_header (struct MHD_Response *response, const char *key) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Res_Header *pos; size_t key_size; if (NULL == key) @@ -758,13 +758,13 @@ MHD_get_response_header (struct MHD_Response *response, * @return NULL if header element does not exist * @ingroup response */ -struct MHD_HTTP_Header * +struct MHD_HTTP_Res_Header * MHD_get_response_element_n_ (struct MHD_Response *response, enum MHD_ValueKind kind, const char *key, size_t key_len) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Res_Header *pos; mhd_assert (NULL != key); mhd_assert (0 != key[0]); @@ -806,7 +806,7 @@ MHD_check_response_header_token_ci (const struct MHD_Response *response, const char *token, size_t token_len) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Res_Header *pos; if ( (NULL == key) || ('\0' == key[0]) || @@ -2041,7 +2041,7 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void MHD_destroy_response (struct MHD_Response *response) { - struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Res_Header *pos; if (NULL == response) return; diff --git a/src/microhttpd/response.h b/src/microhttpd/response.h @@ -67,7 +67,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response, * @return NULL if header element does not exist * @ingroup response */ -struct MHD_HTTP_Header * +struct MHD_HTTP_Res_Header * MHD_get_response_element_n_ (struct MHD_Response *response, enum MHD_ValueKind kind, const char *key, diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c @@ -222,13 +222,13 @@ test_urlencoding_case (unsigned int want_start, for (step = 1; size >= step; ++step) { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; unsigned int want_off = want_start; size_t i; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; @@ -361,7 +361,7 @@ static int test_multipart_garbage (void) { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; unsigned int want_off; size_t size = MHD_STATICSTR_LEN_ (FORM_DATA); @@ -378,7 +378,7 @@ test_multipart_garbage (void) { want_off = FORM_START; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = @@ -429,7 +429,7 @@ static int test_multipart_splits (void) { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; unsigned int want_off; size_t size; @@ -440,7 +440,7 @@ test_multipart_splits (void) { want_off = FORM_START; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = @@ -491,7 +491,7 @@ static int test_multipart (void) { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; unsigned int want_off = FORM_START; size_t i; @@ -499,7 +499,7 @@ test_multipart (void) size_t size; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = @@ -548,7 +548,7 @@ static int test_nested_multipart (void) { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Res_Header header; struct MHD_PostProcessor *pp; unsigned int want_off = FORM_NESTED_START; size_t i; @@ -556,7 +556,7 @@ test_nested_multipart (void) size_t size; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = @@ -623,7 +623,7 @@ static int test_overflow () { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; size_t i; size_t j; @@ -631,7 +631,7 @@ test_overflow () char *buf; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; @@ -686,10 +686,10 @@ test_empty_key (void) { size_t i; struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; connection.headers_received_tail = &header; @@ -738,12 +738,12 @@ test_double_value (void) { size_t i; struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; unsigned int results_off = URL_START; unsigned int results_final = results_off + 1; /* First value is correct */ memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; connection.headers_received_tail = &header; diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c @@ -29,7 +29,7 @@ int main (int argc, char *const *argv) { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; const char *post = "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) num_errors = 0; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c @@ -63,7 +63,7 @@ static int test_simple_large () { struct MHD_Connection connection; - struct MHD_HTTP_Header header; + struct MHD_HTTP_Req_Header header; struct MHD_PostProcessor *pp; size_t i; size_t delta; @@ -76,7 +76,7 @@ test_simple_large () memcpy (data, "key=", 4); data[sizeof (data) - 1] = '\0'; memset (&connection, 0, sizeof (struct MHD_Connection)); - memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + memset (&header, 0, sizeof (struct MHD_HTTP_Res_Header)); connection.headers_received = &header; header.header = MHD_HTTP_HEADER_CONTENT_TYPE; header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;