35#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
41#ifdef MHD_LINUX_SOLARIS_SENDFILE
42#include <sys/sendfile.h>
44#if defined(HAVE_FREEBSD_SENDFILE) || defined(HAVE_DARWIN_SENDFILE)
46#include <sys/socket.h>
52#ifdef HAVE_SYS_PARAM_H
65#define MHD_ALLOW_BARE_LF_AS_CRLF_(discp_lvl) (0 >= discp_lvl)
75#define MHD_CHUNK_HEADER_REASONABLE_LEN 24
80#define HTTP_100_CONTINUE "HTTP/1.1 100 Continue\r\n\r\n"
87#define ERR_MSG_REQUEST_TOO_BIG \
89 "<head><title>Request too big</title></head>" \
90 "<body>Request HTTP header is too big for the memory constraints " \
91 "of this webserver.</body>" \
94#define ERR_MSG_REQUEST_TOO_BIG ""
101#define ERR_MSG_REQUEST_HEADER_TOO_BIG \
103 "<head><title>Request too big</title></head>" \
104 "<body><p>The total size of the request headers, which includes the " \
105 "request target and the request field lines, exceeds the memory " \
106 "constraints of this web server.</p>" \
107 "<p>The request could be re-tried with shorter field lines, a shorter " \
108 "request target or a shorter request method token.</p></body>" \
111#define ERR_MSG_REQUEST_HEADER_TOO_BIG ""
118#define ERR_MSG_REQUEST_HEADER_WITH_COOKIES_TOO_BIG \
120 "<head><title>Request too big</title></head>" \
121 "<body><p>The total size of the request headers, which includes the " \
122 "request target and the request field lines, exceeds the memory " \
123 "constraints of this web server.</p> " \
124 "<p>The request could be re-tried with smaller " \
125 "<b>"Cookie:"</b> field value, shorter other field lines, " \
126 "a shorter request target or a shorter request method token.</p></body> " \
129#define ERR_MSG_REQUEST_HEADER_WITH_COOKIES_TOO_BIG ""
137#define ERR_MSG_REQUEST_CHUNK_LINE_EXT_TOO_BIG \
139 "<head><title>Request too big</title></head>" \
140 "<body><p>The total size of the request target, the request field lines " \
141 "and the chunk size line exceeds the memory constraints of this web " \
143 "<p>The request could be re-tried without chunk extensions, with a smaller " \
144 "chunk size, shorter field lines, a shorter request target or a shorter " \
145 "request method token.</p></body>" \
148#define ERR_MSG_REQUEST_CHUNK_LINE_EXT_TOO_BIG ""
156#define ERR_MSG_REQUEST_CHUNK_LINE_TOO_BIG \
158 "<head><title>Request too big</title></head>" \
159 "<body><p>The total size of the request target, the request field lines " \
160 "and the chunk size line exceeds the memory constraints of this web " \
162 "<p>The request could be re-tried with a smaller " \
163 "chunk size, shorter field lines, a shorter request target or a shorter " \
164 "request method token.</p></body>" \
167#define ERR_MSG_REQUEST_CHUNK_LINE_TOO_BIG ""
174#define ERR_MSG_REQUEST_FOOTER_TOO_BIG \
176 "<head><title>Request too big</title></head>" \
177 "<body><p>The total size of the request headers, which includes the " \
178 "request target, the request field lines and the chunked trailer " \
179 "section exceeds the memory constraints of this web server.</p>" \
180 "<p>The request could be re-tried with a shorter chunked trailer " \
181 "section, shorter field lines, a shorter request target or " \
182 "a shorter request method token.</p></body>" \
185#define ERR_MSG_REQUEST_FOOTER_TOO_BIG ""
192#define RQ_LINE_TOO_MANY_WSP \
194 "<head><title>Request broken</title></head>" \
195 "<body>The request line has more then two whitespaces.</body>" \
198#define RQ_LINE_TOO_MANY_WSP ""
206#define BARE_CR_IN_HEADER \
208 "<head><title>Request broken</title></head>" \
209 "<body>Request HTTP header has bare CR character without " \
210 "following LF character.</body>" \
213#define BARE_CR_IN_HEADER ""
221#define BARE_CR_IN_FOOTER \
223 "<head><title>Request broken</title></head>" \
224 "<body>Request HTTP footer has bare CR character without " \
225 "following LF character.</body>" \
228#define BARE_CR_IN_FOOTER ""
236#define BARE_LF_IN_HEADER \
238 "<head><title>Request broken</title></head>" \
239 "<body>Request HTTP header has bare LF character without " \
240 "preceding CR character.</body>" \
243#define BARE_LF_IN_HEADER ""
251#define BARE_LF_IN_FOOTER \
253 "<head><title>Request broken</title></head>" \
254 "<body>Request HTTP footer has bare LF character without " \
255 "preceding CR character.</body>" \
258#define BARE_LF_IN_FOOTER ""
265#define RQ_TARGET_INVALID_CHAR \
267 "<head><title>Request broken</title></head>" \
268 "<body>HTTP request has invalid characters in " \
269 "the request-target.</body>" \
272#define RQ_TARGET_INVALID_CHAR ""
279#define ERR_RSP_OBS_FOLD \
281 "<head><title>Request broken</title></head>" \
282 "<body>Obsolete line folding is used in HTTP request header.</body>" \
285#define ERR_RSP_OBS_FOLD ""
292#define ERR_RSP_OBS_FOLD_FOOTER \
294 "<head><title>Request broken</title></head>" \
295 "<body>Obsolete line folding is used in HTTP request footer.</body>" \
298#define ERR_RSP_OBS_FOLD_FOOTER ""
306#define ERR_RSP_WSP_BEFORE_HEADER \
308 "<head><title>Request broken</title></head>" \
309 "<body>HTTP request has whitespace between the request line and " \
310 "the first header.</body>" \
313#define ERR_RSP_WSP_BEFORE_HEADER ""
321#define ERR_RSP_WSP_BEFORE_FOOTER \
323 "<head><title>Request broken</title></head>" \
324 "<body>First HTTP footer line has whitespace at the first " \
328#define ERR_RSP_WSP_BEFORE_FOOTER ""
336#define ERR_RSP_WSP_IN_HEADER_NAME \
338 "<head><title>Request broken</title></head>" \
339 "<body>HTTP request has whitespace before the first colon " \
340 "in header line.</body>" \
343#define ERR_RSP_WSP_IN_HEADER_NAME ""
351#define ERR_RSP_WSP_IN_FOOTER_NAME \
353 "<head><title>Request broken</title></head>" \
354 "<body>HTTP request has whitespace before the first colon " \
355 "in footer line.</body>" \
358#define ERR_RSP_WSP_IN_FOOTER_NAME ""
365#define ERR_RSP_INVALID_CHR_IN_HEADER \
367 "<head><title>Request broken</title></head>" \
368 "<body>HTTP request has invalid character in header.</body>" \
371#define ERR_RSP_INVALID_CHR_IN_HEADER ""
378#define ERR_RSP_INVALID_CHR_IN_FOOTER \
380 "<head><title>Request broken</title></head>" \
381 "<body>HTTP request has invalid character in footer.</body>" \
384#define ERR_RSP_INVALID_CHR_IN_HEADER ""
391#define ERR_RSP_HEADER_WITHOUT_COLON \
393 "<head><title>Request broken</title></head>" \
394 "<body>HTTP request header line has no colon character.</body>" \
397#define ERR_RSP_INVALID_CHR_IN_HEADER ""
404#define ERR_RSP_FOOTER_WITHOUT_COLON \
406 "<head><title>Request broken</title></head>" \
407 "<body>HTTP request footer line has no colon character.</body>" \
410#define ERR_RSP_FOOTER_WITHOUT_COLON ""
417#define ERR_RSP_EMPTY_HEADER_NAME \
419 "<head><title>Request broken</title></head>" \
420 "<body>HTTP request header has empty header name.</body>" \
423#define ERR_RSP_EMPTY_HEADER_NAME ""
430#define ERR_RSP_EMPTY_FOOTER_NAME \
432 "<head><title>Request broken</title></head>" \
433 "<body>HTTP request footer has empty footer name.</body>" \
436#define ERR_RSP_EMPTY_FOOTER_NAME ""
447#define REQUEST_LACKS_HOST \
449 "<head><title>"Host:" header required</title></head>" \
450 "<body>HTTP/1.1 request without <b>"Host:"</b>.</body>" \
454#define REQUEST_LACKS_HOST ""
461#define REQUEST_UNSUPPORTED_TR_ENCODING \
463 "<head><title>Unsupported Transfer-Encoding</title></head>" \
464 "<body>The Transfer-Encoding used in request is not supported.</body>" \
467#define REQUEST_UNSUPPORTED_TR_ENCODING ""
475#define REQUEST_LENGTH_WITH_TR_ENCODING \
477 "<head><title>Malformed request</title></head>" \
478 "<body>Wrong combination of the request headers: both Transfer-Encoding " \
479 "and Content-Length headers are used at the same time.</body>" \
482#define REQUEST_LENGTH_WITH_TR_ENCODING ""
493#define REQUEST_MALFORMED \
494 "<html><head><title>Request malformed</title></head>" \
495 "<body>HTTP request is syntactically incorrect.</body></html>"
497#define REQUEST_MALFORMED ""
505#define REQUEST_CHUNKED_MALFORMED \
506 "<html><head><title>Request malformed</title></head>" \
507 "<body>HTTP chunked encoding is syntactically incorrect.</body></html>"
509#define REQUEST_CHUNKED_MALFORMED ""
516#define REQUEST_CHUNK_TOO_LARGE \
517 "<html><head><title>Request content too large</title></head>" \
518 "<body>The chunk size used in HTTP chunked encoded " \
519 "request is too large.</body></html>"
521#define REQUEST_CHUNK_TOO_LARGE ""
528#define REQUEST_CONTENTLENGTH_TOOLARGE \
529 "<html><head><title>Request content too large</title></head>" \
530 "<body>HTTP request has too large value for " \
531 "<b>Content-Length</b> header.</body></html>"
533#define REQUEST_CONTENTLENGTH_TOOLARGE ""
541#define REQUEST_CONTENTLENGTH_MALFORMED \
542 "<html><head><title>Request malformed</title></head>" \
543 "<body>HTTP request has wrong value for " \
544 "<b>Content-Length</b> header.</body></html>"
546#define REQUEST_CONTENTLENGTH_MALFORMED ""
556#define ERROR_MSG_DATA_NOT_HANDLED_BY_APP \
557 "<html><head><title>Internal server error</title></head>" \
558 "<body>Please ask the developer of this Web server to carefully " \
559 "read the GNU libmicrohttpd documentation about connection " \
560 "management and blocking.</body></html>"
562#define ERROR_MSG_DATA_NOT_HANDLED_BY_APP ""
569#define REQ_HTTP_VER_IS_TOO_OLD \
570 "<html><head><title>Requested HTTP version is not supported</title></head>" \
571 "<body>Requested HTTP version is too old and not " \
572 "supported.</body></html>"
574#define REQ_HTTP_VER_IS_TOO_OLD ""
581#define REQ_HTTP_VER_IS_NOT_SUPPORTED \
582 "<html><head><title>Requested HTTP version is not supported</title></head>" \
583 "<body>Requested HTTP version is not supported.</body></html>"
585#define REQ_HTTP_VER_IS_NOT_SUPPORTED ""
592#define MHD_SENFILE_CHUNK_ (0x20000)
597#define MHD_SENFILE_CHUNK_THR_P_C_ (0x200000)
611 return _ (
"The operation would block, retry later");
613 return _ (
"The connection was forcibly closed by remote peer");
615 return _ (
"The socket is not connected");
617 return _ (
"Not enough system resources to serve the request");
619 return _ (
"Bad FD value");
621 return _ (
"Argument value is invalid");
623 return _ (
"Argument value is not supported");
625 return _ (
"The socket is no longer available for sending");
627 return _ (
"TLS encryption or decryption error");
632 return _ (
"Not an error code");
635 return _ (
"Wrong error code value");
655 struct MemoryPool *
const pool =
c->
pool;
667 c->write_buffer_size))
669 if (
c->write_buffer_size -
c->write_buffer_append_offset >=
676 c->write_buffer_size,
682 c->write_buffer =
buf;
689 c->read_buffer_size))
702 c->read_buffer =
buf;
749 connection->epoll_state &=
772 else if (
i > (
size_t)
ret)
773 connection->epoll_state &=
801 if (
NULL == connection)
840 if (
NULL == connection)
953 ( ((key ?
strlen (key) : 0) != key_size) ||
1067 if (
NULL == connection)
1085 ( (key == pos->
header) ||
1160#define MHD_lookup_header_s_token_ci(c,h,tkn) \
1161 MHD_lookup_header_token_ci ((c),(h),MHD_STATICSTR_LEN_ (h), \
1162 (tkn),MHD_STATICSTR_LEN_ (tkn))
1253#ifdef MHD_USE_THREADS
1279#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
1296#ifdef MHD_USE_THREADS
1311 (0 !=
epoll_ctl (daemon->epoll_upgrade_fd,
1316 MHD_PANIC (
_ (
"Failed to remove FD from epoll set.\n"));
1318 if (
urh->in_eready_list)
1321 daemon->eready_urh_tail,
1323 urh->in_eready_list =
false;
1330 (0 !=
epoll_ctl (daemon->epoll_upgrade_fd,
1335 MHD_PANIC (
_ (
"Failed to remove FD from epoll set.\n"));
1384#define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, emsg)
1386#define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, NULL)
1429 _ (
"Closing connection (out of memory)."));
1446#if defined(_MHD_HAVE_SENDFILE)
1456 (
char *) response->
data,
1466#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1474 _ (
"Closing connection (application reported " \
1475 "error generating data)."));
1483#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1510 static const size_t max_chunk = 0xFFFFFF;
1533#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1538 _ (
"Closing connection (out of memory)."));
1598#if defined(MHD_USE_THREADS)
1602 _ (
"No callback for the chunked data."));
1615#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1619 _ (
"Closing connection (application error " \
1620 "generating response)."));
1633#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1640#if defined(MHD_USE_THREADS)
1644 _ (
"Closing connection (application returned " \
1645 "more data than requested)."));
1700#ifdef UPGRADE_SUPPORT
1703 if (
NULL !=
r->upgrade_handler)
1714 mhd_assert ( (!
c->stop_with_error) || (
c->discard_request));
1715 if ((
c->read_closed) || (
c->discard_request))
1761 static const char *
const days[] = {
1762 "Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
1764 static const char *
const mons[] = {
1765 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
1766 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
1768 static const size_t buf_len = 29;
1772#if ! defined(HAVE_C11_GMTIME_S) && ! defined(HAVE_W32_GMTIME_S) && \
1773 ! defined(HAVE_GMTIME_R)
1779#if defined(HAVE_C11_GMTIME_S)
1783#elif defined(HAVE_W32_GMTIME_S)
1787#elif defined(HAVE_GMTIME_R)
1963 if ((
NULL ==
c->read_buffer) || (0 ==
c->read_buffer_size))
1970 mhd_assert (
c->read_buffer_offset <=
c->read_buffer_size);
1971 if (0 ==
c->read_buffer_offset)
1974 c->read_buffer =
NULL;
1975 c->read_buffer_size = 0;
1980 c->read_buffer_size));
1982 c->read_buffer_offset);
1985 c->read_buffer_size =
c->read_buffer_offset;
2000 struct MemoryPool *
const pool = connection->
pool;
2006 mhd_assert (
c->write_buffer_append_offset >=
c->write_buffer_send_offset);
2007 mhd_assert (
c->write_buffer_size >=
c->write_buffer_append_offset);
2019 c->write_buffer_size));
2022 c->write_buffer_size,
2027 if (
c->write_buffer_send_offset ==
c->write_buffer_append_offset)
2030 c->write_buffer_send_offset = 0;
2031 c->write_buffer_append_offset = 0;
2035 return c->write_buffer_size -
c->write_buffer_append_offset;
2052 struct MemoryPool *
const pool = connection->
pool;
2056 mhd_assert (
c->write_buffer_append_offset >=
c->write_buffer_send_offset);
2057 mhd_assert (
c->write_buffer_size >=
c->write_buffer_append_offset);
2059 if ( (
NULL ==
c->write_buffer) || (0 ==
c->write_buffer_size))
2063 c->write_buffer =
NULL;
2066 if (
c->write_buffer_append_offset ==
c->write_buffer_size)
2070 c->write_buffer_append_offset);
2072 (0 ==
c->write_buffer_append_offset));
2073 c->write_buffer_size =
c->write_buffer_append_offset;
2074 if (0 ==
c->write_buffer_size)
2075 c->write_buffer =
NULL;
2156#ifdef UPGRADE_SUPPORT
2167 (2 ==
rcode / 100) )
2212#ifdef UPGRADE_SUPPORT
2216 if (
c->rp.props.use_reply_body_headers)
2251 c->rp.props.set =
true;
2268 if ((!
c->rp.props.use_reply_body_headers) && (0 !=
r->total_size))
2271 _ (
"This reply with response code %u cannot use reply body. "
2272 "Non-empty response body is ignored and not used.\n"),
2273 (
unsigned) (
c->rp.responseCode));
2275 if ( (!
c->rp.props.use_reply_body_headers) &&
2279 _ (
"This reply with response code %u cannot use reply body. "
2280 "Application defined \"Content-Length\" header violates"
2281 "HTTP specification.\n"),
2282 (
unsigned) (
c->rp.responseCode));
2328#define buffer_append_s(buf,ppos,buf_size,str) \
2329 buffer_append (buf,ppos,buf_size,str, MHD_STATICSTR_LEN_ (str))
2379 for (hdr =
r->first_header;
NULL != hdr; hdr = hdr->
next)
2415 buf[(*ppos)++] =
':';
2416 buf[(*ppos)++] =
' ';
2448 buf[(*ppos)++] =
'\r';
2449 buf[(*ppos)++] =
'\n';
2487#ifdef UPGRADE_SUPPORT
2493 mhd_assert ((!
c->rp.props.chunked) ||
c->rp.props.use_reply_body_headers);
2495 c->rp.props.use_reply_body_headers);
2496#ifdef UPGRADE_SUPPORT
2498 !
c->rp.props.use_reply_body_headers);
2535 buf =
c->write_buffer;
2536 pos =
c->write_buffer_append_offset;
2545 if (!
c->rp.responseIcy)
2628 !
c->rp.props.chunked,
2629 (!
c->rp.props.use_reply_body_headers) &&
2638 if ( (
c->rp.props.use_reply_body_headers) &&
2643 if (
c->rp.props.chunked)
2683 c->write_buffer_append_offset = pos;
2717 buf =
c->write_buffer +
c->write_buffer_append_offset;
2724 for (pos =
c->rp.response->first_header;
NULL != pos; pos = pos->
next)
2750 mhd_assert (
c->write_buffer_append_offset <=
c->write_buffer_size);
2774 unsigned int status_code,
2798 _ (
"Error processing request (HTTP response code is %u ('%s')). " \
2799 "Closing connection.\n"),
2807 _ (
"Too late to send an error response, " \
2808 "response is being sent already.\n"),
2813 _ (
"Too late for error response."));
2838 if (
NULL == response)
2842 _ (
"Failed to create error response.\n"),
2889 _ (
"Closing connection " \
2890 "(failed to queue error response)."));
2920 _ (
"Closing connection " \
2921 "(failed to create error response header)."));
2932#define transmit_error_response_static(c, code, msg) \
2933 transmit_error_response_len (c, code, \
2934 msg, MHD_STATICSTR_LEN_ (msg), \
2940#define transmit_error_response_header(c, code, m, hd_n, hd_n_l, hd_v, hd_v_l) \
2941 transmit_error_response_len (c, code, \
2942 m, MHD_STATICSTR_LEN_ (m), \
2961 if (!
c->rq.have_chunked_upload)
2962 return 0 !=
c->read_buffer_offset;
2966 if (
c->rq.current_chunk_offset ==
c->rq.current_chunk_size)
2972 return 0 !=
c->read_buffer_offset;
2994#ifndef MHD_MAX_REASONABLE_HEADERS_SIZE_
3004# define MHD_MAX_REASONABLE_HEADERS_SIZE_ (6 * 1024)
3007#ifndef MHD_MAX_REASONABLE_REQ_TARGET_SIZE_
3018# define MHD_MAX_REASONABLE_REQ_TARGET_SIZE_ 8000
3021#ifndef MHD_MIN_REASONABLE_HEADERS_SIZE_
3029# define MHD_MIN_REASONABLE_HEADERS_SIZE_ 26
3032#ifndef MHD_MIN_REASONABLE_REQ_TARGET_SIZE_
3040# define MHD_MIN_REASONABLE_REQ_TARGET_SIZE_ 40
3043#ifndef MHD_MIN_REASONABLE_REQ_METHOD_SIZE_
3051# define MHD_MIN_REASONABLE_REQ_METHOD_SIZE_ 16
3054#ifndef MHD_MIN_REASONABLE_REQ_CHUNK_LINE_LENGTH_
3060# define MHD_MIN_REASONABLE_REQ_CHUNK_LINE_LENGTH_ 4
3094 (
size_t) ((
c->read_buffer +
c->read_buffer_offset)
3095 -
c->rq.field_lines.start);
3305#ifdef COOKIE_SUPPORT
3429 (!
c->rq.have_chunked_upload));
3431 (
c->rq.have_chunked_upload));
3439 _ (
"No space left in the read buffer when " \
3440 "receiving the initial part of " \
3441 "the request line."));
3459 _ (
"No space left in the read buffer when " \
3460 "receiving the URI in " \
3461 "the request line. " \
3462 "The request uses non-standard HTTP request " \
3471 !
c->rq.some_payload_processed);
3505 if (
c->rq.current_chunk_offset !=
c->rq.current_chunk_size)
3514 if (0 !=
c->rq.current_chunk_size)
3524 c->read_buffer_offset);
3576 c->read_buffer_size);
3581 if (!
c->rq.have_chunked_upload)
3587 (
c->rq.remaining_upload_size >
c->read_buffer_size);
3592 if (0 ==
c->rq.current_chunk_size)
3595 c->read_buffer_size);
3599 c->rq.current_chunk_size -
c->rq.current_chunk_offset;
3602 mhd_assert (
c->rq.current_chunk_offset <=
c->rq.current_chunk_size);
3649 else if (0 ==
c->rq.req_target_len)
3658 stage =
c->rq.have_chunked_upload ?
3682#ifdef UPGRADE_SUPPORT
3713 switch (connection->tls_state)
3736 MHD_PANIC (
_ (
"Invalid TLS state value.\n"));
3744 _ (
"In function %s handling connection at state: %s\n"),
3748 switch (connection->
state)
3840#ifdef UPGRADE_SUPPORT
3894 _ (
"Not enough memory in pool to allocate header record!\n"));
3905#ifdef COOKIE_SUPPORT
3959 while (
' ' == str[
i] ||
'\t' == str[
i] ||
';' == str[
i])
3973 const char l = str[
i];
3974 if ((
'=' ==
l) || (
' ' ==
l) || (
'\t' ==
l) || (
'"' ==
l) || (
',' ==
l) ||
3975 (
';' ==
l) || (0 ==
l))
3980 while (
str_len >
i && (
' ' == str[
i] ||
'\t' == str[
i]))
3987 if ((
str_len ==
i) || (
'=' != str[
i]) || (0 == name_len))
3993 while (
str_len >
i && (
' ' == str[
i] ||
'\t' == str[
i]))
4019 const char l = str[
i];
4020 if ((
';' ==
l) || (
'"' ==
l) || (
',' ==
l) || (
';' ==
l) ||
4021 (
'\\' ==
l) || (0 ==
l))
4023 if ((
' ' ==
l) || (
'\t' ==
l))
4041 if ((
str_len >
i) && ((
' ' == str[
i]) || (
'\t' == str[
i])))
4046 }
while (
str_len >
i && (
' ' == str[
i] ||
'\t' == str[
i]));
4057 else if (
';' == str[
i])
4103 else if (
' ' != str[
i])
4185 _ (
"The Cookie header has been parsed, but it is not fully "
4186 "compliant with the standard.\n"));
4195 _ (
"The Cookie header has been only partially parsed as it "
4196 "contains malformed data.\n"));
4204 _ (
"The Cookie header has been ignored as it contains "
4205 "malformed data.\n"));
4210 _ (
"The Cookie header has malformed data.\n"));
4216 _ (
"Not enough memory in the connection pool to "
4217 "parse client cookies!\n"));
4224#ifndef HAVE_MESSAGES
4238#define HTTP_VER_LEN (MHD_STATICSTR_LEN_ (MHD_HTTP_VERSION_1_1))
4260 (
'H' !=
h[0]) || (
'T' !=
h[1]) || (
'T' !=
h[2]) || (
'P' !=
h[3]) ||
4263 ((
'0' >
h[5]) || (
'9' <
h[5])) ||
4264 ((
'0' >
h[7]) || (
'9' <
h[7])))
4272 if (1 ==
h[5] -
'0')
4275 if (1 ==
h[7] -
'0')
4277 else if (0 ==
h[7] -
'0')
4285 if (0 ==
h[5] -
'0')
4315 const char *
const m = method;
4379 _ (
"Application reported internal error, " \
4380 "closing connection."));
4623 _ (
"Application reported internal error, " \
4624 "closing connection."));
4630 MHD_PANIC (
_ (
"libmicrohttpd API violation.\n"));
4647 _ (
"WARNING: Access Handler Callback has not processed " \
4648 "any upload data and connection is not suspended. " \
4649 "This may result in hung connection.\n"));
4719#ifdef COOKIE_SUPPORT
4739 _ (
"Received HTTP/1.1 request without `Host' header.\n"));
4792 _ (
"The 'Content-Length' request header is ignored "
4793 "as chunked Transfer-Encoding is used "
4794 "for this request.\n"));
4818 (
'0' <=
clen[0]) && (
'9' >=
clen[0]))
4824 _ (
"Too large value of 'Content-Length' header. " \
4825 "Closing connection.\n"));
4837 _ (
"Failed to parse 'Content-Length' header. " \
4838 "Closing connection.\n"));
4858 memset (&
c->rq.hdrs.hdr, 0,
sizeof(
c->rq.hdrs.hdr));
4869 c->rq.field_lines.start =
c->read_buffer;
4870 memset (&
c->rq.hdrs.hdr, 0,
sizeof(
c->rq.hdrs.hdr));
4875#ifndef MHD_MAX_EMPTY_LINES_SKIP
4880#define MHD_MAX_EMPTY_LINES_SKIP 1024
4894 const int discp_lvl =
c->daemon->client_discipline;
4938 0 !=
c->rq.hdrs.rq_line.proc_pos);
4940 if (0 ==
c->read_buffer_offset)
4945 p =
c->rq.hdrs.rq_line.proc_pos;
4966 if (
'\r' ==
c->read_buffer[0])
4968 if (1 ==
c->read_buffer_offset)
4970 if (
'\n' ==
c->read_buffer[1])
4973 c->read_buffer += 2;
4974 c->read_buffer_size -= 2;
4975 c->read_buffer_offset -= 2;
4976 c->rq.hdrs.rq_line.skipped_empty_lines++;
4979 else if ((
'\n' ==
c->read_buffer[0]) &&
4983 c->read_buffer += 1;
4984 c->read_buffer_size -= 1;
4985 c->read_buffer_offset -= 1;
4986 c->rq.hdrs.rq_line.skipped_empty_lines++;
4993 c->rq.hdrs.rq_line.skipped_empty_lines))
4996 _ (
"Too many meaningless extra empty lines " \
4997 "received before the request"));
5000 if (0 ==
c->read_buffer_offset)
5011 while (
p < c->read_buffer_offset)
5013 const char chr =
c->read_buffer[
p];
5032 mhd_assert ((0 ==
c->rq.hdrs.rq_line.last_ws_end) || \
5033 (
c->rq.hdrs.rq_line.last_ws_end > \
5034 c->rq.hdrs.rq_line.last_ws_start));
5035 mhd_assert ((0 ==
c->rq.hdrs.rq_line.last_ws_start) || \
5036 (0 !=
c->rq.hdrs.rq_line.last_ws_end));
5041 if (
p + 1 ==
c->read_buffer_offset)
5043 c->rq.hdrs.rq_line.proc_pos =
p;
5046 else if (
'\n' ==
c->read_buffer[
p + 1])
5055 c->read_buffer[
p] =
' ';
5056 c->rq.num_cr_sp_replaced++;
5071 _ (
"Bare CR characters are not allowed " \
5072 "in the request line.\n"));
5077 else if (
'\n' ==
chr)
5098 _ (
"Bare LF characters are not allowed " \
5099 "in the request line.\n"));
5108 if (
NULL !=
c->rq.method)
5116 if (0 !=
c->rq.hdrs.rq_line.last_ws_end)
5119 if (
NULL !=
c->rq.hdrs.rq_line.rq_tgt)
5121 c->read_buffer [
c->rq.hdrs.rq_line.last_ws_start] = 0;
5122 c->rq.req_target_len =
5123 c->rq.hdrs.rq_line.last_ws_start
5124 - (
size_t) (
c->rq.hdrs.rq_line.rq_tgt -
c->read_buffer);
5126 else if ((
c->rq.hdrs.rq_line.last_ws_start + 1 <
5127 c->rq.hdrs.rq_line.last_ws_end) &&
5133 c->rq.hdrs.rq_line.last_ws_start++;
5134 c->read_buffer[
c->rq.hdrs.rq_line.last_ws_start] = 0;
5135 c->rq.hdrs.rq_line.rq_tgt =
5136 c->read_buffer +
c->rq.hdrs.rq_line.last_ws_start;
5137 c->rq.req_target_len = 0;
5138 c->rq.hdrs.rq_line.num_ws_in_uri = 0;
5139 c->rq.hdrs.rq_line.rq_tgt_qmark =
NULL;
5142 if (
NULL !=
c->rq.hdrs.rq_line.rq_tgt)
5144 c->rq.version =
c->read_buffer +
c->rq.hdrs.rq_line.last_ws_end;
5152 if ((
NULL ==
c->rq.version)
5153 && (
NULL !=
c->rq.hdrs.rq_line.rq_tgt)
5156 && (0 !=
c->read_buffer[(
size_t)
5157 (
c->rq.hdrs.rq_line.rq_tgt
5158 -
c->read_buffer) - 1]))
5167 c->rq.version =
c->rq.hdrs.rq_line.rq_tgt;
5169 c->rq.hdrs.rq_line.rq_tgt =
c->read_buffer +
uri_pos;
5170 c->rq.req_target_len = 0;
5171 c->rq.hdrs.rq_line.num_ws_in_uri = 0;
5172 c->rq.hdrs.rq_line.rq_tgt_qmark =
NULL;
5176 if (
NULL !=
c->rq.version)
5181 - (
size_t) (
c->rq.version
5187 c->read_buffer[
p] = 0;
5194 c->read_buffer +=
p;
5195 c->read_buffer_size -=
p;
5196 c->read_buffer_offset -=
p;
5198 c->rq.req_target_len);
5200 (0 !=
c->rq.req_target_len));
5202 ((
size_t) (
c->rq.hdrs.rq_line.rq_tgt_qmark \
5203 -
c->rq.hdrs.rq_line.rq_tgt) < \
5204 c->rq.req_target_len));
5206 (
c->rq.hdrs.rq_line.rq_tgt_qmark >= \
5207 c->rq.hdrs.rq_line.rq_tgt));
5223 _ (
"The request line is malformed.\n"));
5230 (
p ==
c->rq.hdrs.rq_line.last_ws_end) &&
5231 (0 !=
c->rq.hdrs.rq_line.last_ws_end))
5237 if (
NULL ==
c->rq.hdrs.rq_line.rq_tgt)
5242 c->rq.hdrs.rq_line.rq_tgt =
c->read_buffer +
p;
5244 c->rq.hdrs.rq_line.last_ws_start = 0;
5245 c->rq.hdrs.rq_line.last_ws_end = 0;
5253 (
c->rq.hdrs.rq_line.rq_tgt + 1 ==
c->read_buffer +
p));
5255 c->rq.version =
c->read_buffer +
p;
5257 c->rq.hdrs.rq_line.last_ws_start = 0;
5258 c->rq.hdrs.rq_line.last_ws_end = 0;
5270 if ((0 ==
c->rq.hdrs.rq_line.last_ws_end) ||
5271 (
p !=
c->rq.hdrs.rq_line.last_ws_end) ||
5275 if (
NULL ==
c->rq.method)
5278 mhd_assert (0 ==
c->rq.hdrs.rq_line.last_ws_start);
5286 _ (
"The request line starts with "
5287 "a whitespace.\n"));
5290 c->read_buffer[
p] = 0;
5291 c->rq.method =
c->read_buffer;
5300 if (
NULL ==
c->rq.version)
5304 c->read_buffer[
p] = 0;
5305 mhd_assert (((
size_t) (
c->rq.hdrs.rq_line.rq_tgt \
5306 -
c->read_buffer)) <=
p);
5307 c->rq.req_target_len =
5308 p - (
size_t) (
c->rq.hdrs.rq_line.rq_tgt -
c->read_buffer);
5324 _ (
"The request line has more than "
5325 "two whitespaces.\n"));
5332 if (0 !=
c->rq.hdrs.rq_line.last_ws_end)
5335 c->rq.hdrs.rq_line.num_ws_in_uri +=
5336 c->rq.hdrs.rq_line.last_ws_end
5337 -
c->rq.hdrs.rq_line.last_ws_start;
5341 c->rq.hdrs.rq_line.last_ws_start =
p;
5342 c->rq.hdrs.rq_line.last_ws_end =
p + 1;
5349 c->rq.hdrs.rq_line.last_ws_end =
p + 1;
5355 mhd_assert ((0 ==
c->rq.hdrs.rq_line.last_ws_end) || \
5356 (
c->rq.hdrs.rq_line.last_ws_end ==
p) || \
5359 if ((
p ==
c->rq.hdrs.rq_line.last_ws_end) &&
5360 (0 !=
c->rq.hdrs.rq_line.last_ws_end) &&
5364 if (
NULL ==
c->rq.hdrs.rq_line.rq_tgt)
5369 c->rq.hdrs.rq_line.rq_tgt =
c->read_buffer +
p;
5371 c->rq.hdrs.rq_line.last_ws_start = 0;
5372 c->rq.hdrs.rq_line.last_ws_end = 0;
5381 (
c->rq.hdrs.rq_line.rq_tgt + 1 ==
c->read_buffer +
p));
5383 c->rq.version =
c->read_buffer +
p;
5385 c->rq.hdrs.rq_line.last_ws_start = 0;
5386 c->rq.hdrs.rq_line.last_ws_end = 0;
5394 if ((
NULL ==
c->rq.hdrs.rq_line.rq_tgt_qmark) &&
5395 (
NULL !=
c->rq.hdrs.rq_line.rq_tgt))
5397 c->rq.hdrs.rq_line.rq_tgt_qmark =
c->read_buffer +
p;
5400 else if ((0xb ==
chr) || (0xc ==
chr))
5404 if ((
NULL !=
c->rq.hdrs.rq_line.rq_tgt) &&
5405 (
NULL ==
c->rq.version) &&
5408 c->rq.hdrs.rq_line.num_ws_in_uri++;
5413 _ (
"Invalid character is in the "
5414 "request line.\n"));
5422 _ (
"The NUL character is in the "
5423 "request line.\n"));
5431 c->rq.hdrs.rq_line.proc_pos =
p;
5436#ifndef MHD_MAX_FIXED_URI_LEN
5440#define MHD_MAX_FIXED_URI_LEN (64 * 1024)
5461 mhd_assert (0 !=
c->rq.hdrs.rq_line.num_ws_in_uri);
5463 c->rq.req_target_len);
5465 + 2 *
c->rq.hdrs.rq_line.num_ws_in_uri;
5471 _ (
"The request has whitespace character is " \
5472 "in the URI and the URI is too large to " \
5473 "send automatic redirect to fixed URI.\n"));
5481 const char chr =
c->rq.hdrs.rq_line.rq_tgt[
i++];
5512 }
while (
i < c->rq.req_target_len);
5535 _ (
"The request has whitespace character is in the " \
5558 (
c->rq.hdrs.rq_line.rq_tgt <=
c->rq.hdrs.rq_line.rq_tgt_qmark));
5560 (
c->rq.req_target_len > \
5561 (
size_t) (
c->rq.hdrs.rq_line.rq_tgt_qmark \
5562 -
c->rq.hdrs.rq_line.rq_tgt)));
5565 if (
NULL !=
c->daemon->uri_log_callback)
5567 c->rq.client_aware =
true;
5568 c->rq.client_context =
5569 c->daemon->uri_log_callback (
c->daemon->uri_log_callback_cls,
5570 c->rq.hdrs.rq_line.rq_tgt,
5574 if (
NULL !=
c->rq.hdrs.rq_line.rq_tgt_qmark)
5578 c->rq.req_target_len
5579 - (
size_t) (
c->rq.hdrs.rq_line.rq_tgt_qmark -
c->rq.hdrs.rq_line.rq_tgt);
5581 c->rq.hdrs.rq_line.rq_tgt_qmark[0] = 0;
5584 c->rq.hdrs.rq_line.rq_tgt_qmark + 1,
5602 c->daemon->unescape_callback (
c->daemon->unescape_callback_cls,
5604 c->rq.hdrs.rq_line.rq_tgt);
5605 c->rq.url =
c->rq.hdrs.rq_line.rq_tgt;
5621 const int discp_lvl =
c->daemon->client_discipline;
5632 if ((
NULL !=
c->rq.version) &&
5634 (
c->rq.hdrs.rq_line.proc_pos
5635 - (
size_t) (
c->rq.version -
c->read_buffer))))
5652 if (0 !=
c->rq.hdrs.rq_line.num_ws_in_uri)
5716 const int discp_lvl =
c->daemon->client_discipline;
5756#if ! defined (HAVE_MESSAGES) && ! defined(_DEBUG)
5764 p =
c->rq.hdrs.hdr.proc_pos;
5767 while (
p < c->read_buffer_offset)
5769 const char chr =
c->read_buffer[
p];
5773 (
c->rq.hdrs.hdr.name_len <
p));
5774 mhd_assert ((0 ==
c->rq.hdrs.hdr.name_len) || (0 !=
p));
5776 (
c->rq.hdrs.hdr.name_end_found));
5777 mhd_assert ((0 ==
c->rq.hdrs.hdr.value_start) || \
5778 (
c->rq.hdrs.hdr.name_len <
c->rq.hdrs.hdr.value_start));
5779 mhd_assert ((0 ==
c->rq.hdrs.hdr.value_start) || \
5780 (0 !=
c->rq.hdrs.hdr.name_len));
5782 (0 ==
c->rq.hdrs.hdr.name_len) || \
5783 (
c->rq.hdrs.hdr.ws_start >
c->rq.hdrs.hdr.name_len));
5785 (0 ==
c->rq.hdrs.hdr.value_start) || \
5786 (
c->rq.hdrs.hdr.ws_start >
c->rq.hdrs.hdr.value_start));
5794 if (
p + 2 >=
c->read_buffer_offset)
5800 if (
p + 2 >
c->read_buffer_offset)
5803 if (
'\n' ==
c->read_buffer[
p + 1])
5812 c->read_buffer[
p] =
' ';
5813 c->rq.num_cr_sp_replaced++;
5831 else if (
'\n' ==
chr)
5840 if (
p + 1 >=
c->read_buffer_offset)
5911 c->read_buffer[
p] =
' ';
5913 c->read_buffer[
p + 1] =
' ';
5921 if (
c->rq.hdrs.hdr.starts_with_ws)
5929 _ (
"Whitespace-prefixed first header line " \
5930 "has been skipped.\n"));
5934 else if (!
c->rq.hdrs.hdr.name_end_found)
5950 c->rq.skipped_broken_lines++;
5961 memset (&
c->rq.hdrs.hdr, 0,
sizeof(
c->rq.hdrs.hdr));
5972 hdr_name->len =
c->rq.hdrs.hdr.name_len;
5975 if (0 ==
c->rq.hdrs.hdr.value_start)
5977 c->rq.hdrs.hdr.value_start =
p;
5978 c->read_buffer[
p] = 0;
5981 else if (0 !=
c->rq.hdrs.hdr.ws_start)
5984 mhd_assert (
c->rq.hdrs.hdr.ws_start >
c->rq.hdrs.hdr.value_start);
5985 c->read_buffer[
c->rq.hdrs.hdr.ws_start] = 0;
5986 value_len =
c->rq.hdrs.hdr.ws_start -
c->rq.hdrs.hdr.value_start;
5991 c->read_buffer[
p] = 0;
5994 hdr_value->str =
c->read_buffer +
c->rq.hdrs.hdr.value_start;
6005 else if ((
' ' ==
chr) || (
'\t' ==
chr))
6021 c->rq.hdrs.hdr.starts_with_ws =
true;
6023 else if ((!
c->rq.hdrs.hdr.name_end_found) &&
6024 (!
c->rq.hdrs.hdr.starts_with_ws))
6029 if (0 ==
c->rq.hdrs.hdr.ws_start)
6030 c->rq.hdrs.hdr.ws_start =
p;
6049 if (0 ==
c->rq.hdrs.hdr.ws_start)
6050 c->rq.hdrs.hdr.ws_start =
p;
6068 c->read_buffer[
p] =
' ';
6077 if ((!
c->rq.hdrs.hdr.name_end_found) &&
6078 (!
c->rq.hdrs.hdr.starts_with_ws))
6083 if (0 ==
c->rq.hdrs.hdr.ws_start)
6084 c->rq.hdrs.hdr.name_len =
p;
6100 c->rq.hdrs.hdr.name_len =
c->rq.hdrs.hdr.ws_start;
6101#ifndef MHD_FAVOR_SMALL_CODE
6102 c->rq.hdrs.hdr.ws_start = 0;
6117 c->rq.hdrs.hdr.name_end_found =
true;
6118 c->read_buffer[
c->rq.hdrs.hdr.name_len] = 0;
6122 if (0 !=
c->rq.hdrs.hdr.ws_start)
6139#ifndef MHD_FAVOR_SMALL_CODE
6140 c->rq.hdrs.hdr.ws_start = 0;
6148 if (0 ==
c->rq.hdrs.hdr.value_start)
6149 c->rq.hdrs.hdr.value_start =
p;
6150#ifndef MHD_FAVOR_SMALL_CODE
6151 c->rq.hdrs.hdr.ws_start = 0;
6154#ifdef MHD_FAVOR_SMALL_CODE
6155 c->rq.hdrs.hdr.ws_start = 0;
6160 c->rq.hdrs.hdr.proc_pos =
p;
6231 _ (
"Failed to allocate memory in the connection memory " \
6232 "pool to store %s.\n"),
6276 if (1 ==
c->rq.num_cr_sp_replaced)
6279 _ (
"One bare CR character has been replaced with space " \
6282 _ (
"the request line or in the request headers") :
6283 _ (
"the request footers"));
6285 else if (0 !=
c->rq.num_cr_sp_replaced)
6288 _ (
"%" PRIu64 " bare CR characters have been replaced with " \
6289 "spaces in the request line and/or in the request %s.\n"),
6293 if (1 ==
c->rq.skipped_broken_lines)
6296 _ (
"One %s line without colon has been skipped.\n"),
6299 else if (0 !=
c->rq.skipped_broken_lines)
6302 _ (
"%" PRIu64 " %s lines without colons has been skipped.\n"),
6311 c->rq.header_size = (
size_t) (
c->read_buffer -
c->rq.method);
6313 c->rq.field_lines.size =
6314 (
size_t) ((
c->read_buffer -
c->rq.field_lines.start) - 1);
6315 if (
'\r' == *(
c->read_buffer - 2))
6316 c->rq.field_lines.size--;
6330 if (
NULL !=
c->rq.headers_received_tail)
6332 c->rq.headers_received_tail->value
6333 +
c->rq.headers_received_tail->value_size;
6338 if (0 !=
c->read_buffer_offset)
6341 c->read_buffer_offset);
6364#if defined(MHD_USE_THREADS)
6380#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
6390#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
6450 _ (
"Socket has been disconnected when reading request.\n"));
6462 _ (
"Connection socket is closed when reading " \
6463 "request due to the error: %s\n"),
6465 "detected connection closure");
6480 _ (
"Connection was closed by remote side with incomplete "
6501 _ (
"In function %s handling connection at state: %s\n"),
6506 switch (connection->
state)
6524#ifdef UPGRADE_SUPPORT
6599 _ (
"In function %s handling connection at state: %s\n"),
6603 switch (connection->
state)
6626 _ (
"Failed to send data in request for %s.\n"),
6627 connection->
rq.
url);
6633#if _MHD_DEBUG_SEND_DATA
6635 _ (
"Sent 100 continue response: `%.*s'\n"),
6661 (0 ==
resp->data_start) || \
6664 (
resp->total_size ==
6687 (
resp->total_size ==
resp->data_size));
6701 ((0 ==
resp->total_size) ||
6712 _ (
"Failed to send the response headers for the " \
6713 "request for `%s'. Error: %s\n"),
6750#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
6759#if defined(_MHD_HAVE_SENDFILE)
6778 MHD_PANIC (
_ (
"Data offset exceeds limit.\n"));
6785#if _MHD_DEBUG_SEND_DATA
6788 _ (
"Sent %d-byte DATA response: `%.*s'\n"),
6792 - rp.response->data_start]);
6795#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
6805 _ (
"Failed to send the response body for the " \
6806 "request for `%s'. Error: %s\n"),
6837 _ (
"Failed to send the chunked response body for the " \
6838 "request for `%s'. Error: %s\n"),
6873 _ (
"Failed to send the footers for the " \
6874 "request for `%s'. Error: %s\n"),
6894#ifdef UPGRADE_SUPPORT
6902 _ (
"Internal error.\n"));
6941 _ (
"Detected system clock %u milliseconds jump back.\n"),
6948 _ (
"Detected too large system clock %" PRIu64 " milliseconds "
6971#ifdef MHD_USE_THREADS
6985#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7017#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7030 _ (
"Failed to signal end of connection via inter-thread " \
7031 "communication channel.\n"));
7062 c->write_buffer =
NULL;
7063 c->write_buffer_size = 0;
7064 c->write_buffer_send_offset = 0;
7065 c->write_buffer_append_offset = 0;
7067 c->continue_message_write_offset = 0;
7069 c->read_buffer_offset = 0;
7097 c->stop_with_error ?
7100 c->read_buffer =
NULL;
7101 c->read_buffer_size = 0;
7102 c->read_buffer_offset = 0;
7103 c->write_buffer =
NULL;
7104 c->write_buffer_size = 0;
7105 c->write_buffer_send_offset = 0;
7106 c->write_buffer_append_offset = 0;
7115 if ( (
NULL !=
d->notify_completed) &&
7116 (
c->rq.client_aware) )
7117 d->notify_completed (
d->notify_completed_cls,
7119 &
c->rq.client_context,
7121 c->rq.client_aware =
false;
7123 if (
NULL !=
c->rp.response)
7125 c->rp.response =
NULL;
7129 c->event_loop_info =
7130 (0 ==
c->read_buffer_offset) ?
7138 c->write_buffer =
NULL;
7139 c->write_buffer_size = 0;
7140 c->write_buffer_send_offset = 0;
7141 c->write_buffer_append_offset = 0;
7142 c->continue_message_write_offset = 0;
7153 c->read_buffer_offset,
7157 c->rq.client_context =
NULL;
7178#ifdef MHD_USE_THREADS
7198 _ (
"In function %s handling connection at state: %s\n"),
7202 switch (connection->
state)
7344 _ (
"Closing connection (failed to create "
7345 "response header).\n"));
7355#ifdef UPGRADE_SUPPORT
7399#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7405#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7417#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7437#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7445#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7457#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7478 _ (
"Closing connection (failed to create " \
7479 "response footer)."));
7511#ifdef UPGRADE_SUPPORT
7564 daemon->eready_tail,
7580 event.data.ptr = connection;
7589 _ (
"Call to epoll_ctl failed: %s\n"),
7638 if (
NULL == connection->tls_session)
7648 if (
NULL == connection->tls_session)
7658 if (
NULL == connection->tls_session)
7676 sizeof(connection->
addr));
7696#if SIZEOF_UNSIGNED_INT <= (SIZEOF_UINT64_T - 2)
7739 daemon = connection->
daemon;
7748#if (SIZEOF_UINT64_T - 2) <= SIZEOF_UNSIGNED_INT
7753 _ (
"The specified connection timeout (%u) is too " \
7754 "large. Maximum allowed value (%" PRIu64 ") will be used " \
7764#if defined(MHD_USE_THREADS)
7787#if defined(MHD_USE_THREADS)
7845 unsigned int status_code,
7851 if ((
NULL == connection) || (
NULL == response))
7854 daemon = connection->
daemon;
7862#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7869 _ (
"Attempted to queue response on wrong thread!\n"));
7886#ifdef UPGRADE_SUPPORT
7887 if (
NULL != response->upgrade_handler)
7894 _ (
"Attempted 'upgrade' connection on daemon without" \
7895 " MHD_ALLOW_UPGRADE option!\n"));
7903 _ (
"Application used invalid status code for" \
7904 " 'upgrade' response!\n"));
7912 _ (
"Application used invalid response" \
7913 " without \"Connection\" header!\n"));
7926 _ (
"Application used invalid response" \
7927 " without \"upgrade\" token in" \
7928 " \"Connection\" header!\n"));
7936 _ (
"Connection \"Upgrade\" can be used only " \
7937 "with HTTP/1.1 connections!\n"));
7945#ifdef UPGRADE_SUPPORT
7946 if (
NULL == response->upgrade_handler)
7950 _ (
"Application used status code 101 \"Switching Protocols\" " \
7951 "with non-'upgrade' response!\n"));
7958 _ (
"Application used status code 101 \"Switching Protocols\", " \
7959 "but this MHD was built without \"Upgrade\" support!\n"));
7964 if ( (100 > status_code) ||
7965 (999 < status_code) )
7969 _ (
"Refused wrong status code (%u). " \
7970 "HTTP requires three digits status code!\n"),
7975 if (200 > status_code)
7981 _ (
"Wrong status code (%u) refused. " \
7982 "HTTP/1.0 clients do not support 1xx status codes!\n"),
7992 _ (
"Wrong status code (%u) refused. " \
7993 "HTTP/1.0 reply mode does not support 1xx status codes!\n"),
8000 (2 == status_code / 100) )
8004 _ (
"Successful (%u) response code cannot be used to answer " \
8005 "\"CONNECT\" request!\n"),
8016 _ (
"HEAD-only response cannot be used when the request requires "
8017 "reply body to be sent!\n"));
8027 _ (
"The response has application-defined \"Content-Length\" " \
8028 "header. The reply to the request will be not " \
8029 "HTTP-compliant and may result in hung connection or " \
8030 "other problems!\n"));
8038#if defined(_MHD_HAVE_SENDFILE)
8039 if ( (response->
fd == -1) ||
#define ERR_MSG_REQUEST_CHUNK_LINE_TOO_BIG
#define REQUEST_CONTENTLENGTH_TOOLARGE
static enum MHD_Result build_connection_chunked_response_footer(struct MHD_Connection *connection)
static ssize_t recv_param_adapter(struct MHD_Connection *connection, void *other, size_t i)
#define ERR_RSP_EMPTY_FOOTER_NAME
static enum MHD_Result build_header_response(struct MHD_Connection *connection)
static void connection_close_error(struct MHD_Connection *connection, const char *emsg)
static bool process_request_target(struct MHD_Connection *c)
void MHD_connection_set_initial_state_(struct MHD_Connection *c)
#define MHD_CHUNK_HEADER_REASONABLE_LEN
#define MHD_lookup_header_s_token_ci(c, h, tkn)
@ MHD_PROC_RECV_BODY_CHUNKED
@ MHD_PROC_RECV_BODY_NORMAL
#define REQUEST_CHUNK_TOO_LARGE
void MHD_connection_handle_write(struct MHD_Connection *connection)
static void MHD_connection_update_event_loop_info(struct MHD_Connection *connection)
#define buffer_append_s(buf, ppos, buf_size, str)
void * MHD_connection_alloc_memory_(struct MHD_Connection *connection, size_t size)
#define MHD_MAX_FIXED_URI_LEN
static enum MHD_Result try_ready_normal_body(struct MHD_Connection *connection)
#define REQUEST_CHUNKED_MALFORMED
#define REQ_HTTP_VER_IS_NOT_SUPPORTED
#define MHD_MAX_REASONABLE_HEADERS_SIZE_
#define RQ_LINE_TOO_MANY_WSP
static void call_connection_handler(struct MHD_Connection *connection)
static enum MHD_Result connection_add_header(void *cls, const char *key, size_t key_size, const char *value, size_t value_size, enum MHD_ValueKind kind)
static void process_request_body(struct MHD_Connection *connection)
static void setup_reply_properties(struct MHD_Connection *connection)
#define HTTP_100_CONTINUE
static void send_redirect_fixed_rq_target(struct MHD_Connection *c)
static void handle_recv_no_space(struct MHD_Connection *c, enum MHD_ProcRecvDataStage stage)
#define transmit_error_response_static(c, code, msg)
#define REQUEST_MALFORMED
static bool get_request_line(struct MHD_Connection *c)
@ MHD_HDR_LINE_READING_NEED_MORE_DATA
@ MHD_HDR_LINE_READING_GOT_END_OF_HEADER
@ MHD_HDR_LINE_READING_GOT_HEADER
@ MHD_HDR_LINE_READING_DATA_ERROR
_MHD_static_inline void reset_rq_header_processing_state(struct MHD_Connection *c)
static void connection_shrink_read_buffer(struct MHD_Connection *connection)
#define ERR_RSP_WSP_IN_FOOTER_NAME
#define MHD_ALLOW_BARE_LF_AS_CRLF_(discp_lvl)
static enum replyBodyUse is_reply_body_needed(struct MHD_Connection *connection, unsigned int rcode)
void MHD_set_http_callbacks_(struct MHD_Connection *connection)
static void transmit_error_response_len(struct MHD_Connection *connection, unsigned int status_code, const char *message, size_t message_len, char *header_name, size_t header_name_len, char *header_value, size_t header_value_len)
#define REQ_HTTP_VER_IS_TOO_OLD
#define ERR_MSG_REQUEST_TOO_BIG
#define MHD_MAX_REASONABLE_REQ_TARGET_SIZE_
#define ERR_MSG_REQUEST_FOOTER_TOO_BIG
#define ERR_MSG_REQUEST_CHUNK_LINE_EXT_TOO_BIG
static bool connection_check_timedout(struct MHD_Connection *c)
static enum MHD_ConnKeepAlive keepalive_possible(struct MHD_Connection *connection)
static void handle_req_chunk_size_line_no_space(struct MHD_Connection *c, const char *chunk_size_line, size_t chunk_size_line_size)
#define REQUEST_LACKS_HOST
#define BARE_CR_IN_FOOTER
static bool try_grow_read_buffer(struct MHD_Connection *connection, bool required)
static bool parse_http_version(struct MHD_Connection *connection, const char *http_string, size_t len)
#define BARE_LF_IN_HEADER
#define ERR_RSP_EMPTY_HEADER_NAME
static bool need_100_continue(struct MHD_Connection *connection)
#define ERR_RSP_WSP_IN_HEADER_NAME
static bool get_req_headers(struct MHD_Connection *c, bool process_footers)
#define ERROR_MSG_DATA_NOT_HANDLED_BY_APP
#define MHD_MIN_REASONABLE_REQ_METHOD_SIZE_
static unsigned int get_no_space_err_status_code(struct MHD_Connection *c, enum MHD_ProcRecvDataStage stage, const char *add_element, size_t add_element_size)
#define REQUEST_UNSUPPORTED_TR_ENCODING
enum MHD_Result MHD_connection_handle_idle(struct MHD_Connection *connection)
static void cleanup_connection(struct MHD_Connection *connection)
#define ERR_RSP_OBS_FOLD_FOOTER
static void parse_http_std_method(struct MHD_Connection *connection, const char *method, size_t len)
static bool check_and_grow_read_buffer_space(struct MHD_Connection *c)
static enum MHD_Result try_ready_chunked_body(struct MHD_Connection *connection, bool *p_finished)
static bool get_date_str(char *date)
#define BARE_LF_IN_FOOTER
static void connection_reset(struct MHD_Connection *connection, bool reuse)
#define REQUEST_LENGTH_WITH_TR_ENCODING
#define MHD_MIN_REASONABLE_REQ_TARGET_SIZE_
#define RQ_TARGET_INVALID_CHAR
static bool get_request_line_inner(struct MHD_Connection *c)
static void handle_req_footers_no_space(struct MHD_Connection *c, const char *add_footer, size_t add_footer_size)
void MHD_connection_handle_read(struct MHD_Connection *connection, bool socket_error)
static void connection_switch_from_recv_to_send(struct MHD_Connection *connection)
#define ERR_RSP_WSP_BEFORE_FOOTER
static void parse_connection_headers(struct MHD_Connection *connection)
#define ERR_RSP_INVALID_CHR_IN_HEADER
void MHD_update_last_activity_(struct MHD_Connection *connection)
#define MHD_MAX_EMPTY_LINES_SKIP
#define MHD_MIN_REASONABLE_HEADERS_SIZE_
#define BARE_CR_IN_HEADER
#define ERR_MSG_REQUEST_HEADER_TOO_BIG
static bool add_user_headers(char *buf, size_t *ppos, size_t buf_size, struct MHD_Response *response, bool filter_transf_enc, bool filter_content_len, bool add_close, bool add_keep_alive)
#define REQUEST_CONTENTLENGTH_MALFORMED
static enum MHD_HdrLineReadRes_ get_req_header(struct MHD_Connection *c, bool process_footers, struct _MHD_str_w_len *hdr_name, struct _MHD_str_w_len *hdr_value)
static void check_connection_reply(struct MHD_Connection *connection)
static void handle_req_headers_no_space(struct MHD_Connection *c, const char *add_header, size_t add_header_size)
void MHD_connection_close_(struct MHD_Connection *connection, enum MHD_RequestTerminationCode termination_code)
static size_t connection_maximize_write_buffer(struct MHD_Connection *connection)
static bool has_unprocessed_upload_body_data_in_buffer(struct MHD_Connection *c)
void MHD_connection_mark_closed_(struct MHD_Connection *connection)
#define CONNECTION_CLOSE_ERROR(c, emsg)
#define transmit_error_response_header(c, code, m, hd_n, hd_n_l, hd_v, hd_v_l)
static bool buffer_append(char *buf, size_t *ppos, size_t buf_size, const char *append, size_t append_size)
static enum MHD_Result check_write_done(struct MHD_Connection *connection, enum MHD_CONNECTION_STATE next_state)
#define ERR_RSP_WSP_BEFORE_HEADER
enum MHD_HdrLineReadRes_ _MHD_FIXED_ENUM
#define ERR_MSG_REQUEST_HEADER_WITH_COOKIES_TOO_BIG
_MHD_static_inline void switch_to_rq_headers_processing(struct MHD_Connection *c)
static bool get_date_header(char *header)
static bool MHD_lookup_header_token_ci(const struct MHD_Connection *connection, const char *header, size_t header_len, const char *token, size_t token_len)
#define ERR_RSP_FOOTER_WITHOUT_COLON
#define MHD_MIN_REASONABLE_REQ_CHUNK_LINE_LENGTH_
Methods for managing connections.
#define MHD_connection_finish_forward_(conn)
#define MHD_ERR_OPNOTSUPP_
static int parse_cookie_header(struct MHD_Request *request)
bool MHD_tls_connection_shutdown(struct MHD_Connection *connection)
bool MHD_run_tls_handshake_(struct MHD_Connection *connection)
Methods for managing connections.
#define MHD_HTTP_INTERNAL_SERVER_ERROR
#define MHD_HTTP_MOVED_PERMANENTLY
#define MHD_HTTP_URI_TOO_LONG
#define MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
#define MHD_HTTP_PROCESSING
#define MHD_HTTP_NOT_IMPLEMENTED
#define MHD_HTTP_SWITCHING_PROTOCOLS
#define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED
#define MHD_HTTP_CONTENT_TOO_LARGE
#define MHD_HTTP_NOT_MODIFIED
#define MHD_HTTP_NO_CONTENT
#define MHD_HTTP_BAD_REQUEST
#define MHD_HTTP_METHOD_TRACE
#define MHD_HTTP_METHOD_OPTIONS
#define MHD_HTTP_METHOD_GET
#define MHD_HTTP_METHOD_HEAD
#define MHD_HTTP_METHOD_POST
#define MHD_HTTP_METHOD_PUT
#define MHD_HTTP_METHOD_CONNECT
#define MHD_HTTP_METHOD_DELETE
_MHD_EXTERN enum MHD_Result MHD_set_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value)
enum MHD_Result(* MHD_KeyValueIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
_MHD_EXTERN const char * MHD_lookup_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
enum MHD_Result(* MHD_KeyValueIteratorN)(void *cls, enum MHD_ValueKind kind, const char *key, size_t key_size, const char *value, size_t value_size)
_MHD_EXTERN int MHD_get_connection_values_n(struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIteratorN iterator, void *iterator_cls)
_MHD_EXTERN int MHD_get_connection_values(struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls)
static enum MHD_Result MHD_set_connection_value_n_nocheck_(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, size_t key_size, const char *value, size_t value_size)
_MHD_EXTERN enum MHD_Result MHD_set_connection_value_n(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, size_t key_size, const char *value, size_t value_size)
_MHD_EXTERN enum MHD_Result MHD_lookup_connection_value_n(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, size_t key_size, const char **value_ptr, size_t *value_size_ptr)
MHD_RequestTerminationCode
@ MHD_CONNECTION_INFO_CONNECTION_TIMEOUT
@ MHD_CONNECTION_INFO_SOCKET_CONTEXT
@ MHD_CONNECTION_INFO_GNUTLS_SESSION
@ MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE
@ MHD_CONNECTION_INFO_CIPHER_ALGO
@ MHD_CONNECTION_INFO_CONNECTION_SUSPENDED
@ MHD_CONNECTION_INFO_CLIENT_ADDRESS
@ MHD_CONNECTION_INFO_DAEMON
@ MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT
@ MHD_CONNECTION_INFO_HTTP_STATUS
@ MHD_CONNECTION_INFO_CONNECTION_FD
@ MHD_CONNECTION_INFO_PROTOCOL
@ MHD_REQUEST_TERMINATED_TIMEOUT_REACHED
@ MHD_REQUEST_TERMINATED_COMPLETED_OK
@ MHD_REQUEST_TERMINATED_WITH_ERROR
@ MHD_REQUEST_TERMINATED_READ_ERROR
@ MHD_REQUEST_TERMINATED_CLIENT_ABORT
_MHD_EXTERN enum MHD_Result MHD_queue_response(struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
_MHD_EXTERN void MHD_destroy_response(struct MHD_Response *response)
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_buffer_static(size_t size, const void *buffer)
_MHD_EXTERN enum MHD_Result MHD_set_connection_option(struct MHD_Connection *connection, enum MHD_CONNECTION_OPTION option,...)
_MHD_EXTERN const union MHD_ConnectionInfo * MHD_get_connection_info(struct MHD_Connection *connection, enum MHD_ConnectionInfoType info_type,...)
#define MHD_HTTP_VERSION_1_0
#define MHD_HTTP_VERSION_1_1
bool MHD_parse_arguments_(struct MHD_Request *request, enum MHD_ValueKind kind, char *args, MHD_ArgumentIterator_ cb, unsigned int *num_headers)
#define MHD_ERR_CONNRESET_
#define XDLL_insert(head, tail, element)
@ MHD_EPOLL_STATE_SUSPENDED
@ MHD_EPOLL_STATE_IN_EREADY_EDLL
@ MHD_EPOLL_STATE_READ_READY
@ MHD_EPOLL_STATE_IN_EPOLL_SET
@ MHD_EPOLL_STATE_WRITE_READY
#define DLL_insert(head, tail, element)
#define EDLL_insert(head, tail, element)
@ MHD_CONN_KEEPALIVE_UNKOWN
#define EDLL_remove(head, tail, element)
#define XDLL_remove(head, tail, element)
#define DLL_remove(head, tail, element)
void * MHD_pool_reallocate(struct MemoryPool *pool, void *old, size_t old_size, size_t new_size)
void MHD_pool_destroy(struct MemoryPool *pool)
size_t MHD_pool_get_free(struct MemoryPool *pool)
void * MHD_pool_reset(struct MemoryPool *pool, void *keep, size_t copy_bytes, size_t new_size)
void * MHD_pool_allocate(struct MemoryPool *pool, size_t size, int from_end)
#define MHD_mutex_unlock_chk_(pmutex)
#define MHD_mutex_lock_chk_(pmutex)
#define MHD_SCKT_ERR_IS_(err, code)
#define MHD_SCKT_ERR_IS_EAGAIN_(err)
#define MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)
#define MHD_socket_last_strerr_()
#define MHD_SCKT_EOPNOTSUPP_
#define MHD_socket_get_error_()
#define MHD_SCKT_ERR_IS_REMOTE_DISCNN_(err)
#define MHD_SCKT_ERR_IS_EINTR_(err)
#define MHD_SCKT_SEND_MAX_SIZE_
#define MHD_SCKT_ENOTCONN_
#define MHD_recv_(s, b, l)
int MHD_str_equal_caseless_(const char *str1, const char *str2)
size_t MHD_str_to_uint64_n_(const char *str, size_t maxlen, uint64_t *out_val)
size_t MHD_strx_to_uint64_n_(const char *str, size_t maxlen, uint64_t *out_val)
int MHD_str_equal_caseless_n_(const char *const str1, const char *const str2, size_t maxlen)
bool MHD_str_has_token_caseless_(const char *str, const char *const token, size_t token_len)
#define MHD_str_has_s_token_caseless_(str, tkn)
#define MHD_STATICSTR_LEN_(macro)
ssize_t MHD_send_hdr_and_body_(struct MHD_Connection *connection, const char *header, size_t header_size, bool never_push_hdr, const char *body, size_t body_size, bool complete_response)
ssize_t MHD_send_iovec_(struct MHD_Connection *connection, struct MHD_iovec_track_ *const r_iov, bool push_data)
ssize_t MHD_send_data_(struct MHD_Connection *connection, const char *buffer, size_t buffer_size, bool push_data)
Declarations of send() wrappers.
MHD internal shared structures.
@ MHD_CONNECTION_BODY_RECEIVED
@ MHD_CONNECTION_CHUNKED_BODY_SENT
@ MHD_CONNECTION_REQ_HEADERS_RECEIVING
@ MHD_CONNECTION_BODY_RECEIVING
@ MHD_CONNECTION_HEADERS_SENDING
@ MHD_CONNECTION_FOOTERS_SENDING
@ MHD_CONNECTION_FOOTERS_RECEIVED
@ MHD_CONNECTION_FULL_REPLY_SENT
@ MHD_CONNECTION_HEADERS_SENT
@ MHD_CONNECTION_HEADERS_PROCESSED
@ MHD_CONNECTION_REQ_LINE_RECEIVED
@ MHD_CONNECTION_NORMAL_BODY_UNREADY
@ MHD_CONNECTION_HEADERS_RECEIVED
@ MHD_CONNECTION_NORMAL_BODY_READY
@ MHD_CONNECTION_START_REPLY
@ MHD_CONNECTION_FOOTERS_RECEIVING
@ MHD_CONNECTION_CHUNKED_BODY_READY
@ MHD_CONNECTION_FULL_REQ_RECEIVED
@ MHD_CONNECTION_CHUNKED_BODY_UNREADY
@ MHD_CONNECTION_CONTINUE_SENDING
@ MHD_CONNECTION_REQ_LINE_RECEIVING
@ MHD_TLS_CONN_TLS_CLOSING
@ MHD_TLS_CONN_WR_CLOSING
@ MHD_TLS_CONN_INVALID_STATE
@ MHD_TLS_CONN_TLS_CLOSED
@ MHD_TLS_CONN_TLS_FAILED
@ MHD_TLS_CONN_HANDSHAKING
@ MHD_EVENT_LOOP_INFO_PROCESS_READ
@ MHD_EVENT_LOOP_INFO_PROCESS
@ MHD_EVENT_LOOP_INFO_READ
@ MHD_EVENT_LOOP_INFO_WRITE
@ MHD_EVENT_LOOP_INFO_CLEANUP
struct MHD_IoVec MHD_iovec_
#define MHD_IS_HTTP_VER_SUPPORTED(ver)
_MHD_static_inline struct MHD_Daemon * MHD_get_master(struct MHD_Daemon *const daemon)
@ MHD_RAF_HAS_CONTENT_LENGTH
@ MHD_RAF_HAS_CONNECTION_CLOSE
@ MHD_RAF_HAS_TRANS_ENC_CHUNKED
@ MHD_RAF_HAS_CONNECTION_HDR
#define MHD_IS_HTTP_VER_1_1_COMPAT(ver)
@ MHD_HTTP_MTHD_NO_METHOD
#define MHD_D_IS_USING_THREAD_PER_CONN_(d)
#define MHD_D_IS_USING_THREADS_(d)
#define MHD_D_IS_USING_EPOLL_(d)
bool MHD_pool_is_resizable_inplace(struct MemoryPool *pool, void *block, size_t block_size)
void MHD_pool_deallocate(struct MemoryPool *pool, void *block, size_t block_size)
void * MHD_pool_try_alloc(struct MemoryPool *pool, size_t size, size_t *required_bytes)
memory pool; mostly used for efficient (de)allocation for each connection and bounding memory use for...
Header for platform missing functions.
Header for platform-independent inter-thread communication.
limits values definitions
Header for platform-independent locks abstraction.
uint64_t MHD_monotonic_msec_counter(void)
internal monotonic clock functions implementations
#define MHD_SEND_SPIPE_SUPPRESS_NEEDED
size_t MHD_uint8_to_str_pad(uint8_t val, uint8_t min_digits, char *buf, size_t buf_size)
size_t MHD_uint16_to_str(uint16_t val, char *buf, size_t buf_size)
size_t MHD_uint64_to_str(uint64_t val, char *buf, size_t buf_size)
bool MHD_str_equal_caseless_bin_n_(const char *const str1, const char *const str2, size_t len)
size_t MHD_uint32_to_strx(uint32_t val, char *buf, size_t buf_size)
Header for string manipulating helpers.
#define MHD_thread_handle_ID_is_current_thread_(hndl_id)
bool MHD_add_response_entry_no_alloc_(struct MHD_Response *response, enum MHD_ValueKind kind, char *header, size_t header_len, char *content, size_t content_len)
void MHD_increment_response_rc(struct MHD_Response *response)
#define MHD_CONTENT_READER_END_OF_STREAM
_MHD_EXTERN size_t MHD_get_reason_phrase_len_for(unsigned int code)
#define MHD_INVALID_SOCKET
_MHD_EXTERN const char * MHD_get_reason_phrase_for(unsigned int code)
#define MHD_CONTENT_READER_END_WITH_ERROR
@ MHD_USE_SUPPRESS_DATE_NO_CLOCK
@ MHD_RF_SEND_KEEP_ALIVE_HEADER
@ MHD_RF_HEAD_ONLY_RESPONSE
@ MHD_RF_HTTP_1_0_COMPATIBLE_STRICT
@ MHD_RF_INSANITY_HEADER_CONTENT_LENGTH
@ MHD_CONNECTION_OPTION_TIMEOUT
Methods for managing response objects.
enum MHD_Result MHD_response_execute_upgrade_(struct MHD_Response *response, struct MHD_Connection *connection)
size_t write_buffer_send_offset
enum MHD_ConnectionEventLoopInfo event_loop_info
size_t write_buffer_append_offset
enum MHD_ConnKeepAlive keepalive
union MHD_ConnectionInfo connection_info_dummy
size_t continue_message_write_offset
struct sockaddr_storage addr
size_t read_buffer_offset
enum MHD_CONNECTION_STATE state
struct MHD_Daemon * daemon
uint64_t connection_timeout_ms
MHD_AccessHandlerCallback default_handler
MHD_mutex_ cleanup_connection_mutex
struct MHD_Connection * connections_head
MHD_RequestCompletedCallback notify_completed
uint64_t connection_timeout_ms
struct MHD_Connection * manual_timeout_tail
void * notify_completed_cls
struct MHD_Connection * cleanup_tail
struct MHD_Daemon * worker_pool
struct MHD_Connection * manual_timeout_head
void * default_handler_cls
struct MHD_Connection * suspended_connections_tail
struct MHD_Connection * cleanup_head
struct MHD_Connection * normal_timeout_head
struct MHD_Connection * normal_timeout_tail
struct MHD_Connection * suspended_connections_head
struct MHD_Connection * connections_tail
uint64_t rsp_write_position
struct MHD_iovec_track_ resp_iov
struct MHD_Response * response
unsigned int responseCode
struct MHD_Reply_Properties props
uint64_t current_chunk_size
uint64_t current_chunk_offset
struct MHD_HTTP_Header * headers_received
struct MHD_HTTP_Header * headers_received_tail
bool some_payload_processed
size_t skipped_broken_lines
size_t num_cr_sp_replaced
enum MHD_HTTP_Version http_ver
enum MHD_HTTP_Method http_mthd
uint64_t remaining_upload_size
enum MHD_HTTP_StatusCode status_code
MHD_ContentReaderCallback crc
enum MHD_ResponseAutoFlags flags_auto
enum MHD_ResponseFlags flags
struct MHD_HTTP_Header * first_header
unsigned int connection_timeout
struct MHD_Daemon * daemon
struct sockaddr * client_addr