GNU libmicrohttpd  0.9.73
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
53 
58 #define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); \
59  BUILTIN_NOT_REACHED; } while (0)
60 #else
61 
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  } \
98 } while (0)
99 
100 /*
101 #define EXTRA_CHECKS _MHD_MACRO_NO
102  * Not used. Behaviour is controlled by _DEBUG/NDEBUG macros.
103  */
104 
105 #ifndef _MHD_DEBUG_CONNECT
106 
110 #define _MHD_DEBUG_CONNECT _MHD_MACRO_NO
111 #endif /* ! _MHD_DEBUG_CONNECT */
112 
113 #ifndef _MHD_DEBUG_SEND_DATA
114 
117 #define _MHD_DEBUG_SEND_DATA _MHD_MACRO_NO
118 #endif /* ! _MHD_DEBUG_SEND_DATA */
119 
120 #ifndef _MHD_DEBUG_CLOSE
121 
125 #define _MHD_DEBUG_CLOSE _MHD_MACRO_NO
126 #endif /* ! _MHD_DEBUG_CLOSE */
127 
128 #define MHD_MAX(a,b) (((a)<(b)) ? (b) : (a))
129 #define MHD_MIN(a,b) (((a)<(b)) ? (a) : (b))
130 
131 
139 #define MHD_BUF_INC_SIZE 1024
140 
141 
146 
150 extern void *mhd_panic_cls;
151 
152 /* If we have Clang or gcc >= 4.5, use __buildin_unreachable() */
153 #if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= \
154  5)
155 #define BUILTIN_NOT_REACHED __builtin_unreachable ()
156 #elif defined(_MSC_FULL_VER)
157 #define BUILTIN_NOT_REACHED __assume (0)
158 #else
159 #define BUILTIN_NOT_REACHED
160 #endif
161 
162 #ifndef MHD_STATICSTR_LEN_
163 
166 #define MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1)
167 #endif /* ! MHD_STATICSTR_LEN_ */
168 
169 
174 {
176  _MHD_OFF = false,
177  _MHD_NO = false,
178  _MHD_ON = true,
179  _MHD_YES = true
180 };
181 
182 
187 {
188 
194 
200 
206 
211 
216 
221 
226 };
227 
228 
233 {
238 
243 
248 
253 };
254 
255 
260 #define MHD_TEST_ALLOW_SUSPEND_RESUME 8192
261 
268 #define MAX_NONCE_LENGTH 129
269 
270 
276 {
277 
282  uint64_t nc;
283 
288  uint64_t nmask;
289 
294 
295 };
296 
297 #ifdef HAVE_MESSAGES
298 
302 void
303 MHD_DLOG (const struct MHD_Daemon *daemon,
304  const char *format,
305  ...);
306 
307 #endif
308 
309 
313 struct MHD_HTTP_Header
314 {
318  struct MHD_HTTP_Header *next;
319 
323  char *header;
324 
328  size_t header_size;
329 
333  char *value;
334 
338  size_t value_size;
339 
344  enum MHD_ValueKind kind;
345 
346 };
347 
348 
349 #if defined(MHD_WINSOCK_SOCKETS)
350 
354 typedef struct _MHD_W32_iovec
355 {
356  unsigned long iov_len;
357  char *iov_base;
358 } MHD_iovec_;
359 #define MHD_IOV_ELMN_MAX_SIZE ULONG_MAX
360 typedef unsigned long MHD_iov_size_;
361 #elif defined(HAVE_SENDMSG) || defined(HAVE_WRITEV)
362 
366 typedef struct iovec MHD_iovec_;
367 #define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX
368 typedef size_t MHD_iov_size_;
369 #else
370 
374 typedef struct MHD_IoVec MHD_iovec_;
375 #define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX
376 typedef size_t MHD_iov_size_;
377 #endif
378 
379 
381 {
388 
393  size_t cnt;
394 
400  size_t sent;
401 };
402 
406 struct MHD_Response
407 {
408 
415 
420  char *data;
421 
426  void *crc_cls;
427 
433 
439 
440 #ifdef UPGRADE_SUPPORT
441 
446  MHD_UpgradeHandler upgrade_handler;
447 
451  void *upgrade_handler_cls;
452 #endif /* UPGRADE_SUPPORT */
453 
454 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
455 
459  MHD_mutex_ mutex;
460 #endif
461 
465  uint64_t total_size;
466 
471  uint64_t data_start;
472 
476  uint64_t fd_off;
477 
482  size_t data_size;
483 
487  size_t data_buffer_size;
488 
493  unsigned int reference_count;
494 
498  int fd;
499 
504 
508  bool is_pipe;
509 
514 
518  unsigned int data_iovcnt;
519 };
520 
521 
538 {
544 
549 
554 
559 
564 
569 
574 
579 
585 
591 
597 
602 
607 
613 
618 
623 
628 
633 
638 
643 
644 #ifdef UPGRADE_SUPPORT
645 
649  MHD_CONNECTION_UPGRADE
650 #endif /* UPGRADE_SUPPORT */
651 
652 };
653 
654 
659 {
670 };
671 
675 #define DEBUG_STATES MHD_NO
676 
677 
678 #ifdef HAVE_MESSAGES
679 #if DEBUG_STATES
680 const char *
681 MHD_state_to_string (enum MHD_CONNECTION_STATE state);
682 
683 #endif
684 #endif
685 
694 typedef ssize_t
695 (*ReceiveCallback) (struct MHD_Connection *conn,
696  void *write_to,
697  size_t max_bytes);
698 
699 
708 typedef ssize_t
709 (*TransmitCallback) (struct MHD_Connection *conn,
710  const void *read_from,
711  size_t max_bytes);
712 
713 
718 {
723 
728 
733 };
734 
735 
739 struct MHD_Connection
740 {
741 
742 #ifdef EPOLL_SUPPORT
743 
746  struct MHD_Connection *nextE;
747 
751  struct MHD_Connection *prevE;
752 #endif
753 
757  struct MHD_Connection *next;
758 
762  struct MHD_Connection *prev;
763 
771  struct MHD_Connection *nextX;
772 
776  struct MHD_Connection *prevX;
777 
781  struct MHD_Daemon *daemon;
782 
787 
792 
797 
806  struct MemoryPool *pool;
807 
815 
823  void *socket_context;
824 
828  char *method;
829 
834  const char *url;
835 
840  char *version;
841 
848 
854  char *read_buffer;
855 
861 
868  char *last;
869 
877  char *colon;
878 
883  struct sockaddr *addr;
884 
885 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
886 
890  MHD_thread_handle_ID_ pid;
891 #endif
892 
900 
906 
911 
916 
922 
927  size_t header_size;
928 
934 
941 
948  struct MHD_iovec_track_ resp_iov;
949 
950 
951 #if defined(_MHD_HAVE_SENDFILE)
952  enum MHD_resp_sender_
953  {
954  MHD_resp_sender_std = 0,
955  MHD_resp_sender_sendfile
956  } resp_sender;
957 #endif /* _MHD_HAVE_SENDFILE */
958 
964 
968  socklen_t addr_len;
969 
974  time_t last_activity;
975 
980  time_t connection_timeout;
981 
986 
993 
1000 
1005  enum MHD_tristate is_nonip;
1006 
1010  bool sk_nonblck;
1011 
1016 
1020  enum MHD_tristate sk_corked;
1021 
1025  enum MHD_tristate sk_nodelay;
1026 
1033  bool read_closed;
1034 
1035 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1036 
1039  bool thread_joined;
1040 #endif
1041 
1046  bool in_idle;
1047 
1053 
1054 #ifdef EPOLL_SUPPORT
1055 
1058  enum MHD_EpollState epoll_state;
1059 #endif
1060 
1065 
1070 
1075  unsigned int responseCode;
1076 
1085 
1093 
1099 
1104 
1105 #ifdef UPGRADE_SUPPORT
1106 
1112  struct MHD_UpgradeResponseHandle *urh;
1113 #endif /* UPGRADE_SUPPORT */
1114 
1115 #ifdef HTTPS_SUPPORT
1116 
1120  gnutls_session_t tls_session;
1121 
1125  int protocol;
1126 
1130  int cipher;
1131 
1135  enum MHD_TLS_CONN_STATE tls_state;
1136 
1141  bool tls_read_ready;
1142 #endif /* HTTPS_SUPPORT */
1143 
1147  bool suspended;
1148 
1153 
1157  volatile bool resuming;
1158 };
1159 
1160 
1161 #ifdef UPGRADE_SUPPORT
1162 
1171 #define RESERVE_EBUF_SIZE 8
1172 
1179 struct UpgradeEpollHandle
1180 {
1185  struct MHD_UpgradeResponseHandle *urh;
1186 
1202  MHD_socket socket;
1203 
1207  enum MHD_EpollState celi;
1208 
1209 };
1210 
1211 
1217 struct MHD_UpgradeResponseHandle
1218 {
1224  struct MHD_Connection *connection;
1225 
1226 #ifdef HTTPS_SUPPORT
1227 
1230  struct MHD_UpgradeResponseHandle *next;
1231 
1235  struct MHD_UpgradeResponseHandle *prev;
1236 
1237 #ifdef EPOLL_SUPPORT
1238 
1241  struct MHD_UpgradeResponseHandle *nextE;
1242 
1246  struct MHD_UpgradeResponseHandle *prevE;
1247 
1251  bool in_eready_list;
1252 #endif
1253 
1259  char *in_buffer;
1260 
1266  char *out_buffer;
1267 
1273  size_t in_buffer_size;
1274 
1280  size_t out_buffer_size;
1281 
1289  size_t in_buffer_used;
1290 
1298  size_t out_buffer_used;
1299 
1303  struct UpgradeEpollHandle app;
1304 
1309  struct UpgradeEpollHandle mhd;
1310 
1315  char e_buf[RESERVE_EBUF_SIZE];
1316 
1317 #endif /* HTTPS_SUPPORT */
1318 
1329  volatile bool was_closed;
1330 
1352  volatile bool clean_ready;
1353 };
1354 #endif /* UPGRADE_SUPPORT */
1355 
1356 
1365 typedef void *
1366 (*LogCallback)(void *cls,
1367  const char *uri,
1368  struct MHD_Connection *con);
1369 
1379 typedef size_t
1380 (*UnescapeCallback)(void *cls,
1381  struct MHD_Connection *conn,
1382  char *uri);
1383 
1384 
1392 struct MHD_Daemon
1393 {
1394 
1399 
1404 
1411  enum MHD_FLAG options;
1412 
1417 
1422 
1427 
1432 
1437 
1442 
1446  struct MHD_Connection *cleanup_head;
1447 
1452 
1457 
1458 #ifdef EPOLL_SUPPORT
1459 
1462  struct MHD_Connection *eready_head;
1463 
1467  struct MHD_Connection *eready_tail;
1468 
1475  int epoll_fd;
1476 
1481  bool listen_socket_in_epoll;
1482 
1483 #ifdef UPGRADE_SUPPORT
1484 #ifdef HTTPS_SUPPORT
1485 
1489  int epoll_upgrade_fd;
1490 
1495  bool upgrade_fd_in_epoll;
1496 #endif /* HTTPS_SUPPORT */
1497 
1501  struct MHD_UpgradeResponseHandle *eready_urh_head;
1502 
1506  struct MHD_UpgradeResponseHandle *eready_urh_tail;
1507 #endif /* UPGRADE_SUPPORT */
1508 #endif /* EPOLL_SUPPORT */
1509 
1525 
1532 
1540 
1547 
1553 
1557  void *apc_cls;
1558 
1564 
1569 
1575 
1580 
1589 
1594 
1599 
1604 
1611  uint16_t port;
1612 
1613 #ifdef HAVE_MESSAGES
1614 
1618  MHD_LogCallback custom_error_log;
1619 
1623  void *custom_error_log_cls;
1624 #endif
1625 
1629  struct MHD_Daemon *master;
1630 
1638 
1639 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1640 
1643  struct MHD_Daemon *worker_pool;
1644 #endif
1645 
1650 
1657  unsigned int connections;
1658 
1662  size_t pool_size;
1663 
1668 
1669 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1670 
1673  size_t thread_stack_size;
1674 
1678  unsigned int worker_pool_size;
1679 
1683  MHD_thread_handle_ID_ pid;
1684 
1688  MHD_mutex_ per_ip_connection_mutex;
1689 
1694  MHD_mutex_ cleanup_connection_mutex;
1695 
1699  MHD_mutex_ new_connections_mutex;
1700 #endif
1701 
1707 
1718 
1719 
1724  struct MHD_itc_ itc;
1725 
1729  volatile bool shutdown;
1730 
1736  volatile bool was_quiesced;
1737 
1745  bool at_limit;
1746 
1747  /*
1748  * Do we need to process resuming connections?
1749  */
1750  volatile bool resuming;
1751 
1756  volatile bool have_new;
1757 
1767  bool data_already_pending;
1768 
1772  unsigned int connection_limit;
1773 
1779 
1785 
1790 
1795 
1796 #ifdef HTTPS_SUPPORT
1797 #ifdef UPGRADE_SUPPORT
1798 
1803  struct MHD_UpgradeResponseHandle *urh_head;
1804 
1810  struct MHD_UpgradeResponseHandle *urh_tail;
1811 #endif /* UPGRADE_SUPPORT */
1812 
1816  gnutls_priority_t priority_cache;
1817 
1822  gnutls_credentials_type_t cred_type;
1823 
1827  gnutls_certificate_credentials_t x509_cred;
1828 
1832  gnutls_dh_params_t dh_params;
1833 
1837  gnutls_psk_server_credentials_t psk_cred;
1838 
1839 #if GNUTLS_VERSION_MAJOR >= 3
1840 
1844  gnutls_certificate_retrieve_function2 *cert_callback;
1845 
1849  MHD_PskServerCredentialsCallback cred_callback;
1850 
1854  void *cred_callback_cls;
1855 #endif
1856 
1857 #if GNUTLS_VERSION_NUMBER >= 0x030603
1858 
1862  gnutls_certificate_retrieve_function3 *cert_callback2;
1863 #endif
1864 
1868  const char *https_mem_key;
1869 
1873  const char *https_mem_cert;
1874 
1878  const char *https_key_password;
1879 
1883  const char *https_mem_trust;
1884 
1888  gnutls_dh_params_t https_mem_dhparams;
1889 
1893  bool have_dhparams;
1894 
1898  bool disable_alpn;
1899 
1900  #endif /* HTTPS_SUPPORT */
1901 
1902 #ifdef DAUTH_SUPPORT
1903 
1907  const char *digest_auth_random;
1908 
1912  struct MHD_NonceNc *nnc;
1913 
1914 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1915 
1918  MHD_mutex_ nnc_lock;
1919 #endif
1920 
1924  size_t digest_auth_rand_size;
1925 
1929  unsigned int nonce_nc_size;
1930 
1931 #endif
1932 
1933 #ifdef TCP_FASTOPEN
1934 
1937  unsigned int fastopen_queue_size;
1938 #endif
1939 
1943  unsigned int listen_backlog_size;
1944 
1952  size_t num_opts;
1953 };
1954 
1955 
1964 #define DLL_insert(head,tail,element) do { \
1965  mhd_assert (NULL == (element)->next); \
1966  mhd_assert (NULL == (element)->prev); \
1967  (element)->next = (head); \
1968  (element)->prev = NULL; \
1969  if ((tail) == NULL) { \
1970  (tail) = element; \
1971  } else { \
1972  (head)->prev = element; \
1973  } \
1974  (head) = (element); } while (0)
1975 
1976 
1986 #define DLL_remove(head,tail,element) do { \
1987  mhd_assert ( (NULL != (element)->next) || ((element) == (tail))); \
1988  mhd_assert ( (NULL != (element)->prev) || ((element) == (head))); \
1989  if ((element)->prev == NULL) { \
1990  (head) = (element)->next; \
1991  } else { \
1992  (element)->prev->next = (element)->next; \
1993  } \
1994  if ((element)->next == NULL) { \
1995  (tail) = (element)->prev; \
1996  } else { \
1997  (element)->next->prev = (element)->prev; \
1998  } \
1999  (element)->next = NULL; \
2000  (element)->prev = NULL; } while (0)
2001 
2002 
2011 #define XDLL_insert(head,tail,element) do { \
2012  mhd_assert (NULL == (element)->nextX); \
2013  mhd_assert (NULL == (element)->prevX); \
2014  (element)->nextX = (head); \
2015  (element)->prevX = NULL; \
2016  if (NULL == (tail)) { \
2017  (tail) = element; \
2018  } else { \
2019  (head)->prevX = element; \
2020  } \
2021  (head) = (element); } while (0)
2022 
2023 
2033 #define XDLL_remove(head,tail,element) do { \
2034  mhd_assert ( (NULL != (element)->nextX) || ((element) == (tail))); \
2035  mhd_assert ( (NULL != (element)->prevX) || ((element) == (head))); \
2036  if (NULL == (element)->prevX) { \
2037  (head) = (element)->nextX; \
2038  } else { \
2039  (element)->prevX->nextX = (element)->nextX; \
2040  } \
2041  if (NULL == (element)->nextX) { \
2042  (tail) = (element)->prevX; \
2043  } else { \
2044  (element)->nextX->prevX = (element)->prevX; \
2045  } \
2046  (element)->nextX = NULL; \
2047  (element)->prevX = NULL; } while (0)
2048 
2049 
2058 #define EDLL_insert(head,tail,element) do { \
2059  (element)->nextE = (head); \
2060  (element)->prevE = NULL; \
2061  if ((tail) == NULL) { \
2062  (tail) = element; \
2063  } else { \
2064  (head)->prevE = element; \
2065  } \
2066  (head) = (element); } while (0)
2067 
2068 
2078 #define EDLL_remove(head,tail,element) do { \
2079  if ((element)->prevE == NULL) { \
2080  (head) = (element)->nextE; \
2081  } else { \
2082  (element)->prevE->nextE = (element)->nextE; \
2083  } \
2084  if ((element)->nextE == NULL) { \
2085  (tail) = (element)->prevE; \
2086  } else { \
2087  (element)->nextE->prevE = (element)->prevE; \
2088  } \
2089  (element)->nextE = NULL; \
2090  (element)->prevE = NULL; } while (0)
2091 
2092 
2098 void
2099 MHD_unescape_plus (char *arg);
2100 
2101 
2115 typedef enum MHD_Result
2116 (*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
2117  const char *key,
2118  size_t key_size,
2119  const char *value,
2120  size_t value_size,
2121  enum MHD_ValueKind kind);
2122 
2123 
2138 enum MHD_Result
2139 MHD_parse_arguments_ (struct MHD_Connection *connection,
2140  enum MHD_ValueKind kind,
2141  char *args,
2143  unsigned int *num_headers);
2144 
2145 
2162 bool
2164  const char *key,
2165  size_t key_len,
2166  const char *token,
2167  size_t token_len);
2168 
2180 #define MHD_check_response_header_s_token_ci(r,k,tkn) \
2181  MHD_check_response_header_token_ci ((r),(k),MHD_STATICSTR_LEN_ (k), \
2182  (tkn),MHD_STATICSTR_LEN_ (tkn))
2183 
2184 
2194 void
2195 internal_suspend_connection_ (struct MHD_Connection *connection);
2196 
2197 #endif
MHD_Response::first_header
struct MHD_HTTP_Header * first_header
Definition: internal.h:1582
MHD_socket
int MHD_socket
Definition: microhttpd.h:193
MHD_TLS_CONN_STATE
MHD_TLS_CONN_STATE
Definition: internal.h:659
MHD_HTTP_Header::value_size
size_t value_size
Definition: internal.h:338
MHD_Daemon::worker_pool
struct MHD_Daemon * worker_pool
Definition: internal.h:1073
MHD_CONNECTION_CONTINUE_SENDING
@ MHD_CONNECTION_CONTINUE_SENDING
Definition: internal.h:568
MHD_Connection::recv_cls
ReceiveCallback recv_cls
Definition: internal.h:706
MHD_Connection::sk_corked
enum MHD_tristate sk_corked
Definition: internal.h:1020
MHD_Daemon::have_new
volatile bool have_new
Definition: internal.h:1756
MHD_Connection::in_cleanup
bool in_cleanup
Definition: internal.h:1052
MHD_Daemon::worker_pool_size
unsigned int worker_pool_size
Definition: internal.h:1366
MHD_Daemon::options
enum MHD_FLAG options
Definition: internal.h:1411
MHD_TLS_CONN_WR_CLOSING
@ MHD_TLS_CONN_WR_CLOSING
Definition: internal.h:664
MHD_Daemon::uri_log_callback
LogCallback uri_log_callback
Definition: internal.h:1588
MHD_AccessHandlerCallback
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:2227
MHD_Daemon::unescape_callback
UnescapeCallback unescape_callback
Definition: internal.h:1598
MHD_Daemon::pool_size
size_t pool_size
Definition: internal.h:1662
UnescapeCallback
size_t(* UnescapeCallback)(void *cls, struct MHD_Connection *conn, char *uri)
Definition: internal.h:1380
MHD_iovec_track_
Definition: internal.h:381
MAX_NONCE_LENGTH
#define MAX_NONCE_LENGTH
Definition: internal.h:268
MHD_Connection::nextX
struct MHD_Connection * nextX
Definition: internal.h:665
MHD_CONN_KEEPALIVE_UNKOWN
@ MHD_CONN_KEEPALIVE_UNKOWN
Definition: internal.h:164
MHD_Daemon::listen_backlog_size
unsigned int listen_backlog_size
Definition: internal.h:1943
MHD_Daemon::connection_limit
unsigned int connection_limit
Definition: internal.h:1772
LogCallback
void *(* LogCallback)(void *cls, const char *uri, struct MHD_Connection *con)
Definition: internal.h:1366
MHD_Connection::prev
struct MHD_Connection * prev
Definition: internal.h:656
_MHD_ON
@ _MHD_ON
Definition: internal.h:178
_MHD_NO
@ _MHD_NO
Definition: internal.h:177
MHD_CONNECTION_NORMAL_BODY_UNREADY
@ MHD_CONNECTION_NORMAL_BODY_UNREADY
Definition: internal.h:612
MHD_CONNECTION_BODY_SENT
@ MHD_CONNECTION_BODY_SENT
Definition: internal.h:627
MHD_ContentReaderFreeCallback
void(* MHD_ContentReaderFreeCallback)(void *cls)
Definition: microhttpd.h:2392
MHD_CONNECTION_NORMAL_BODY_READY
@ MHD_CONNECTION_NORMAL_BODY_READY
Definition: internal.h:606
MHD_iovec_
struct MHD_IoVec MHD_iovec_
Definition: internal.h:374
MHD_Connection::tls_read_ready
bool tls_read_ready
Definition: internal.h:769
MHD_CONNECTION_CHUNKED_BODY_UNREADY
@ MHD_CONNECTION_CHUNKED_BODY_UNREADY
Definition: internal.h:622
MHD_EPOLL_STATE_WRITE_READY
@ MHD_EPOLL_STATE_WRITE_READY
Definition: internal.h:606
MHD_Daemon::itc
struct MHD_itc_ itc
Definition: internal.h:1410
MHD_Daemon::apc
MHD_AcceptPolicyCallback apc
Definition: internal.h:1552
mhd_panic_cls
void * mhd_panic_cls
Definition: panic.c:36
MHD_HTTP_Header::next
struct MHD_HTTP_Header * next
Definition: internal.h:342
MHD_Connection::resp_iov
struct MHD_iovec_track_ resp_iov
Definition: internal.h:948
MHD_Daemon::cleanup_tail
struct MHD_Connection * cleanup_tail
Definition: internal.h:1182
MHD_Connection::write_buffer_size
size_t write_buffer_size
Definition: internal.h:910
MHD_Response::crfc
MHD_ContentReaderFreeCallback crfc
Definition: internal.h:1606
MHD_Daemon::manual_timeout_tail
struct MHD_Connection * manual_timeout_tail
Definition: internal.h:1150
MHD_Daemon::port
uint16_t port
Definition: internal.h:1611
MHD_Response::fd_off
uint64_t fd_off
Definition: internal.h:1653
MHD_Daemon::connections
unsigned int connections
Definition: internal.h:1361
MHD_unescape_plus
void MHD_unescape_plus(char *arg)
Definition: internal.c:123
MHD_Connection::sk_nonblck
bool sk_nonblck
Definition: internal.h:784
MHD_CONN_USE_KEEPALIVE
@ MHD_CONN_USE_KEEPALIVE
Definition: internal.h:169
MHD_EVENT_LOOP_INFO_BLOCK
@ MHD_EVENT_LOOP_INFO_BLOCK
Definition: internal.h:247
MHD_Connection::connection_timeout_dummy
unsigned int connection_timeout_dummy
Definition: internal.h:985
MHD_NonceNc::nc
uint64_t nc
Definition: internal.h:282
MHD_Daemon::listen_fd
MHD_socket listen_fd
Definition: internal.h:1637
MHD_Daemon::normal_timeout_tail
struct MHD_Connection * normal_timeout_tail
Definition: internal.h:1135
mhd_options.h
additional automatic macros for MHD_config.h
ReceiveCallback
ssize_t(* ReceiveCallback)(struct MHD_Connection *conn, void *write_to, size_t max_bytes)
Definition: internal.h:182
MHD_Connection::write_buffer_append_offset
size_t write_buffer_append_offset
Definition: internal.h:921
MHD_CONNECTION_URL_RECEIVED
@ MHD_CONNECTION_URL_RECEIVED
Definition: internal.h:548
MHD_CONNECTION_FOOTERS_RECEIVED
@ MHD_CONNECTION_FOOTERS_RECEIVED
Definition: internal.h:590
MHD_Daemon::normal_timeout_head
struct MHD_Connection * normal_timeout_head
Definition: internal.h:1128
MHD_CONNECTION_CLOSED
@ MHD_CONNECTION_CLOSED
Definition: internal.h:642
MHD_Daemon::notify_completed_cls
void * notify_completed_cls
Definition: internal.h:1568
MHD_FLAG
MHD_FLAG
Flags for the struct MHD_Daemon.
Definition: microhttpd.h:1050
MHD_Connection::last_activity
time_t last_activity
Definition: internal.h:739
MHD_Connection::is_nonip
enum MHD_tristate is_nonip
Definition: internal.h:1005
MHD_HTTP_Header::header_size
size_t header_size
Definition: internal.h:328
MHD_CONNECTION_HEADERS_PROCESSED
@ MHD_CONNECTION_HEADERS_PROCESSED
Definition: internal.h:563
MHD_Response::crc
MHD_ContentReaderCallback crc
Definition: internal.h:1600
MHD_tristate
MHD_tristate
Definition: internal.h:174
MHD_Connection::sk_nodelay
enum MHD_tristate sk_nodelay
Definition: internal.h:1025
MHD_EPOLL_STATE_ERROR
@ MHD_EPOLL_STATE_ERROR
Definition: internal.h:626
MHD_Daemon::suspended_connections_tail
struct MHD_Connection * suspended_connections_tail
Definition: internal.h:1172
MHD_DisableSanityCheck
MHD_DisableSanityCheck
Definition: microhttpd.h:1759
MHD_Response::reference_count
unsigned int reference_count
Definition: internal.h:1675
MHD_RequestCompletedCallback
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
Definition: microhttpd.h:2250
MHD_Response::data_buffer_size
size_t data_buffer_size
Definition: internal.h:1664
MHD_iov_size_
size_t MHD_iov_size_
Definition: internal.h:376
MHD_Response::total_size
uint64_t total_size
Definition: internal.h:1642
MHD_Response::data_start
uint64_t data_start
Definition: internal.h:1648
MHD_Connection::addr
struct sockaddr * addr
Definition: internal.h:883
MHD_Connection::read_closed
bool read_closed
Definition: internal.h:792
MHD_Response::data_size
size_t data_size
Definition: internal.h:1659
MHD_Daemon::suspended_connections_head
struct MHD_Connection * suspended_connections_head
Definition: internal.h:1166
MHD_Daemon::per_ip_connection_count
void * per_ip_connection_count
Definition: internal.h:1187
internal_suspend_connection_
void internal_suspend_connection_(struct MHD_Connection *connection)
Definition: daemon.c:3038
MHD_TLS_CONN_CONNECTED
@ MHD_TLS_CONN_CONNECTED
Definition: internal.h:663
MHD_Connection::pool
struct MemoryPool * pool
Definition: internal.h:685
MHD_CONNECTION_CHUNKED_BODY_READY
@ MHD_CONNECTION_CHUNKED_BODY_READY
Definition: internal.h:617
MHD_TLS_CONN_TLS_FAILED
@ MHD_TLS_CONN_TLS_FAILED
Definition: internal.h:668
_MHD_YES
@ _MHD_YES
Definition: internal.h:179
MHD_Daemon::sigpipe_blocked
bool sigpipe_blocked
Definition: internal.h:1794
MHD_Daemon::pool_increment
size_t pool_increment
Definition: internal.h:1667
MHD_Response::data_iov
MHD_iovec_ * data_iov
Definition: internal.h:513
MHD_Daemon::listen_is_unix
enum MHD_tristate listen_is_unix
Definition: internal.h:1456
MHD_Daemon::notify_completed
MHD_RequestCompletedCallback notify_completed
Definition: internal.h:1563
MHD_AcceptPolicyCallback
enum MHD_Result(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
Definition: microhttpd.h:2182
MHD_parse_arguments_
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
MHD_Connection::current_chunk_size
uint64_t current_chunk_size
Definition: internal.h:1092
MHD_Daemon::notify_connection_cls
void * notify_connection_cls
Definition: internal.h:1579
mhd_assert.h
macros for mhd_assert()
MHD_Daemon::per_ip_connection_limit
unsigned int per_ip_connection_limit
Definition: internal.h:1784
MHD_Daemon::apc_cls
void * apc_cls
Definition: internal.h:1557
MHD_CONN_MUST_CLOSE
@ MHD_CONN_MUST_CLOSE
Definition: internal.h:159
MHD_Daemon::at_limit
bool at_limit
Definition: internal.h:1483
MHD_Connection::suspended
bool suspended
Definition: internal.h:764
MHD_EPOLL_STATE_IN_EPOLL_SET
@ MHD_EPOLL_STATE_IN_EPOLL_SET
Definition: internal.h:616
MHD_Response::fd
int fd
Definition: internal.h:1680
MHD_Daemon::insanity_level
enum MHD_DisableSanityCheck insanity_level
Definition: internal.h:1706
MHD_Connection::headers_received_tail
struct MHD_HTTP_Header * headers_received_tail
Definition: internal.h:791
MHD_NonceNc
Definition: internal.h:276
MHD_EVENT_LOOP_INFO_READ
@ MHD_EVENT_LOOP_INFO_READ
Definition: internal.h:237
MHD_Daemon::num_opts
size_t num_opts
Definition: internal.h:1952
MHD_Connection::thread_joined
bool thread_joined
Definition: internal.h:779
MHD_TLS_CONN_WR_CLOSED
@ MHD_TLS_CONN_WR_CLOSED
Definition: internal.h:665
MHD_ContentReaderCallback
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
Definition: microhttpd.h:2376
MHD_Connection::read_buffer_offset
size_t read_buffer_offset
Definition: internal.h:905
MHD_NotifyConnectionCallback
void(* MHD_NotifyConnectionCallback)(void *cls, struct MHD_Connection *connection, void **socket_context, enum MHD_ConnectionNotificationCode toe)
Definition: microhttpd.h:2276
MHD_Daemon::default_handler_cls
void * default_handler_cls
Definition: internal.h:1403
MHD_Daemon::shutdown
volatile bool shutdown
Definition: internal.h:1526
MHD_Connection::have_chunked_upload
bool have_chunked_upload
Definition: internal.h:1084
MHD_Connection::resuming
volatile bool resuming
Definition: internal.h:1157
mhd_locks.h
Header for platform-independent locks abstraction.
MHD_TLS_CONN_INVALID_STATE
@ MHD_TLS_CONN_INVALID_STATE
Definition: internal.h:669
MHD_Connection::headers_received
struct MHD_HTTP_Header * headers_received
Definition: internal.h:786
MHD_NonceNc::nmask
uint64_t nmask
Definition: internal.h:288
MHD_Connection::current_chunk_offset
uint64_t current_chunk_offset
Definition: internal.h:1098
MHD_Daemon::pid
MHD_thread_handle_ID_ pid
Definition: internal.h:1249
MHD_Daemon::connection_timeout
time_t connection_timeout
Definition: internal.h:1778
MHD_iovec_track_::iov
MHD_iovec_ * iov
Definition: internal.h:387
MHD_Connection::state
enum MHD_CONNECTION_STATE state
Definition: internal.h:1064
MHD_Daemon::cleanup_connection_mutex
MHD_mutex_ cleanup_connection_mutex
Definition: internal.h:1265
MHD_Daemon::new_connections_head
struct MHD_Connection * new_connections_head
Definition: internal.h:1416
MHD_Connection::keepalive
enum MHD_ConnKeepAlive keepalive
Definition: internal.h:847
MHD_PanicCallback
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microhttpd.h:2168
MHD_Connection::prevX
struct MHD_Connection * prevX
Definition: internal.h:670
_MHD_UNKNOWN
@ _MHD_UNKNOWN
Definition: internal.h:175
MHD_Daemon::new_connections_tail
struct MHD_Connection * new_connections_tail
Definition: internal.h:1421
MHD_Response::mutex
MHD_mutex_ mutex
Definition: internal.h:1637
MHD_CONNECTION_CONTINUE_SENT
@ MHD_CONNECTION_CONTINUE_SENT
Definition: internal.h:573
TransmitCallback
ssize_t(* TransmitCallback)(struct MHD_Connection *conn, const void *read_from, size_t max_bytes)
Definition: internal.h:196
MHD_NonceNc::nonce
char nonce[MAX_NONCE_LENGTH]
Definition: internal.h:293
MHD_Connection::version
char * version
Definition: internal.h:840
MHD_Daemon::manual_timeout_head
struct MHD_Connection * manual_timeout_head
Definition: internal.h:1143
MHD_ConnectionEventLoopInfo
MHD_ConnectionEventLoopInfo
Definition: internal.h:233
MHD_Connection::addr_len
socklen_t addr_len
Definition: internal.h:733
MHD_Daemon
Definition: internal.h:1001
MHD_TLS_CONN_HANDSHAKING
@ MHD_TLS_CONN_HANDSHAKING
Definition: internal.h:662
MHD_HTTP_Header::value
char * value
Definition: internal.h:352
MHD_Connection::colon
char * colon
Definition: internal.h:877
mhd_sockets.h
MHD_CONNECTION_FOOTER_PART_RECEIVED
@ MHD_CONNECTION_FOOTER_PART_RECEIVED
Definition: internal.h:584
MHD_Daemon::unescape_callback_cls
void * unescape_callback_cls
Definition: internal.h:1603
platform.h
platform-specific includes for libmicrohttpd
MHD_Connection::response_write_position
uint64_t response_write_position
Definition: internal.h:940
MHD_Daemon::cleanup_head
struct MHD_Connection * cleanup_head
Definition: internal.h:1177
MHD_UpgradeHandler
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:3429
MHD_IoVec
Definition: microhttpd.h:1998
MHD_Connection::event_loop_info
enum MHD_ConnectionEventLoopInfo event_loop_info
Definition: internal.h:1069
MHD_ConnKeepAlive
MHD_ConnKeepAlive
Definition: internal.h:155
MHD_EVENT_LOOP_INFO_CLEANUP
@ MHD_EVENT_LOOP_INFO_CLEANUP
Definition: internal.h:252
MHD_Daemon::data_already_pending
bool data_already_pending
Definition: internal.h:1500
MHD_HTTP_Header::header
char * header
Definition: internal.h:347
MHD_EpollState
MHD_EpollState
Definition: internal.h:588
MHD_Daemon::default_handler
MHD_AccessHandlerCallback default_handler
Definition: internal.h:1398
MHD_EPOLL_STATE_READ_READY
@ MHD_EPOLL_STATE_READ_READY
Definition: internal.h:600
MHD_TLS_CONN_TLS_CLOSED
@ MHD_TLS_CONN_TLS_CLOSED
Definition: internal.h:667
MHD_Connection::suspended_dummy
int suspended_dummy
Definition: internal.h:1152
MHD_Daemon::per_ip_connection_mutex
MHD_mutex_ per_ip_connection_mutex
Definition: internal.h:1259
MHD_Connection::remaining_upload_size
uint64_t remaining_upload_size
Definition: internal.h:933
MHD_Daemon::notify_connection
MHD_NotifyConnectionCallback notify_connection
Definition: internal.h:1574
MHD_Connection::response
struct MHD_Response * response
Definition: internal.h:796
microhttpd.h
public interface to libmicrohttpd
MHD_Connection::write_buffer
char * write_buffer
Definition: internal.h:860
mhd_itc_types.h
Types for platform-independent inter-thread communication.
MHD_CONNECTION_BODY_RECEIVED
@ MHD_CONNECTION_BODY_RECEIVED
Definition: internal.h:578
MHD_HTTP_Header
Definition: internal.h:338
MHD_Connection::in_idle
bool in_idle
Definition: internal.h:1046
MHD_Connection::daemon
struct MHD_Daemon * daemon
Definition: internal.h:675
MHD_Daemon::was_quiesced
volatile bool was_quiesced
Definition: internal.h:1736
_MHD_OFF
@ _MHD_OFF
Definition: internal.h:176
MHD_Connection::pid
MHD_thread_handle_ID_ pid
Definition: internal.h:723
MHD_CONNECTION_FOOTERS_SENT
@ MHD_CONNECTION_FOOTERS_SENT
Definition: internal.h:637
MHD_LogCallback
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
Definition: microhttpd.h:1349
MHD_Daemon::connections_tail
struct MHD_Connection * connections_tail
Definition: internal.h:1160
MHD_Daemon::strict_for_client
int strict_for_client
Definition: internal.h:1789
MHD_ResponseFlags
MHD_ResponseFlags
Definition: microhttpd.h:3024
MHD_ValueKind
MHD_ValueKind
Definition: microhttpd.h:1800
MHD_CONNECTION_HEADERS_RECEIVED
@ MHD_CONNECTION_HEADERS_RECEIVED
Definition: internal.h:558
MHD_EPOLL_STATE_UNREADY
@ MHD_EPOLL_STATE_UNREADY
Definition: internal.h:594
MHD_Response::data_iovcnt
unsigned int data_iovcnt
Definition: internal.h:518
MHD_CONNECTION_HEADERS_SENDING
@ MHD_CONNECTION_HEADERS_SENDING
Definition: internal.h:596
MHD_Response
Definition: internal.h:1568
MHD_Connection::responseCode
unsigned int responseCode
Definition: internal.h:1075
MHD_Response::crc_cls
void * crc_cls
Definition: internal.h:1594
MHD_iovec_track_::sent
size_t sent
Definition: internal.h:400
MHD_Connection::write_buffer_send_offset
size_t write_buffer_send_offset
Definition: internal.h:915
MHD_Connection
Definition: internal.h:634
MHD_TLS_CONN_NO_TLS
@ MHD_TLS_CONN_NO_TLS
Definition: internal.h:660
MHD_Daemon::connections_head
struct MHD_Connection * connections_head
Definition: internal.h:1155
MHD_Connection::header_size
size_t header_size
Definition: internal.h:927
MHD_iovec_track_::cnt
size_t cnt
Definition: internal.h:393
MHD_Result
MHD_Result
Definition: microhttpd.h:139
MHD_HTTP_Header::kind
enum MHD_ValueKind kind
Definition: internal.h:358
MHD_Daemon::uri_log_callback_cls
void * uri_log_callback_cls
Definition: internal.h:1593
MHD_Connection::url
const char * url
Definition: internal.h:834
MHD_Connection::read_buffer_size
size_t read_buffer_size
Definition: internal.h:899
MHD_CONNECTION_STATE
MHD_CONNECTION_STATE
Definition: internal.h:538
MHD_ArgumentIterator_
bool(* MHD_ArgumentIterator_)(struct MHD_Request *request, const char *key, const char *value, enum MHD_ValueKind kind)
Definition: internal.h:1707
MHD_Response::data
char * data
Definition: internal.h:1588
MHD_Connection::next
struct MHD_Connection * next
Definition: internal.h:651
MHD_TLS_CONN_INIT
@ MHD_TLS_CONN_INIT
Definition: internal.h:661
MHD_PskServerCredentialsCallback
int(* MHD_PskServerCredentialsCallback)(void *cls, const struct MHD_Connection *connection, const char *username, void **psk, size_t *psk_size)
Definition: microhttpd.h:1367
MHD_Connection::method
char * method
Definition: internal.h:828
MHD_Response::flags
enum MHD_ResponseFlags flags
Definition: internal.h:503
MHD_Connection::client_aware
bool client_aware
Definition: internal.h:992
MHD_Connection::sk_spipe_suppress
bool sk_spipe_suppress
Definition: internal.h:1015
MHD_check_response_header_token_ci
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:324
MHD_Connection::socket_context
void * socket_context
Definition: internal.h:694
MHD_EPOLL_STATE_SUSPENDED
@ MHD_EPOLL_STATE_SUSPENDED
Definition: internal.h:621
MHD_Daemon::listening_address_reuse
int listening_address_reuse
Definition: internal.h:1717
MHD_CONNECTION_HEADER_PART_RECEIVED
@ MHD_CONNECTION_HEADER_PART_RECEIVED
Definition: internal.h:553
MHD_EPOLL_STATE_IN_EREADY_EDLL
@ MHD_EPOLL_STATE_IN_EREADY_EDLL
Definition: internal.h:611
MHD_Connection::connection_timeout
time_t connection_timeout
Definition: internal.h:745
MHD_Daemon::master
struct MHD_Daemon * master
Definition: internal.h:1068
MHD_Connection::client_context
void * client_context
Definition: internal.h:814
MHD_CONNECTION_INIT
@ MHD_CONNECTION_INIT
Definition: internal.h:543
MHD_Connection::last
char * last
Definition: internal.h:868
mhd_panic
MHD_PanicCallback mhd_panic
Definition: panic.c:31
MHD_Response::is_pipe
bool is_pipe
Definition: internal.h:508
MHD_TLS_CONN_TLS_CLOSING
@ MHD_TLS_CONN_TLS_CLOSING
Definition: internal.h:666
MHD_CONNECTION_HEADERS_SENT
@ MHD_CONNECTION_HEADERS_SENT
Definition: internal.h:601
MHD_Connection::continue_message_write_offset
size_t continue_message_write_offset
Definition: internal.h:963
MHD_Connection::socket_fd
MHD_socket socket_fd
Definition: internal.h:752
MHD_EVENT_LOOP_INFO_WRITE
@ MHD_EVENT_LOOP_INFO_WRITE
Definition: internal.h:242
MHD_Daemon::resuming
volatile bool resuming
Definition: internal.h:1750
MHD_Connection::read_buffer
char * read_buffer
Definition: internal.h:854
MHD_CONNECTION_FOOTERS_SENDING
@ MHD_CONNECTION_FOOTERS_SENDING
Definition: internal.h:632