47 #define HTTP_100_CONTINUE "HTTP/1.1 100 Continue\r\n\r\n" 57 #define REQUEST_TOO_BIG "<html><head><title>Request too big</title></head><body>Your HTTP header was too big for the memory constraints of this webserver.</body></html>" 59 #define REQUEST_TOO_BIG "" 70 #define REQUEST_LACKS_HOST "<html><head><title>"Host:" header required</title></head><body>In HTTP 1.1, requests must include a "Host:" header, and your HTTP 1.1 request lacked such a header.</body></html>" 72 #define REQUEST_LACKS_HOST "" 83 #define REQUEST_MALFORMED "<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>" 85 #define REQUEST_MALFORMED "" 95 #define INTERNAL_ERROR "<html><head><title>Internal server error</title></head><body>Please ask the developer of this Web server to carefully read the GNU libmicrohttpd documentation about connection management and blocking.</body></html>" 97 #define INTERNAL_ERROR "" 104 #define DEBUG_CLOSE MHD_NO 109 #define DEBUG_SEND_DATA MHD_NO 134 #if defined(TCP_CORK) || defined(TCP_PUSH) 153 #if defined(TCP_CORK) || defined(TCP_NOPUSH) 155 #if defined(TCP_NODELAY) 160 #if defined(TCP_NOPUSH) && !defined(TCP_CORK) 162 res = (0 == setsockopt (connection->
socket_fd,
165 (
const void *) &on_val,
168 #if defined(TCP_NODELAY) 171 res &= (0 == setsockopt (connection->
socket_fd,
174 (
const void *) &off_val,
179 #if defined(TCP_NODELAY) 183 (void) setsockopt (connection->
socket_fd,
186 (
const void *) &off_val,
190 res = (0 == setsockopt (connection->
socket_fd,
193 (
const void *) &on_val,
211 #if defined(TCP_NODELAY) 214 #if defined(TCP_CORK) || defined(TCP_NOPUSH) 218 if (
NULL == connection)
220 #if defined(TCP_CORK) 222 res &= (0 == setsockopt (connection->
socket_fd,
225 (
const void *) &off_val,
229 #if defined(TCP_NODELAY) 231 res &= (0 == setsockopt (connection->
socket_fd,
234 (
const void *) &on_val,
238 #if defined(TCP_NOPUSH) && !defined(TCP_CORK) 240 res &= (0 == setsockopt (connection->
socket_fd,
243 (
const void *) &off_val,
265 #if defined(TCP_NOPUSH) && !defined(TCP_CORK) 269 if (
NULL == connection)
272 #if defined(TCP_NOPUSH) && !defined(TCP_CORK) 294 #if defined(TCP_NODELAY) 297 #if defined(TCP_CORK) 299 socklen_t param_size =
sizeof (cork_val);
303 #if defined(TCP_CORK) 307 if ( (0 != getsockopt (connection->
socket_fd,
313 res &= (0 == setsockopt (connection->
socket_fd,
316 (
const void *) &off_val,
319 #elif defined(TCP_NOPUSH) 323 res &= (0 == setsockopt (connection->
socket_fd,
326 (
const void *) &off_val,
331 res &= (0 == setsockopt (connection->
socket_fd,
334 (
const void *) &off_val,
364 if (
NULL == connection)
368 if (0 != (pos->
kind & kind))
371 if ( (
NULL != iterator) &&
372 (
MHD_YES != iterator (iterator_cls,
420 pos->
header = (
char *) key;
421 pos->
value = (
char *) value;
456 if (
NULL == connection)
459 if ((0 != (pos->
kind & kind)) &&
563 #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) 578 struct MHD_UpgradeResponseHandle *urh = connection->urh;
589 (0 != epoll_ctl (daemon->epoll_upgrade_fd,
594 MHD_PANIC (
_(
"Failed to remove FD from epoll set\n"));
596 if (urh->in_eready_list)
599 daemon->eready_urh_tail,
601 urh->in_eready_list =
false;
608 (0 != epoll_ctl (daemon->epoll_upgrade_fd,
613 MHD_PANIC (
_(
"Failed to remove FD from epoll set\n"));
618 shutdown (urh->mhd.socket, SHUT_RDWR);
642 MHD_DLOG (connection->
daemon,
655 #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, emsg) 657 #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, NULL) 691 if (MHD_resp_sender_sendfile == connection->resp_sender)
710 if ( ((ssize_t)MHD_CONTENT_READER_END_OF_STREAM) == ret)
715 _(
"Closing connection (application reported error generating data)\n"));
753 2 * (0xFFFFFF +
sizeof(cbuf) + 2));
761 _(
"Closing connection (out of memory)\n"));
782 const size_t data_write_offset
785 ret = response->
data_size - data_write_offset;
789 &response->
data[data_write_offset],
805 _(
"Closing connection (application error generating response)\n"));
826 cblen = MHD_snprintf_(cbuf,
832 memcpy (&connection->
write_buffer[sizeof (cbuf) - cblen],
869 (0 != (connection->
response->
flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) )
882 #ifdef UPGRADE_SUPPORT 916 static const char *
const days[] = {
917 "Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat" 919 static const char *
const mons[] = {
920 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
921 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec" 925 #if !defined(HAVE_C11_GMTIME_S) && !defined(HAVE_W32_GMTIME_S) && !defined(HAVE_GMTIME_R) 931 #if defined(HAVE_C11_GMTIME_S) 932 if (
NULL == gmtime_s (&t,
935 #elif defined(HAVE_W32_GMTIME_S) 936 if (0 != gmtime_s (&now,
939 #elif defined(HAVE_GMTIME_R) 940 if (
NULL == gmtime_r(&t,
951 "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n",
952 days[now.tm_wday % 7],
953 (
unsigned int) now.tm_mday,
954 mons[now.tm_mon % 12],
955 (
unsigned int) (1900 + now.tm_year),
956 (
unsigned int) now.tm_hour,
957 (
unsigned int) now.tm_min,
958 (
unsigned int) now.tm_sec);
1012 char content_length_buf[128];
1013 size_t content_length_len;
1016 const char *reason_phrase;
1018 const char *client_requested_close;
1019 const char *response_has_close;
1020 const char *response_has_keepalive;
1021 const char *have_encoding;
1022 const char *have_content_length;
1024 int must_add_chunked_encoding;
1025 int must_add_keep_alive;
1026 int must_add_content_length;
1029 if (0 == connection->
version[0])
1044 MHD_snprintf_ (code,
1055 off = strlen (code);
1066 size += strlen (date);
1079 must_add_chunked_encoding =
MHD_NO;
1080 must_add_keep_alive =
MHD_NO;
1081 must_add_content_length =
MHD_NO;
1082 response_has_keepalive =
NULL;
1083 switch (connection->
state)
1088 response_has_keepalive = response_has_close;
1089 if ( (
NULL != response_has_close) &&
1092 response_has_close =
NULL;
1093 if ( (
NULL != response_has_keepalive) &&
1096 response_has_keepalive =
NULL;
1100 if ( (
NULL != client_requested_close) &&
1103 client_requested_close =
NULL;
1109 (
NULL == response_has_close) &&
1110 (
NULL == client_requested_close) )
1123 if (
NULL == have_encoding)
1125 must_add_chunked_encoding =
MHD_YES;
1143 if (
NULL == response_has_close)
1149 if ( ( (
NULL != client_requested_close) ||
1151 (
NULL == response_has_close) &&
1152 (0 == (connection->
response->
flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) )
1166 (
NULL == have_content_length) &&
1187 = MHD_snprintf_ (content_length_buf,
1188 sizeof (content_length_buf),
1191 must_add_content_length =
MHD_YES;
1195 if ( (
NULL == response_has_keepalive) &&
1196 (
NULL == response_has_close) &&
1197 (
MHD_NO == must_add_close) &&
1198 (0 == (connection->
response->
flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) &&
1200 must_add_keep_alive =
MHD_YES;
1203 response_has_keepalive =
NULL;
1211 if (must_add_keep_alive)
1213 if (must_add_chunked_encoding)
1215 if (must_add_content_length)
1216 size += content_length_len;
1217 EXTRA_CHECK (! (must_add_close && must_add_keep_alive) );
1218 EXTRA_CHECK (! (must_add_chunked_encoding && must_add_content_length) );
1221 if ( (pos->
kind == kind) &&
1222 (! ( (
MHD_YES == must_add_close) &&
1223 (pos->
value == response_has_keepalive) &&
1226 size += strlen (pos->
header) + strlen (pos->
value) + 4;
1233 #ifdef HAVE_MESSAGES 1234 MHD_DLOG (connection->
daemon,
1235 "Not enough memory for write!\n");
1249 "Connection: close\r\n",
1253 if (must_add_keep_alive)
1257 "Connection: Keep-Alive\r\n",
1261 if (must_add_chunked_encoding)
1265 "Transfer-Encoding: chunked\r\n",
1269 if (must_add_content_length)
1274 content_length_len);
1275 off += content_length_len;
1278 if ( (pos->
kind == kind) &&
1279 (! ( (pos->
value == response_has_keepalive) &&
1280 (
MHD_YES == must_add_close) &&
1283 off += MHD_snprintf_ (&data[off],
1292 off += strlen (date);
1323 unsigned int status_code,
1324 const char *message)
1336 #ifdef HAVE_MESSAGES 1337 MHD_DLOG (connection->
daemon,
1338 _(
"Error processing request (HTTP response code is %u (`%s')). Closing connection.\n"),
1345 MHD_RESPMEM_PERSISTENT);
1355 _(
"Closing connection (failed to create response header)\n"));
1378 MHD_DLOG (connection->
daemon,
1379 _(
"In function %s handling connection at state: %s\n"),
1381 MHD_state_to_string (connection->
state));
1383 switch (connection->
state)
1385 #ifdef HTTPS_SUPPORT 1387 if (0 == gnutls_record_get_direction (connection->tls_session))
1536 while ( (pos < connection->read_buffer_offset - 1) &&
1537 (
'\r' != rbuf[pos]) &&
1538 (
'\n' != rbuf[pos]) )
1541 (
'\n' != rbuf[pos]) )
1562 if ( (
'\r' == rbuf[pos]) &&
1563 (
'\n' == rbuf[pos + 1]) )
1596 #ifdef HAVE_MESSAGES 1597 MHD_DLOG (connection->
daemon,
1598 _(
"Not enough memory in pool to allocate header record!\n"));
1638 #ifdef HAVE_MESSAGES 1639 MHD_DLOG (connection->
daemon,
1640 _(
"Not enough memory in pool to parse cookies!\n"));
1657 while ( ((*sce) !=
'\0') &&
1664 while ( (*ekill ==
' ') &&
1686 while ( (
'\0' != semicolon[0]) &&
1688 ( (
';' != semicolon[0]) &&
1689 (
',' != semicolon[0]) ) ) )
1691 if (
'"' == semicolon[0])
1692 quotes = (quotes + 1) & 1;
1695 if (
'\0' == semicolon[0])
1697 if (
NULL != semicolon)
1699 semicolon[0] =
'\0';
1703 if ( (
'"' == equals[0]) &&
1704 (
'"' == equals[strlen (equals) - 1]) )
1706 equals[strlen (equals) - 1] =
'\0';
1739 unsigned int unused_num_headers;
1741 if (
NULL == (uri = memchr (line,
1746 connection->
method = line;
1750 while ( (
' ' == uri[0]) &&
1751 ( (
size_t)(uri - line) < line_len) )
1753 if ((
size_t)(uri - line) == line_len)
1764 http_version = line + line_len - 1;
1766 while ( (
' ' == http_version[0]) &&
1767 (http_version > uri) )
1770 while ( (
' ' != http_version[0]) &&
1771 (http_version > uri) )
1773 if (http_version > uri)
1775 http_version[0] =
'\0';
1776 connection->
version = http_version + 1;
1779 http_version - uri);
1786 line_len - (uri - line));
1806 &unused_num_headers);
1812 connection->
url = curi;
1845 _(
"Application reported internal error, closing connection.\n"));
1888 if ( (
'\r' == buffer_head[i]) ||
1889 (
'\n' == buffer_head[i]) )
1891 if ( (
'\r' == buffer_head[i]) ||
1892 (
'\n' == buffer_head[i]) )
1898 _(
"Received malformed HTTP request (bad chunked encoding). Closing connection.\n"));
1914 if (processed > available)
1915 processed = available;
1916 if (available > processed)
1923 while (i < available)
1925 if ( (
'\r' == buffer_head[i]) ||
1926 (
'\n' == buffer_head[i]) ||
1927 (
';' == buffer_head[i]) )
1935 if (
';' == buffer_head[i])
1937 while (i < available)
1939 if ( (
'\r' == buffer_head[i]) ||
1940 (
'\n' == buffer_head[i]) )
1948 if ( (i + 1 >= available) &&
1951 (
'0' == buffer_head[0]) ) )
1954 malformed = (end_size >= 16);
1960 malformed = (end_size != num_dig);
1966 _(
"Received malformed HTTP request (bad chunked encoding). Closing connection.\n"));
1970 if ( (i < available) &&
1971 ( (
'\r' == buffer_head[i]) ||
1972 (
'\n' == buffer_head[i]) ) )
2004 processed = available;
2010 size_t processed_st = (size_t) processed;
2023 _(
"Application reported internal error, closing connection.\n"));
2026 processed = (uint64_t) processed_st;
2028 if (processed > used)
2032 #ifdef HAVE_MESSAGES
2033 ,
_(
"libmicrohttpd API violation")
2041 #ifdef HAVE_MESSAGES 2047 MHD_DLOG (connection->
daemon,
2048 _(
"WARNING: incomplete POST processing and connection not suspended will result in hung connection.\n"));
2055 buffer_head += used;
2060 while (
MHD_YES == instant_retry);
2085 bytes_read = connection->
recv_cls (connection,
2106 if (0 == bytes_read)
2135 ret = connection->
send_cls (connection,
2152 _(
"Sent response: `%.*s'\n"),
2181 connection->
state = next_state;
2208 colon = strchr (line,
':');
2213 _(
"Received malformed line (no colon). Closing connection.\n"));
2223 white = strchr (line,
' ');
2224 if ( (
NULL != white) &&
2227 white = strchr (line,
'\t');
2228 if ( (
NULL != white) &&
2235 while ( (
'\0' != colon[0]) &&
2236 ( (
' ' == colon[0]) ||
2237 (
'\t' == colon[0]) ) )
2244 connection->
last = line;
2245 connection->
colon = colon;
2270 last = connection->
last;
2271 if ( (
' ' == line[0]) ||
2276 last_len = strlen (last);
2279 while ( (
' ' == tmp[0]) ||
2282 tmp_len = strlen (tmp);
2295 last_len + tmp_len + 1);
2303 memcpy (&last[last_len], tmp, tmp_len + 1);
2304 connection->
last = last;
2363 #ifdef HAVE_MESSAGES 2364 MHD_DLOG (connection->
daemon,
2365 _(
"Received HTTP 1.1 request without `Host' header.\n"));
2371 MHD_RESPMEM_PERSISTENT);
2399 if ( (clen == end) ||
2403 #ifdef HAVE_MESSAGES 2404 MHD_DLOG (connection->
daemon,
2405 "Failed to parse `Content-Length' header. Closing connection.\n");
2478 MHD_DLOG (connection->
daemon,
2479 _(
"In function %s handling connection at state: %s\n"),
2481 MHD_state_to_string (connection->
state));
2483 switch (connection->
state)
2504 #ifdef UPGRADE_SUPPORT 2505 case MHD_CONNECTION_UPGRADE:
2542 MHD_DLOG (connection->
daemon,
2543 _(
"In function %s handling connection at state: %s\n"),
2545 MHD_state_to_string (connection->
state));
2547 switch (connection->
state)
2558 ret = connection->
send_cls (connection,
2570 #ifdef HAVE_MESSAGES 2571 MHD_DLOG (connection->
daemon,
2572 _(
"Failed to send data in request for %s: %s\n"),
2582 _(
"Sent 100 continue response: `%.*s'\n"),
2611 uint64_t data_write_offset;
2622 if (data_write_offset > (uint64_t)
SIZE_MAX)
2624 ret = connection->
send_cls (connection,
2626 [(
size_t)data_write_offset],
2628 (
size_t)data_write_offset);
2632 _(
"Sent %d-byte DATA response: `%.*s'\n"),
2646 #ifdef HAVE_MESSAGES 2647 MHD_DLOG (connection->
daemon,
2648 _(
"Failed to send data in request for `%s': %s\n"),
2697 #ifdef UPGRADE_SUPPORT 2698 case MHD_CONNECTION_UPGRADE:
2705 _(
"Internal error\n"));
2771 if ( (MHD_ITC_IS_VALID_ (daemon->
itc)) &&
2772 (! MHD_itc_activate_ (daemon->
itc,
"c")) )
2774 #ifdef HAVE_MESSAGES 2776 _(
"Failed to signal end of connection via inter-thread communication channel"));
2808 _(
"In function %s handling connection at state: %s\n"),
2810 MHD_state_to_string (connection->
state));
2812 switch (connection->
state)
2821 if ( (
NULL == line) ||
3043 _(
"Closing connection (failed to create response header)\n"));
3061 #ifdef UPGRADE_SUPPORT 3067 connection->
state = MHD_CONNECTION_UPGRADE;
3080 if (
NULL != resp_clr)
3154 _(
"Closing connection (failed to create response header)\n"));
3185 client_close = ( (
NULL != end) &&
3260 #ifdef UPGRADE_SUPPORT 3261 case MHD_CONNECTION_UPGRADE:
3275 if ( (0 != timeout) &&
3286 #ifdef EPOLL_SUPPORT 3290 ret = MHD_connection_epoll_update_ (connection);
3298 #ifdef EPOLL_SUPPORT 3321 struct epoll_event event;
3323 event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET;
3324 event.data.ptr = connection;
3325 if (0 != epoll_ctl (daemon->epoll_fd,
3330 #ifdef HAVE_MESSAGES 3333 _(
"Call to epoll_ctl failed: %s\n"),
3378 #ifdef HTTPS_SUPPORT 3380 if (
NULL == connection->tls_session)
3382 connection->cipher = gnutls_cipher_get (connection->tls_session);
3385 if (
NULL == connection->tls_session)
3387 connection->protocol = gnutls_protocol_get_version (connection->tls_session);
3390 if (
NULL == connection->tls_session)
3430 enum MHD_CONNECTION_OPTION option,
3436 daemon = connection->
daemon;
3439 case MHD_CONNECTION_OPTION_TIMEOUT:
3456 va_start (ap, option);
3493 unsigned int status_code,
3496 #ifdef UPGRADE_SUPPORT 3500 if ( (
NULL == connection) ||
3501 (
NULL == response) ||
3506 #ifdef UPGRADE_SUPPORT 3507 daemon = connection->
daemon;
3508 if ( (
NULL != response->upgrade_handler) &&
3511 #ifdef HAVE_MESSAGES 3513 _(
"Attempted 'upgrade' connection on daemon without MHD_ALLOW_UPGRADE option!\n"));
3518 (
NULL != response->upgrade_handler) )
3520 #ifdef HAVE_MESSAGES 3522 _(
"Application used invalid status code for 'upgrade' response!\n"));
3531 if ( (response->
fd == -1) ||
3533 connection->resp_sender = MHD_resp_sender_std;
3535 connection->resp_sender = MHD_resp_sender_sendfile;
static int process_header_line(struct MHD_Connection *connection, char *line)
int(* MHD_KeyValueIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
static int parse_cookie_header(struct MHD_Connection *connection)
void * unescape_callback_cls
#define MHD_send_(s, b, l)
static int try_ready_normal_body(struct MHD_Connection *connection)
uint64_t current_chunk_offset
#define DLL_insert(head, tail, element)
#define MHD_HTTP_METHOD_CONNECT
static void MHD_connection_update_event_loop_info(struct MHD_Connection *connection)
enum MHD_CONNECTION_STATE state
static int try_ready_chunked_body(struct MHD_Connection *connection)
void * MHD_pool_reset(struct MemoryPool *pool, void *keep, size_t copy_bytes, size_t new_size)
uint64_t response_write_position
void MHD_pool_destroy(struct MemoryPool *pool)
#define HTTP_100_CONTINUE
enum MHD_ConnectionEventLoopInfo event_loop_info
int MHD_connection_handle_write(struct MHD_Connection *connection)
time_t connection_timeout
static int connection_add_header(struct MHD_Connection *connection, const char *key, const char *value, enum MHD_ValueKind kind)
Methods for managing connections.
void MHD_connection_close_(struct MHD_Connection *connection, enum MHD_RequestTerminationCode termination_code)
const char * MHD_get_response_header(struct MHD_Response *response, const char *key)
struct MHD_Response * response
#define REQUEST_LACKS_HOST
#define MHD_socket_get_error_()
struct MHD_Connection * normal_timeout_tail
Header for platform missing functions.
#define MHD_HTTP_NOT_MODIFIED
void MHD_connection_mark_closed_(struct MHD_Connection *connection)
MHD_RequestTerminationCode
static int do_read(struct MHD_Connection *connection)
struct MHD_HTTP_Header * first_header
static void transmit_error_response(struct MHD_Connection *connection, unsigned int status_code, const char *message)
MHD_AccessHandlerCallback default_handler
void * MHD_pool_allocate(struct MemoryPool *pool, size_t size, int from_end)
static void call_connection_handler(struct MHD_Connection *connection)
uint64_t remaining_upload_size
unsigned int responseCode
int MHD_parse_arguments_(struct MHD_Connection *connection, enum MHD_ValueKind kind, char *args, MHD_ArgumentIterator_ cb, unsigned int *num_headers)
Methods for managing response objects.
static void cleanup_connection(struct MHD_Connection *connection)
void MHD_update_last_activity_(struct MHD_Connection *connection)
#define MHD_UNSIGNED_LONG_LONG
void * uri_log_callback_cls
int MHD_response_execute_upgrade_(struct MHD_Response *response, struct MHD_Connection *connection)
struct MHD_Daemon * daemon
int(* idle_handler)(struct MHD_Connection *connection)
struct MHD_Connection * manual_timeout_head
struct MHD_Connection * cleanup_head
#define MHD_SCKT_ERR_IS_REMOTE_DISCNN_(err)
static void connection_close_error(struct MHD_Connection *connection, const char *emsg)
#define XDLL_remove(head, tail, element)
#define MHD_mutex_unlock_chk_(pmutex)
#define XDLL_insert(head, tail, element)
static int keepalive_possible(struct MHD_Connection *connection)
#define MHD_HTTP_URI_TOO_LONG
struct MHD_Connection * cleanup_tail
Header for platform-independent inter-thread communication.
int MHD_connection_handle_read(struct MHD_Connection *connection)
#define MHD_STATICSTR_LEN_(macro)
size_t write_buffer_send_offset
void * MHD_pool_reallocate(struct MemoryPool *pool, void *old, size_t old_size, size_t new_size)
struct MHD_Response * MHD_create_response_from_buffer(size_t size, void *buffer, enum MHD_ResponseMemoryMode mode)
struct MHD_Connection * manual_timeout_tail
size_t continue_message_write_offset
#define REQUEST_MALFORMED
#define MHD_INVALID_SOCKET
#define MHD_SCKT_ERR_IS_EAGAIN_(err)
#define MHD_HTTP_NO_CONTENT
LogCallback uri_log_callback
static int socket_start_no_buffering(struct MHD_Connection *connection)
void MHD_destroy_response(struct MHD_Response *response)
time_t connection_timeout
int MHD_set_connection_option(struct MHD_Connection *connection, enum MHD_CONNECTION_OPTION option,...)
const char * MHD_lookup_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
void MHD_increment_response_rc(struct MHD_Response *response)
Methods for managing connections.
#define MHD_CONTENT_READER_END_OF_STREAM
int(* read_handler)(struct MHD_Connection *connection)
struct MHD_Connection * normal_timeout_head
static void get_date_string(char *date, size_t date_len)
const union MHD_ConnectionInfo * MHD_get_connection_info(struct MHD_Connection *connection, enum MHD_ConnectionInfoType info_type,...)
static int need_100_continue(struct MHD_Connection *connection)
#define MHD_HTTP_VERSION_1_1
internal shared structures
#define MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
UnescapeCallback unescape_callback
int MHD_tls_connection_shutdown(struct MHD_Connection *connection)
#define MHD_socket_last_strerr_()
static int try_grow_read_buffer(struct MHD_Connection *connection)
int MHD_queue_response(struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
internal monotonic clock functions implementations
int(* write_handler)(struct MHD_Connection *connection)
unsigned int connection_timeout_dummy
#define MHD_HTTP_BAD_REQUEST
struct MHD_Connection * connections_head
static int check_write_done(struct MHD_Connection *connection, enum MHD_CONNECTION_STATE next_state)
int MHD_connection_handle_idle(struct MHD_Connection *connection)
#define MHD_socket_strerr_(err)
static int process_broken_line(struct MHD_Connection *connection, char *line, enum MHD_ValueKind kind)
enum MHD_ResponseFlags flags
#define MHD_connection_finish_forward_(conn)
#define MHD_HTTP_METHOD_HEAD
static void parse_connection_headers(struct MHD_Connection *connection)
time_t MHD_monotonic_sec_counter(void)
Header for string manipulating helpers.
size_t write_buffer_append_offset
MHD_RequestCompletedCallback notify_completed
static int socket_start_extra_buffering(struct MHD_Connection *connection)
void MHD_set_http_callbacks_(struct MHD_Connection *connection)
#define MHD_HTTP_METHOD_PUT
int MHD_str_equal_caseless_(const char *str1, const char *str2)
#define DLL_remove(head, tail, element)
void * notify_completed_cls
static void process_request_body(struct MHD_Connection *connection)
#define MHD_HTTP_VERSION_1_0
TransmitCallback send_cls
#define EDLL_remove(head, tail, element)
int MHD_get_connection_values(struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls)
#define MHD_HTTP_INTERNAL_SERVER_ERROR
#define MHD_CONTENT_READER_END_WITH_ERROR
MHD_ContentReaderCallback crc
static int parse_initial_message_line(struct MHD_Connection *connection, char *line, size_t line_len)
MHD_PanicCallback mhd_panic
struct MHD_Connection * suspended_connections_tail
static int socket_start_normal_buffering(struct MHD_Connection *connection)
#define MHD_UNSIGNED_LONG_LONG_PRINTF
#define MHD_HTTP_PROCESSING
static int socket_flush_possible(struct MHD_Connection *connection)
static int socket_start_no_buffering_flush(struct MHD_Connection *connection)
static int do_write(struct MHD_Connection *connection)
size_t read_buffer_offset
static char * get_next_header_line(struct MHD_Connection *connection, size_t *line_len)
void * default_handler_cls
size_t MHD_strx_to_uint64_n_(const char *str, size_t maxlen, uint64_t *out_val)
#define MHD_SCKT_ERR_IS_EINTR_(err)
MHD_mutex_ cleanup_connection_mutex
#define CONNECTION_CLOSE_ERROR(c, emsg)
uint64_t current_chunk_size
Header for platform-independent locks abstraction.
struct MHD_HTTP_Header * headers_received
#define MHD_HTTP_SWITCHING_PROTOCOLS
struct MHD_Connection * connections_tail
_MHD_EXTERN const char * MHD_get_reason_phrase_for(unsigned int code)
int MHD_set_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value)
struct MHD_HTTP_Header * headers_received_tail
static int build_header_response(struct MHD_Connection *connection)
#define MHD_mutex_lock_chk_(pmutex)
#define MHD_HTTP_METHOD_POST
size_t MHD_str_to_uint64_(const char *str, uint64_t *out_val)
struct MHD_Connection * suspended_connections_head
memory pool; mostly used for efficient (de)allocation for each connection and bounding memory use for...