GNU libmicrohttpd  0.9.72
internal.h
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
27 #ifndef INTERNAL_H
28 #define INTERNAL_H
29 
30 #include "mhd_options.h"
31 #include "platform.h"
32 #include "microhttpd.h"
33 #include "mhd_assert.h"
34 
35 #ifdef HTTPS_SUPPORT
36 #include <gnutls/gnutls.h>
37 #if GNUTLS_VERSION_MAJOR >= 3
38 #include <gnutls/abstract.h>
39 #endif
40 #endif /* HTTPS_SUPPORT */
41 
42 #ifdef HAVE_STDBOOL_H
43 #include <stdbool.h>
44 #endif
45 
46 
47 #ifdef MHD_PANIC
48 /* Override any defined MHD_PANIC macro with proper one */
49 #undef MHD_PANIC
50 #endif /* MHD_PANIC */
51 
52 #ifdef HAVE_MESSAGES
58 #define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); \
59  BUILTIN_NOT_REACHED; } while (0)
60 #else
66 #define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); \
67  BUILTIN_NOT_REACHED; } while (0)
68 #endif
69 
70 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
71 #include "mhd_threads.h"
72 #endif
73 #include "mhd_locks.h"
74 #include "mhd_sockets.h"
75 #include "mhd_itc_types.h"
76 
77 
82 #define _MHD_MACRO_NO 0
83 
88 #define _MHD_MACRO_YES 1
89 
94 #define MHD_fd_close_chk_(fd) do { \
95  if ( (0 != close ((fd)) && (EBADF == errno)) ) \
96  MHD_PANIC (_ ("Failed to close FD.\n")); \
97 } while (0)
98 
99 /*
100 #define EXTRA_CHECKS _MHD_MACRO_NO
101  * Not used. Behaviour is controlled by _DEBUG/NDEBUG macros.
102  */
103 
104 #ifndef _MHD_DEBUG_CONNECT
109 #define _MHD_DEBUG_CONNECT _MHD_MACRO_NO
110 #endif /* ! _MHD_DEBUG_CONNECT */
111 
112 #ifndef _MHD_DEBUG_SEND_DATA
116 #define _MHD_DEBUG_SEND_DATA _MHD_MACRO_NO
117 #endif /* ! _MHD_DEBUG_SEND_DATA */
118 
119 #ifndef _MHD_DEBUG_CLOSE
124 #define _MHD_DEBUG_CLOSE _MHD_MACRO_NO
125 #endif /* ! _MHD_DEBUG_CLOSE */
126 
127 #define MHD_MAX(a,b) (((a)<(b)) ? (b) : (a))
128 #define MHD_MIN(a,b) (((a)<(b)) ? (a) : (b))
129 
130 
138 #define MHD_BUF_INC_SIZE 1024
139 
140 
145 
149 extern void *mhd_panic_cls;
150 
151 /* If we have Clang or gcc >= 4.5, use __buildin_unreachable() */
152 #if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= \
153  5)
154 #define BUILTIN_NOT_REACHED __builtin_unreachable ()
155 #elif defined(_MSC_FULL_VER)
156 #define BUILTIN_NOT_REACHED __assume (0)
157 #else
158 #define BUILTIN_NOT_REACHED
159 #endif
160 
161 #ifndef MHD_STATICSTR_LEN_
165 #define MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1)
166 #endif /* ! MHD_STATICSTR_LEN_ */
167 
168 
173 {
175  _MHD_OFF = false,
176  _MHD_ON = true
177 };
178 
179 
184 {
185 
191 
197 
203 
208 
213 
218 
223 };
224 
225 
230 {
235 
240 
245 
250 };
251 
252 
257 #define MHD_TEST_ALLOW_SUSPEND_RESUME 8192
258 
265 #define MAX_NONCE_LENGTH 129
266 
267 
273 {
274 
279  uint64_t nc;
280 
285  uint64_t nmask;
286 
291 
292 };
293 
294 #ifdef HAVE_MESSAGES
299 void
300 MHD_DLOG (const struct MHD_Daemon *daemon,
301  const char *format,
302  ...);
303 
304 #endif
305 
306 
310 struct MHD_HTTP_Header
311 {
315  struct MHD_HTTP_Header *next;
316 
320  char *header;
321 
325  size_t header_size;
326 
330  char *value;
331 
335  size_t value_size;
336 
341  enum MHD_ValueKind kind;
342 
343 };
344 
345 
349 struct MHD_Response
350 {
351 
358 
363  char *data;
364 
369  void *crc_cls;
370 
376 
382 
383 #ifdef UPGRADE_SUPPORT
389  MHD_UpgradeHandler upgrade_handler;
390 
394  void *upgrade_handler_cls;
395 #endif /* UPGRADE_SUPPORT */
396 
397 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
402  MHD_mutex_ mutex;
403 #endif
404 
408  uint64_t total_size;
409 
414  uint64_t data_start;
415 
419  uint64_t fd_off;
420 
425  size_t data_size;
426 
430  size_t data_buffer_size;
431 
436  unsigned int reference_count;
437 
441  int fd;
442 
447 
451  bool is_pipe;
452 
453 };
454 
455 
472 {
478 
483 
488 
493 
498 
503 
508 
513 
519 
525 
531 
536 
541 
547 
552 
557 
562 
567 
572 
577 
578 #ifdef UPGRADE_SUPPORT
583  MHD_CONNECTION_UPGRADE
584 #endif /* UPGRADE_SUPPORT */
585 
586 };
587 
588 
593 {
604 };
605 
609 #define DEBUG_STATES MHD_NO
610 
611 
612 #ifdef HAVE_MESSAGES
613 #if DEBUG_STATES
614 const char *
615 MHD_state_to_string (enum MHD_CONNECTION_STATE state);
616 
617 #endif
618 #endif
619 
628 typedef ssize_t
629 (*ReceiveCallback) (struct MHD_Connection *conn,
630  void *write_to,
631  size_t max_bytes);
632 
633 
642 typedef ssize_t
643 (*TransmitCallback) (struct MHD_Connection *conn,
644  const void *read_from,
645  size_t max_bytes);
646 
647 
652 {
657 
662 
667 };
668 
669 
673 struct MHD_Connection
674 {
675 
676 #ifdef EPOLL_SUPPORT
680  struct MHD_Connection *nextE;
681 
685  struct MHD_Connection *prevE;
686 #endif
687 
691  struct MHD_Connection *next;
692 
696  struct MHD_Connection *prev;
697 
705  struct MHD_Connection *nextX;
706 
710  struct MHD_Connection *prevX;
711 
715  struct MHD_Daemon *daemon;
716 
721 
726 
731 
740  struct MemoryPool *pool;
741 
749 
757  void *socket_context;
758 
762  char *method;
763 
768  const char *url;
769 
774  char *version;
775 
782 
788  char *read_buffer;
789 
795 
802  char *last;
803 
811  char *colon;
812 
817  struct sockaddr *addr;
818 
819 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
824  MHD_thread_handle_ID_ pid;
825 #endif
826 
834 
840 
845 
850 
856 
861  size_t header_size;
862 
868 
875 
876 #if defined(_MHD_HAVE_SENDFILE)
877  enum MHD_resp_sender_
878  {
879  MHD_resp_sender_std = 0,
880  MHD_resp_sender_sendfile
881  } resp_sender;
882 #endif /* _MHD_HAVE_SENDFILE */
883 
889 
893  socklen_t addr_len;
894 
899  time_t last_activity;
900 
905  time_t connection_timeout;
906 
911 
918 
925 
929  bool sk_nonblck;
930 
935 
939  enum MHD_tristate sk_corked;
940 
945 
952  bool read_closed;
953 
954 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
958  bool thread_joined;
959 #endif
960 
965  bool in_idle;
966 
972 
973 #ifdef EPOLL_SUPPORT
977  enum MHD_EpollState epoll_state;
978 #endif
979 
984 
989 
994  unsigned int responseCode;
995 
1004 
1012 
1018 
1023 
1024 #ifdef UPGRADE_SUPPORT
1031  struct MHD_UpgradeResponseHandle *urh;
1032 #endif /* UPGRADE_SUPPORT */
1033 
1034 #ifdef HTTPS_SUPPORT
1035 
1039  gnutls_session_t tls_session;
1040 
1044  int protocol;
1045 
1049  int cipher;
1050 
1054  enum MHD_TLS_CONN_STATE tls_state;
1055 
1060  bool tls_read_ready;
1061 #endif /* HTTPS_SUPPORT */
1062 
1066  bool suspended;
1067 
1072 
1076  volatile bool resuming;
1077 };
1078 
1079 
1080 #ifdef UPGRADE_SUPPORT
1090 #define RESERVE_EBUF_SIZE 8
1091 
1098 struct UpgradeEpollHandle
1099 {
1104  struct MHD_UpgradeResponseHandle *urh;
1105 
1121  MHD_socket socket;
1122 
1126  enum MHD_EpollState celi;
1127 
1128 };
1129 
1130 
1136 struct MHD_UpgradeResponseHandle
1137 {
1143  struct MHD_Connection *connection;
1144 
1145 #ifdef HTTPS_SUPPORT
1149  struct MHD_UpgradeResponseHandle *next;
1150 
1154  struct MHD_UpgradeResponseHandle *prev;
1155 
1156 #ifdef EPOLL_SUPPORT
1160  struct MHD_UpgradeResponseHandle *nextE;
1161 
1165  struct MHD_UpgradeResponseHandle *prevE;
1166 
1170  bool in_eready_list;
1171 #endif
1172 
1178  char *in_buffer;
1179 
1185  char *out_buffer;
1186 
1192  size_t in_buffer_size;
1193 
1199  size_t out_buffer_size;
1200 
1208  size_t in_buffer_used;
1209 
1217  size_t out_buffer_used;
1218 
1222  struct UpgradeEpollHandle app;
1223 
1228  struct UpgradeEpollHandle mhd;
1229 
1234  char e_buf[RESERVE_EBUF_SIZE];
1235 
1236 #endif /* HTTPS_SUPPORT */
1237 
1248  volatile bool was_closed;
1249 
1271  volatile bool clean_ready;
1272 };
1273 #endif /* UPGRADE_SUPPORT */
1274 
1275 
1284 typedef void *
1285 (*LogCallback)(void *cls,
1286  const char *uri,
1287  struct MHD_Connection *con);
1288 
1298 typedef size_t
1299 (*UnescapeCallback)(void *cls,
1300  struct MHD_Connection *conn,
1301  char *uri);
1302 
1303 
1311 struct MHD_Daemon
1312 {
1313 
1318 
1323 
1330  enum MHD_FLAG options;
1331 
1336 
1341 
1346 
1351 
1356 
1361 
1365  struct MHD_Connection *cleanup_head;
1366 
1370  struct MHD_Connection *cleanup_tail;
1371 
1372 #ifdef EPOLL_SUPPORT
1376  struct MHD_Connection *eready_head;
1377 
1381  struct MHD_Connection *eready_tail;
1382 
1389  int epoll_fd;
1390 
1395  bool listen_socket_in_epoll;
1396 
1397 #ifdef UPGRADE_SUPPORT
1398 #ifdef HTTPS_SUPPORT
1403  int epoll_upgrade_fd;
1404 
1409  bool upgrade_fd_in_epoll;
1410 #endif /* HTTPS_SUPPORT */
1411 
1415  struct MHD_UpgradeResponseHandle *eready_urh_head;
1416 
1420  struct MHD_UpgradeResponseHandle *eready_urh_tail;
1421 #endif /* UPGRADE_SUPPORT */
1422 #endif /* EPOLL_SUPPORT */
1423 
1439 
1446 
1454 
1461 
1467 
1471  void *apc_cls;
1472 
1478 
1483 
1489 
1494 
1503 
1508 
1513 
1518 
1525  uint16_t port;
1526 
1527 #ifdef HAVE_MESSAGES
1532  MHD_LogCallback custom_error_log;
1533 
1537  void *custom_error_log_cls;
1538 #endif
1539 
1543  struct MHD_Daemon *master;
1544 
1552 
1553 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1557  struct MHD_Daemon *worker_pool;
1558 #endif
1559 
1564 
1571  unsigned int connections;
1572 
1576  size_t pool_size;
1577 
1582 
1583 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1587  size_t thread_stack_size;
1588 
1592  unsigned int worker_pool_size;
1593 
1597  MHD_thread_handle_ID_ pid;
1598 
1602  MHD_mutex_ per_ip_connection_mutex;
1603 
1608  MHD_mutex_ cleanup_connection_mutex;
1609 
1613  MHD_mutex_ new_connections_mutex;
1614 #endif
1615 
1621 
1632 
1633 
1638  struct MHD_itc_ itc;
1639 
1643  volatile bool shutdown;
1644 
1650  volatile bool was_quiesced;
1651 
1659  bool at_limit;
1660 
1661  /*
1662  * Do we need to process resuming connections?
1663  */
1664  volatile bool resuming;
1665 
1670  volatile bool have_new;
1671 
1681  bool data_already_pending;
1682 
1686  unsigned int connection_limit;
1687 
1693 
1699 
1704 
1709 
1710 #ifdef HTTPS_SUPPORT
1711 #ifdef UPGRADE_SUPPORT
1717  struct MHD_UpgradeResponseHandle *urh_head;
1718 
1724  struct MHD_UpgradeResponseHandle *urh_tail;
1725 #endif /* UPGRADE_SUPPORT */
1726 
1730  gnutls_priority_t priority_cache;
1731 
1736  gnutls_credentials_type_t cred_type;
1737 
1741  gnutls_certificate_credentials_t x509_cred;
1742 
1746  gnutls_dh_params_t dh_params;
1747 
1751  gnutls_psk_server_credentials_t psk_cred;
1752 
1753 #if GNUTLS_VERSION_MAJOR >= 3
1758  gnutls_certificate_retrieve_function2 *cert_callback;
1759 
1763  MHD_PskServerCredentialsCallback cred_callback;
1764 
1768  void *cred_callback_cls;
1769 #endif
1770 
1771 #if GNUTLS_VERSION_NUMBER >= 0x030603
1776  gnutls_certificate_retrieve_function3 *cert_callback2;
1777 #endif
1778 
1782  const char *https_mem_key;
1783 
1787  const char *https_mem_cert;
1788 
1792  const char *https_key_password;
1793 
1797  const char *https_mem_trust;
1798 
1802  gnutls_dh_params_t https_mem_dhparams;
1803 
1807  bool have_dhparams;
1808 
1809 #endif /* HTTPS_SUPPORT */
1810 
1811 #ifdef DAUTH_SUPPORT
1812 
1816  const char *digest_auth_random;
1817 
1821  struct MHD_NonceNc *nnc;
1822 
1823 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1827  MHD_mutex_ nnc_lock;
1828 #endif
1829 
1833  size_t digest_auth_rand_size;
1834 
1838  unsigned int nonce_nc_size;
1839 
1840 #endif
1841 
1842 #ifdef TCP_FASTOPEN
1846  unsigned int fastopen_queue_size;
1847 #endif
1848 
1852  unsigned int listen_backlog_size;
1853 };
1854 
1855 
1864 #define DLL_insert(head,tail,element) do { \
1865  mhd_assert (NULL == (element)->next); \
1866  mhd_assert (NULL == (element)->prev); \
1867  (element)->next = (head); \
1868  (element)->prev = NULL; \
1869  if ((tail) == NULL) \
1870  (tail) = element; \
1871  else \
1872  (head)->prev = element; \
1873  (head) = (element); } while (0)
1874 
1875 
1885 #define DLL_remove(head,tail,element) do { \
1886  mhd_assert ( (NULL != (element)->next) || ((element) == (tail))); \
1887  mhd_assert ( (NULL != (element)->prev) || ((element) == (head))); \
1888  if ((element)->prev == NULL) \
1889  (head) = (element)->next; \
1890  else \
1891  (element)->prev->next = (element)->next; \
1892  if ((element)->next == NULL) \
1893  (tail) = (element)->prev; \
1894  else \
1895  (element)->next->prev = (element)->prev; \
1896  (element)->next = NULL; \
1897  (element)->prev = NULL; } while (0)
1898 
1899 
1908 #define XDLL_insert(head,tail,element) do { \
1909  mhd_assert (NULL == (element)->nextX); \
1910  mhd_assert (NULL == (element)->prevX); \
1911  (element)->nextX = (head); \
1912  (element)->prevX = NULL; \
1913  if (NULL == (tail)) \
1914  (tail) = element; \
1915  else \
1916  (head)->prevX = element; \
1917  (head) = (element); } while (0)
1918 
1919 
1929 #define XDLL_remove(head,tail,element) do { \
1930  mhd_assert ( (NULL != (element)->nextX) || ((element) == (tail))); \
1931  mhd_assert ( (NULL != (element)->prevX) || ((element) == (head))); \
1932  if (NULL == (element)->prevX) \
1933  (head) = (element)->nextX; \
1934  else \
1935  (element)->prevX->nextX = (element)->nextX; \
1936  if (NULL == (element)->nextX) \
1937  (tail) = (element)->prevX; \
1938  else \
1939  (element)->nextX->prevX = (element)->prevX; \
1940  (element)->nextX = NULL; \
1941  (element)->prevX = NULL; } while (0)
1942 
1943 
1952 #define EDLL_insert(head,tail,element) do { \
1953  (element)->nextE = (head); \
1954  (element)->prevE = NULL; \
1955  if ((tail) == NULL) \
1956  (tail) = element; \
1957  else \
1958  (head)->prevE = element; \
1959  (head) = (element); } while (0)
1960 
1961 
1971 #define EDLL_remove(head,tail,element) do { \
1972  if ((element)->prevE == NULL) \
1973  (head) = (element)->nextE; \
1974  else \
1975  (element)->prevE->nextE = (element)->nextE; \
1976  if ((element)->nextE == NULL) \
1977  (tail) = (element)->prevE; \
1978  else \
1979  (element)->nextE->prevE = (element)->prevE; \
1980  (element)->nextE = NULL; \
1981  (element)->prevE = NULL; } while (0)
1982 
1983 
1989 void
1990 MHD_unescape_plus (char *arg);
1991 
1992 
2006 typedef enum MHD_Result
2007 (*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
2008  const char *key,
2009  size_t key_size,
2010  const char *value,
2011  size_t value_size,
2012  enum MHD_ValueKind kind);
2013 
2014 
2029 enum MHD_Result
2030 MHD_parse_arguments_ (struct MHD_Connection *connection,
2031  enum MHD_ValueKind kind,
2032  char *args,
2034  unsigned int *num_headers);
2035 
2036 
2053 bool
2055  const char *key,
2056  size_t key_len,
2057  const char *token,
2058  size_t token_len);
2059 
2071 #define MHD_check_response_header_s_token_ci(r,k,tkn) \
2072  MHD_check_response_header_token_ci ((r),(k),MHD_STATICSTR_LEN_ (k), \
2073  (tkn),MHD_STATICSTR_LEN_ (tkn))
2074 
2075 
2085 void
2086 internal_suspend_connection_ (struct MHD_Connection *connection);
2087 
2088 #endif
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microhttpd.h:2131
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
Definition: microhttpd.h:1352
void(* MHD_NotifyConnectionCallback)(void *cls, struct MHD_Connection *connection, void **socket_context, enum MHD_ConnectionNotificationCode toe)
Definition: microhttpd.h:2239
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
Definition: microhttpd.h:2213
void(* MHD_ContentReaderFreeCallback)(void *cls)
Definition: microhttpd.h:2355
MHD_PanicCallback mhd_panic
Definition: panic.c:31
ssize_t(* TransmitCallback)(struct MHD_Connection *conn, const void *read_from, size_t max_bytes)
Definition: internal.h:196
MHD_EpollState
Definition: internal.h:588
@ MHD_EPOLL_STATE_SUSPENDED
Definition: internal.h:621
@ MHD_EPOLL_STATE_IN_EREADY_EDLL
Definition: internal.h:611
@ MHD_EPOLL_STATE_READ_READY
Definition: internal.h:600
@ MHD_EPOLL_STATE_IN_EPOLL_SET
Definition: internal.h:616
@ MHD_EPOLL_STATE_UNREADY
Definition: internal.h:594
@ MHD_EPOLL_STATE_WRITE_READY
Definition: internal.h:606
@ MHD_EPOLL_STATE_ERROR
Definition: internal.h:626
bool(* MHD_ArgumentIterator_)(struct MHD_Request *request, const char *key, const char *value, enum MHD_ValueKind kind)
Definition: internal.h:1707
MHD_ConnKeepAlive
Definition: internal.h:155
@ MHD_CONN_USE_KEEPALIVE
Definition: internal.h:169
@ MHD_CONN_MUST_CLOSE
Definition: internal.h:159
@ MHD_CONN_KEEPALIVE_UNKOWN
Definition: internal.h:164
ssize_t(* ReceiveCallback)(struct MHD_Connection *conn, void *write_to, size_t max_bytes)
Definition: internal.h:182
bool MHD_parse_arguments_(struct MHD_Request *request, enum MHD_ValueKind kind, char *args, MHD_ArgumentIterator_ cb, unsigned int *num_headers)
Definition: internal.c:190
void * mhd_panic_cls
Definition: panic.c:36
additional automatic macros for MHD_config.h
MHD_CONNECTION_STATE
Definition: internal.h:472
@ MHD_CONNECTION_BODY_RECEIVED
Definition: internal.h:512
@ MHD_CONNECTION_HEADER_PART_RECEIVED
Definition: internal.h:487
@ MHD_CONNECTION_HEADERS_SENDING
Definition: internal.h:530
@ MHD_CONNECTION_FOOTERS_SENDING
Definition: internal.h:566
@ MHD_CONNECTION_FOOTERS_RECEIVED
Definition: internal.h:524
@ MHD_CONNECTION_HEADERS_SENT
Definition: internal.h:535
@ MHD_CONNECTION_HEADERS_PROCESSED
Definition: internal.h:497
@ MHD_CONNECTION_INIT
Definition: internal.h:477
@ MHD_CONNECTION_CLOSED
Definition: internal.h:576
@ MHD_CONNECTION_NORMAL_BODY_UNREADY
Definition: internal.h:546
@ MHD_CONNECTION_HEADERS_RECEIVED
Definition: internal.h:492
@ MHD_CONNECTION_NORMAL_BODY_READY
Definition: internal.h:540
@ MHD_CONNECTION_CHUNKED_BODY_READY
Definition: internal.h:551
@ MHD_CONNECTION_FOOTER_PART_RECEIVED
Definition: internal.h:518
@ MHD_CONNECTION_CONTINUE_SENT
Definition: internal.h:507
@ MHD_CONNECTION_FOOTERS_SENT
Definition: internal.h:571
@ MHD_CONNECTION_CHUNKED_BODY_UNREADY
Definition: internal.h:556
@ MHD_CONNECTION_BODY_SENT
Definition: internal.h:561
@ MHD_CONNECTION_CONTINUE_SENDING
Definition: internal.h:502
@ MHD_CONNECTION_URL_RECEIVED
Definition: internal.h:482
bool MHD_check_response_header_token_ci(const struct MHD_Response *response, const char *key, size_t key_len, const char *token, size_t token_len)
Definition: response.c:323
void internal_suspend_connection_(struct MHD_Connection *connection)
Definition: daemon.c:2999
MHD_TLS_CONN_STATE
Definition: internal.h:593
@ MHD_TLS_CONN_TLS_CLOSING
Definition: internal.h:600
@ MHD_TLS_CONN_WR_CLOSING
Definition: internal.h:598
@ MHD_TLS_CONN_INVALID_STATE
Definition: internal.h:603
@ MHD_TLS_CONN_WR_CLOSED
Definition: internal.h:599
@ MHD_TLS_CONN_NO_TLS
Definition: internal.h:594
@ MHD_TLS_CONN_INIT
Definition: internal.h:595
@ MHD_TLS_CONN_TLS_CLOSED
Definition: internal.h:601
@ MHD_TLS_CONN_TLS_FAILED
Definition: internal.h:602
@ MHD_TLS_CONN_CONNECTED
Definition: internal.h:597
@ MHD_TLS_CONN_HANDSHAKING
Definition: internal.h:596
MHD_ConnectionEventLoopInfo
Definition: internal.h:230
@ MHD_EVENT_LOOP_INFO_READ
Definition: internal.h:234
@ MHD_EVENT_LOOP_INFO_WRITE
Definition: internal.h:239
@ MHD_EVENT_LOOP_INFO_CLEANUP
Definition: internal.h:249
@ MHD_EVENT_LOOP_INFO_BLOCK
Definition: internal.h:244
#define MAX_NONCE_LENGTH
Definition: internal.h:265
void MHD_unescape_plus(char *arg)
Definition: internal.c:123
void *(* LogCallback)(void *cls, const char *uri, struct MHD_Connection *con)
Definition: internal.h:1285
size_t(* UnescapeCallback)(void *cls, struct MHD_Connection *conn, char *uri)
Definition: internal.h:1299
MHD_tristate
Definition: internal.h:173
@ _MHD_ON
Definition: internal.h:176
@ _MHD_UNKNOWN
Definition: internal.h:174
@ _MHD_OFF
Definition: internal.h:175
macros for mhd_assert()
Types for platform-independent inter-thread communication.
Header for platform-independent locks abstraction.
public interface to libmicrohttpd
int MHD_socket
Definition: microhttpd.h:196
void(* MHD_UpgradeHandler)(void *cls, struct MHD_Connection *connection, void *con_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, struct MHD_UpgradeResponseHandle *urh)
Definition: microhttpd.h:3333
MHD_DisableSanityCheck
Definition: microhttpd.h:1740
MHD_Result
Definition: microhttpd.h:142
enum MHD_Result(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
Definition: microhttpd.h:2145
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
Definition: microhttpd.h:2339
enum MHD_Result(* MHD_AccessHandlerCallback)(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
Definition: microhttpd.h:2190
MHD_ValueKind
Definition: microhttpd.h:1781
int(* MHD_PskServerCredentialsCallback)(void *cls, const struct MHD_Connection *connection, const char *username, void **psk, size_t *psk_size)
Definition: microhttpd.h:1370
MHD_FLAG
Flags for the struct MHD_Daemon.
Definition: microhttpd.h:1053
MHD_ResponseFlags
Definition: microhttpd.h:2952
platform-specific includes for libmicrohttpd
MHD_socket socket_fd
Definition: internal.h:752
enum MHD_tristate sk_nodelay
Definition: internal.h:944
size_t write_buffer_size
Definition: internal.h:844
size_t write_buffer_send_offset
Definition: internal.h:849
struct MHD_Connection * prevX
Definition: internal.h:670
socklen_t addr_len
Definition: internal.h:733
enum MHD_ConnectionEventLoopInfo event_loop_info
Definition: internal.h:988
size_t write_buffer_append_offset
Definition: internal.h:855
char * last
Definition: internal.h:802
char * write_buffer
Definition: internal.h:794
bool tls_read_ready
Definition: internal.h:769
uint64_t remaining_upload_size
Definition: internal.h:867
void * socket_context
Definition: internal.h:694
bool suspended
Definition: internal.h:764
ReceiveCallback recv_cls
Definition: internal.h:706
char * colon
Definition: internal.h:811
volatile bool resuming
Definition: internal.h:1076
size_t header_size
Definition: internal.h:861
struct MHD_Response * response
Definition: internal.h:730
const char * url
Definition: internal.h:768
char * version
Definition: internal.h:774
bool sk_nonblck
Definition: internal.h:784
struct MHD_Connection * next
Definition: internal.h:651
enum MHD_ConnKeepAlive keepalive
Definition: internal.h:781
time_t connection_timeout
Definition: internal.h:745
struct MHD_HTTP_Header * headers_received
Definition: internal.h:720
size_t continue_message_write_offset
Definition: internal.h:888
uint64_t response_write_position
Definition: internal.h:874
struct MHD_HTTP_Header * headers_received_tail
Definition: internal.h:725
char * method
Definition: internal.h:762
uint64_t current_chunk_offset
Definition: internal.h:1017
struct MemoryPool * pool
Definition: internal.h:685
size_t read_buffer_offset
Definition: internal.h:839
struct MHD_Connection * prev
Definition: internal.h:656
uint64_t current_chunk_size
Definition: internal.h:1011
int suspended_dummy
Definition: internal.h:1071
bool client_aware
Definition: internal.h:917
unsigned int responseCode
Definition: internal.h:994
MHD_thread_handle_ID_ pid
Definition: internal.h:723
struct MHD_Connection * nextX
Definition: internal.h:665
bool have_chunked_upload
Definition: internal.h:1003
bool read_closed
Definition: internal.h:792
time_t last_activity
Definition: internal.h:739
bool in_cleanup
Definition: internal.h:971
void * client_context
Definition: internal.h:748
enum MHD_CONNECTION_STATE state
Definition: internal.h:983
char * read_buffer
Definition: internal.h:788
struct sockaddr * addr
Definition: internal.h:817
struct MHD_Daemon * daemon
Definition: internal.h:675
unsigned int connection_timeout_dummy
Definition: internal.h:910
bool sk_spipe_suppress
Definition: internal.h:934
size_t read_buffer_size
Definition: internal.h:833
enum MHD_tristate sk_corked
Definition: internal.h:939
bool thread_joined
Definition: internal.h:779
size_t pool_size
Definition: internal.h:1576
MHD_NotifyConnectionCallback notify_connection
Definition: internal.h:1488
MHD_AccessHandlerCallback default_handler
Definition: internal.h:1317
LogCallback uri_log_callback
Definition: internal.h:1502
bool data_already_pending
Definition: internal.h:1500
MHD_mutex_ per_ip_connection_mutex
Definition: internal.h:1259
void * per_ip_connection_count
Definition: internal.h:1187
bool at_limit
Definition: internal.h:1483
struct MHD_Connection * new_connections_tail
Definition: internal.h:1340
uint16_t port
Definition: internal.h:1525
unsigned int connection_limit
Definition: internal.h:1686
void * unescape_callback_cls
Definition: internal.h:1517
MHD_mutex_ cleanup_connection_mutex
Definition: internal.h:1265
enum MHD_DisableSanityCheck insanity_level
Definition: internal.h:1620
struct MHD_Connection * connections_head
Definition: internal.h:1155
unsigned int listen_backlog_size
Definition: internal.h:1852
MHD_RequestCompletedCallback notify_completed
Definition: internal.h:1477
unsigned int worker_pool_size
Definition: internal.h:1366
unsigned int connections
Definition: internal.h:1361
struct MHD_itc_ itc
Definition: internal.h:1410
int listening_address_reuse
Definition: internal.h:1631
void * apc_cls
Definition: internal.h:1471
unsigned int per_ip_connection_limit
Definition: internal.h:1698
struct MHD_Connection * manual_timeout_tail
Definition: internal.h:1150
volatile bool shutdown
Definition: internal.h:1526
enum MHD_FLAG options
Definition: internal.h:1330
void * notify_connection_cls
Definition: internal.h:1493
bool sigpipe_blocked
Definition: internal.h:1708
UnescapeCallback unescape_callback
Definition: internal.h:1512
void * notify_completed_cls
Definition: internal.h:1482
struct MHD_Connection * cleanup_tail
Definition: internal.h:1182
volatile bool was_quiesced
Definition: internal.h:1650
struct MHD_Daemon * worker_pool
Definition: internal.h:1073
struct MHD_Connection * new_connections_head
Definition: internal.h:1335
MHD_thread_handle_ID_ pid
Definition: internal.h:1249
struct MHD_Connection * manual_timeout_head
Definition: internal.h:1143
volatile bool resuming
Definition: internal.h:1664
void * default_handler_cls
Definition: internal.h:1322
struct MHD_Connection * suspended_connections_tail
Definition: internal.h:1172
time_t connection_timeout
Definition: internal.h:1692
MHD_AcceptPolicyCallback apc
Definition: internal.h:1466
struct MHD_Connection * cleanup_head
Definition: internal.h:1177
struct MHD_Daemon * master
Definition: internal.h:1068
struct MHD_Connection * normal_timeout_head
Definition: internal.h:1128
struct MHD_Connection * normal_timeout_tail
Definition: internal.h:1135
volatile bool have_new
Definition: internal.h:1670
size_t pool_increment
Definition: internal.h:1581
MHD_socket listen_fd
Definition: internal.h:1551
void * uri_log_callback_cls
Definition: internal.h:1507
struct MHD_Connection * suspended_connections_head
Definition: internal.h:1166
struct MHD_Connection * connections_tail
Definition: internal.h:1160
int strict_for_client
Definition: internal.h:1703
size_t value_size
Definition: internal.h:335
char * header
Definition: internal.h:347
enum MHD_ValueKind kind
Definition: internal.h:358
size_t header_size
Definition: internal.h:325
struct MHD_HTTP_Header * next
Definition: internal.h:342
char * value
Definition: internal.h:352
uint64_t nc
Definition: internal.h:279
uint64_t nmask
Definition: internal.h:285
char nonce[MAX_NONCE_LENGTH]
Definition: internal.h:290
MHD_ContentReaderFreeCallback crfc
Definition: internal.h:1606
struct MHD_HTTP_Header * first_header
Definition: internal.h:1582
void * crc_cls
Definition: internal.h:1594
size_t data_buffer_size
Definition: internal.h:1664
uint64_t data_start
Definition: internal.h:1648
MHD_ContentReaderCallback crc
Definition: internal.h:1600
bool is_pipe
Definition: internal.h:451
size_t data_size
Definition: internal.h:1659
enum MHD_ResponseFlags flags
Definition: internal.h:446
unsigned int reference_count
Definition: internal.h:1675
char * data
Definition: internal.h:1588
MHD_mutex_ mutex
Definition: internal.h:1637
uint64_t total_size
Definition: internal.h:1642
uint64_t fd_off
Definition: internal.h:1653