GNU libmicrohttpd  0.9.70
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 #include "mhd_locks.h"
73 #endif
74 #include "mhd_sockets.h"
75 #include "mhd_itc_types.h"
76 
77 
82 #define MHD_fd_close_chk_(fd) do { \
83  if ( (0 != close ((fd)) && (EBADF == errno)) ) \
84  MHD_PANIC (_ ("Failed to close FD.\n")); \
85 } while (0)
86 
91 #define EXTRA_CHECKS MHD_NO
92 
93 #define MHD_MAX(a,b) (((a)<(b)) ? (b) : (a))
94 #define MHD_MIN(a,b) (((a)<(b)) ? (a) : (b))
95 
96 
104 #define MHD_BUF_INC_SIZE 1024
105 
106 
111 
115 extern void *mhd_panic_cls;
116 
117 /* If we have Clang or gcc >= 4.5, use __buildin_unreachable() */
118 #if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= \
119  5)
120 #define BUILTIN_NOT_REACHED __builtin_unreachable ()
121 #elif defined(_MSC_FULL_VER)
122 #define BUILTIN_NOT_REACHED __assume (0)
123 #else
124 #define BUILTIN_NOT_REACHED
125 #endif
126 
127 #ifndef MHD_STATICSTR_LEN_
128 
131 #define MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1)
132 #endif /* ! MHD_STATICSTR_LEN_ */
133 
134 
139 {
140 
146 
152 
158 
163 
168 
173 
178 };
179 
180 
185 {
190 
195 
200 
205 };
206 
207 
212 #define MHD_TEST_ALLOW_SUSPEND_RESUME 8192
213 
220 #define MAX_NONCE_LENGTH 129
221 
222 
228 {
229 
234  uint64_t nc;
235 
240  uint64_t nmask;
241 
246 
247 };
248 
249 #ifdef HAVE_MESSAGES
250 
254 void
255 MHD_DLOG (const struct MHD_Daemon *daemon,
256  const char *format,
257  ...);
258 
259 #endif
260 
261 
265 struct MHD_HTTP_Header
266 {
270  struct MHD_HTTP_Header *next;
271 
275  char *header;
276 
280  size_t header_size;
281 
285  char *value;
286 
290  size_t value_size;
291 
296  enum MHD_ValueKind kind;
297 
298 };
299 
300 
304 struct MHD_Response
305 {
306 
313 
318  char *data;
319 
324  void *crc_cls;
325 
331 
337 
338 #ifdef UPGRADE_SUPPORT
339 
344  MHD_UpgradeHandler upgrade_handler;
345 
349  void *upgrade_handler_cls;
350 #endif /* UPGRADE_SUPPORT */
351 
352 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
353 
357  MHD_mutex_ mutex;
358 #endif
359 
363  uint64_t total_size;
364 
369  uint64_t data_start;
370 
374  uint64_t fd_off;
375 
380  size_t data_size;
381 
385  size_t data_buffer_size;
386 
391  unsigned int reference_count;
392 
396  int fd;
397 
402 
403 };
404 
405 
422 {
428 
433 
438 
443 
448 
453 
458 
463 
469 
475 
481 
486 
491 
497 
502 
507 
512 
517 
522 
527 
528 #ifdef UPGRADE_SUPPORT
529 
533  MHD_CONNECTION_UPGRADE
534 #endif /* UPGRADE_SUPPORT */
535 
536 };
537 
538 
543 {
554 };
555 
559 #define DEBUG_STATES MHD_NO
560 
561 
562 #ifdef HAVE_MESSAGES
563 #if DEBUG_STATES
564 const char *
565 MHD_state_to_string (enum MHD_CONNECTION_STATE state);
566 
567 #endif
568 #endif
569 
578 typedef ssize_t
580  void *write_to,
581  size_t max_bytes);
582 
583 
592 typedef ssize_t
594  const void *read_from,
595  size_t max_bytes);
596 
597 
602 {
607 
612 
617 };
618 
619 
623 struct MHD_Connection
624 {
625 
626 #ifdef EPOLL_SUPPORT
627 
630  struct MHD_Connection *nextE;
631 
635  struct MHD_Connection *prevE;
636 #endif
637 
641  struct MHD_Connection *next;
642 
646  struct MHD_Connection *prev;
647 
655  struct MHD_Connection *nextX;
656 
660  struct MHD_Connection *prevX;
661 
665  struct MHD_Daemon *daemon;
666 
671 
676 
681 
690  struct MemoryPool *pool;
691 
699 
707  void *socket_context;
708 
712  char *method;
713 
718  const char *url;
719 
724  char *version;
725 
732 
738  char *read_buffer;
739 
745 
752  char *last;
753 
761  char *colon;
762 
767  struct sockaddr *addr;
768 
769 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
770 
774  MHD_thread_handle_ID_ pid;
775 #endif
776 
784 
790 
795 
800 
806 
811  size_t header_size;
812 
818 
825 
826 #if defined(_MHD_HAVE_SENDFILE)
827  enum MHD_resp_sender_
828  {
829  MHD_resp_sender_std = 0,
830  MHD_resp_sender_sendfile
831  } resp_sender;
832 #endif /* _MHD_HAVE_SENDFILE */
833 
839 
843  socklen_t addr_len;
844 
849  time_t last_activity;
850 
855  time_t connection_timeout;
856 
861 
868 
875 
879  bool sk_nonblck;
880 
886 
893  bool read_closed;
894 
895 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
896 
899  bool thread_joined;
900 #endif
901 
906  bool in_idle;
907 
913 
914 #ifdef EPOLL_SUPPORT
915 
918  enum MHD_EpollState epoll_state;
919 #endif
920 
925 
930 
935  unsigned int responseCode;
936 
945 
953 
959 
964 
969 
970 #ifdef UPGRADE_SUPPORT
971 
977  struct MHD_UpgradeResponseHandle *urh;
978 #endif /* UPGRADE_SUPPORT */
979 
980 #ifdef HTTPS_SUPPORT
981 
985  gnutls_session_t tls_session;
986 
990  int protocol;
991 
995  int cipher;
996 
1000  enum MHD_TLS_CONN_STATE tls_state;
1001 
1006  bool tls_read_ready;
1007 #endif /* HTTPS_SUPPORT */
1008 
1012  bool suspended;
1013 
1018 
1022  bool resuming;
1023 };
1024 
1025 
1026 #ifdef UPGRADE_SUPPORT
1027 
1036 #define RESERVE_EBUF_SIZE 8
1037 
1044 struct UpgradeEpollHandle
1045 {
1050  struct MHD_UpgradeResponseHandle *urh;
1051 
1067  MHD_socket socket;
1068 
1072  enum MHD_EpollState celi;
1073 
1074 };
1075 
1076 
1082 struct MHD_UpgradeResponseHandle
1083 {
1089  struct MHD_Connection *connection;
1090 
1091 #ifdef HTTPS_SUPPORT
1092 
1095  struct MHD_UpgradeResponseHandle *next;
1096 
1100  struct MHD_UpgradeResponseHandle *prev;
1101 
1102 #ifdef EPOLL_SUPPORT
1103 
1106  struct MHD_UpgradeResponseHandle *nextE;
1107 
1111  struct MHD_UpgradeResponseHandle *prevE;
1112 
1116  bool in_eready_list;
1117 #endif
1118 
1124  char *in_buffer;
1125 
1131  char *out_buffer;
1132 
1138  size_t in_buffer_size;
1139 
1145  size_t out_buffer_size;
1146 
1154  size_t in_buffer_used;
1155 
1163  size_t out_buffer_used;
1164 
1168  struct UpgradeEpollHandle app;
1169 
1174  struct UpgradeEpollHandle mhd;
1175 
1180  char e_buf[RESERVE_EBUF_SIZE];
1181 
1182 #endif /* HTTPS_SUPPORT */
1183 
1194  volatile bool was_closed;
1195 
1217  bool clean_ready;
1218 };
1219 #endif /* UPGRADE_SUPPORT */
1220 
1221 
1230 typedef void *
1231 (*LogCallback)(void *cls,
1232  const char *uri,
1233  struct MHD_Connection *con);
1234 
1244 typedef size_t
1245 (*UnescapeCallback)(void *cls,
1246  struct MHD_Connection *conn,
1247  char *uri);
1248 
1249 
1257 struct MHD_Daemon
1258 {
1259 
1264 
1269 
1274 
1279 
1284 
1289 
1293  struct MHD_Connection *cleanup_head;
1294 
1298  struct MHD_Connection *cleanup_tail;
1299 
1300 #ifdef EPOLL_SUPPORT
1301 
1304  struct MHD_Connection *eready_head;
1305 
1309  struct MHD_Connection *eready_tail;
1310 
1311 #ifdef UPGRADE_SUPPORT
1312 
1315  struct MHD_UpgradeResponseHandle *eready_urh_head;
1316 
1320  struct MHD_UpgradeResponseHandle *eready_urh_tail;
1321 #endif /* UPGRADE_SUPPORT */
1322 #endif /* EPOLL_SUPPORT */
1323 
1339 
1346 
1354 
1361 
1367 
1371  void *apc_cls;
1372 
1378 
1383 
1389 
1394 
1403 
1408 
1413 
1418 
1419 #ifdef HAVE_MESSAGES
1420 
1424  MHD_LogCallback custom_error_log;
1425 
1429  void *custom_error_log_cls;
1430 #endif
1431 
1435  struct MHD_Daemon *master;
1436 
1437 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1438 
1441  struct MHD_Daemon *worker_pool;
1442 #endif
1443 
1448 
1452  size_t pool_size;
1453 
1458 
1459 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1460 
1463  size_t thread_stack_size;
1464 
1469  enum MHD_DisableSanityCheck insanity_level;
1470 
1474  unsigned int worker_pool_size;
1475 
1479  MHD_thread_handle_ID_ pid;
1480 
1484  MHD_mutex_ per_ip_connection_mutex;
1485 
1490  MHD_mutex_ cleanup_connection_mutex;
1491 #endif
1492 
1497 
1508 
1509 #ifdef EPOLL_SUPPORT
1510 
1513  int epoll_fd;
1514 
1519  bool listen_socket_in_epoll;
1520 
1521 #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
1522 
1526  int epoll_upgrade_fd;
1527 
1532  bool upgrade_fd_in_epoll;
1533 #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
1534 
1535 #endif
1536 
1541  struct MHD_itc_ itc;
1542 
1546  volatile bool shutdown;
1547 
1553  volatile bool was_quiesced;
1554 
1562  bool at_limit;
1563 
1564  /*
1565  * Do we need to process resuming connections?
1566  */
1567  bool resuming;
1568 
1578  bool data_already_pending;
1579 
1583  unsigned int connections;
1584 
1588  unsigned int connection_limit;
1589 
1595 
1601 
1606 
1610  uint16_t port;
1611 
1616 
1617 #ifdef HTTPS_SUPPORT
1618 #ifdef UPGRADE_SUPPORT
1619 
1624  struct MHD_UpgradeResponseHandle *urh_head;
1625 
1631  struct MHD_UpgradeResponseHandle *urh_tail;
1632 #endif /* UPGRADE_SUPPORT */
1633 
1637  gnutls_priority_t priority_cache;
1638 
1643  gnutls_credentials_type_t cred_type;
1644 
1648  gnutls_certificate_credentials_t x509_cred;
1649 
1653  gnutls_dh_params_t dh_params;
1654 
1658  gnutls_psk_server_credentials_t psk_cred;
1659 
1660 #if GNUTLS_VERSION_MAJOR >= 3
1661 
1665  gnutls_certificate_retrieve_function2 *cert_callback;
1666 
1670  MHD_PskServerCredentialsCallback cred_callback;
1671 
1675  void *cred_callback_cls;
1676 #endif
1677 
1678 #if GNUTLS_VERSION_NUMBER >= 0x030603
1679 
1683  gnutls_certificate_retrieve_function3 *cert_callback2;
1684 #endif
1685 
1689  const char *https_mem_key;
1690 
1694  const char *https_mem_cert;
1695 
1699  const char *https_key_password;
1700 
1704  const char *https_mem_trust;
1705 
1709  gnutls_dh_params_t https_mem_dhparams;
1710 
1714  bool have_dhparams;
1715 
1716 #endif /* HTTPS_SUPPORT */
1717 
1718 #ifdef DAUTH_SUPPORT
1719 
1723  const char *digest_auth_random;
1724 
1728  struct MHD_NonceNc *nnc;
1729 
1730 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1731 
1734  MHD_mutex_ nnc_lock;
1735 #endif
1736 
1740  size_t digest_auth_rand_size;
1741 
1745  unsigned int nonce_nc_size;
1746 
1747 #endif
1748 
1749 #ifdef TCP_FASTOPEN
1750 
1753  unsigned int fastopen_queue_size;
1754 #endif
1755 
1759  unsigned int listen_backlog_size;
1760 };
1761 
1762 
1771 #define DLL_insert(head,tail,element) do { \
1772  mhd_assert (NULL == (element)->next); \
1773  mhd_assert (NULL == (element)->prev); \
1774  (element)->next = (head); \
1775  (element)->prev = NULL; \
1776  if ((tail) == NULL) \
1777  (tail) = element; \
1778  else \
1779  (head)->prev = element; \
1780  (head) = (element); } while (0)
1781 
1782 
1792 #define DLL_remove(head,tail,element) do { \
1793  mhd_assert ( (NULL != (element)->next) || ((element) == (tail))); \
1794  mhd_assert ( (NULL != (element)->prev) || ((element) == (head))); \
1795  if ((element)->prev == NULL) \
1796  (head) = (element)->next; \
1797  else \
1798  (element)->prev->next = (element)->next; \
1799  if ((element)->next == NULL) \
1800  (tail) = (element)->prev; \
1801  else \
1802  (element)->next->prev = (element)->prev; \
1803  (element)->next = NULL; \
1804  (element)->prev = NULL; } while (0)
1805 
1806 
1815 #define XDLL_insert(head,tail,element) do { \
1816  mhd_assert (NULL == (element)->nextX); \
1817  mhd_assert (NULL == (element)->prevX); \
1818  (element)->nextX = (head); \
1819  (element)->prevX = NULL; \
1820  if (NULL == (tail)) \
1821  (tail) = element; \
1822  else \
1823  (head)->prevX = element; \
1824  (head) = (element); } while (0)
1825 
1826 
1836 #define XDLL_remove(head,tail,element) do { \
1837  mhd_assert ( (NULL != (element)->nextX) || ((element) == (tail))); \
1838  mhd_assert ( (NULL != (element)->prevX) || ((element) == (head))); \
1839  if (NULL == (element)->prevX) \
1840  (head) = (element)->nextX; \
1841  else \
1842  (element)->prevX->nextX = (element)->nextX; \
1843  if (NULL == (element)->nextX) \
1844  (tail) = (element)->prevX; \
1845  else \
1846  (element)->nextX->prevX = (element)->prevX; \
1847  (element)->nextX = NULL; \
1848  (element)->prevX = NULL; } while (0)
1849 
1850 
1859 #define EDLL_insert(head,tail,element) do { \
1860  (element)->nextE = (head); \
1861  (element)->prevE = NULL; \
1862  if ((tail) == NULL) \
1863  (tail) = element; \
1864  else \
1865  (head)->prevE = element; \
1866  (head) = (element); } while (0)
1867 
1868 
1878 #define EDLL_remove(head,tail,element) do { \
1879  if ((element)->prevE == NULL) \
1880  (head) = (element)->nextE; \
1881  else \
1882  (element)->prevE->nextE = (element)->nextE; \
1883  if ((element)->nextE == NULL) \
1884  (tail) = (element)->prevE; \
1885  else \
1886  (element)->nextE->prevE = (element)->prevE; \
1887  (element)->nextE = NULL; \
1888  (element)->prevE = NULL; } while (0)
1889 
1890 
1896 void
1897 MHD_unescape_plus (char *arg);
1898 
1899 
1913 typedef int
1915  const char *key,
1916  size_t key_size,
1917  const char *value,
1918  size_t value_size,
1919  enum MHD_ValueKind kind);
1920 
1921 
1936 int
1937 MHD_parse_arguments_ (struct MHD_Connection *connection,
1938  enum MHD_ValueKind kind,
1939  char *args,
1941  unsigned int *num_headers);
1942 
1943 
1960 bool
1962  const char *key,
1963  size_t key_len,
1964  const char *token,
1965  size_t token_len);
1966 
1978 #define MHD_check_response_header_s_token_ci(r,k,tkn) \
1979  MHD_check_response_header_token_ci ((r),(k),MHD_STATICSTR_LEN_ (k), \
1980  (tkn),MHD_STATICSTR_LEN_ (tkn))
1981 
1982 
1992 void
1993 internal_suspend_connection_ (struct MHD_Connection *connection);
1994 
1995 #endif
MHD_Response::first_header
struct MHD_HTTP_Header * first_header
Definition: internal.h:1582
MHD_socket
int MHD_socket
Definition: microhttpd.h:187
MHD_TLS_CONN_STATE
MHD_TLS_CONN_STATE
Definition: internal.h:542
MHD_HTTP_Header::value_size
size_t value_size
Definition: internal.h:290
MHD_Daemon::worker_pool
struct MHD_Daemon * worker_pool
Definition: internal.h:1073
MHD_CONNECTION_CONTINUE_SENDING
@ MHD_CONNECTION_CONTINUE_SENDING
Definition: internal.h:452
MHD_Connection::recv_cls
ReceiveCallback recv_cls
Definition: internal.h:706
MHD_Connection::in_cleanup
bool in_cleanup
Definition: internal.h:912
MHD_Daemon::worker_pool_size
unsigned int worker_pool_size
Definition: internal.h:1366
MHD_Daemon::options
enum MHD_FLAG options
Definition: internal.h:1605
MHD_TLS_CONN_WR_CLOSING
@ MHD_TLS_CONN_WR_CLOSING
Definition: internal.h:548
MHD_Daemon::uri_log_callback
LogCallback uri_log_callback
Definition: internal.h:1402
MHD_Daemon::unescape_callback
UnescapeCallback unescape_callback
Definition: internal.h:1412
MHD_Daemon::pool_size
size_t pool_size
Definition: internal.h:1452
MHD_Connection::resuming
bool resuming
Definition: internal.h:774
UnescapeCallback
size_t(* UnescapeCallback)(void *cls, struct MHD_Connection *conn, char *uri)
Definition: internal.h:1245
MAX_NONCE_LENGTH
#define MAX_NONCE_LENGTH
Definition: internal.h:220
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:1759
MHD_Daemon::connection_limit
unsigned int connection_limit
Definition: internal.h:1588
LogCallback
void *(* LogCallback)(void *cls, const char *uri, struct MHD_Connection *con)
Definition: internal.h:1231
MHD_Connection::prev
struct MHD_Connection * prev
Definition: internal.h:656
MHD_Connection::sk_cork_on
bool sk_cork_on
Definition: internal.h:885
MHD_CONNECTION_NORMAL_BODY_UNREADY
@ MHD_CONNECTION_NORMAL_BODY_UNREADY
Definition: internal.h:496
MHD_CONNECTION_BODY_SENT
@ MHD_CONNECTION_BODY_SENT
Definition: internal.h:511
MHD_ContentReaderFreeCallback
void(* MHD_ContentReaderFreeCallback)(void *cls)
Definition: microhttpd.h:2331
MHD_CONNECTION_NORMAL_BODY_READY
@ MHD_CONNECTION_NORMAL_BODY_READY
Definition: internal.h:490
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:506
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:1366
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_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:794
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:1610
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:199
MHD_Connection::connection_timeout_dummy
unsigned int connection_timeout_dummy
Definition: internal.h:860
MHD_NonceNc::nc
uint64_t nc
Definition: internal.h:234
MHD_Daemon::listen_fd
MHD_socket listen_fd
Definition: internal.h:1496
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:805
MHD_CONNECTION_URL_RECEIVED
@ MHD_CONNECTION_URL_RECEIVED
Definition: internal.h:432
MHD_CONNECTION_FOOTERS_RECEIVED
@ MHD_CONNECTION_FOOTERS_RECEIVED
Definition: internal.h:474
MHD_Daemon::normal_timeout_head
struct MHD_Connection * normal_timeout_head
Definition: internal.h:1128
MHD_CONNECTION_CLOSED
@ MHD_CONNECTION_CLOSED
Definition: internal.h:526
MHD_Daemon::notify_completed_cls
void * notify_completed_cls
Definition: internal.h:1382
MHD_FLAG
MHD_FLAG
Flags for the struct MHD_Daemon.
Definition: microhttpd.h:1029
MHD_Connection::last_activity
time_t last_activity
Definition: internal.h:739
MHD_HTTP_Header::header_size
size_t header_size
Definition: internal.h:280
MHD_CONNECTION_HEADERS_PROCESSED
@ MHD_CONNECTION_HEADERS_PROCESSED
Definition: internal.h:447
MHD_Response::crc
MHD_ContentReaderCallback crc
Definition: internal.h:1600
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:1716
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:2189
MHD_Response::data_buffer_size
size_t data_buffer_size
Definition: internal.h:1664
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:767
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:2809
MHD_Daemon::resuming
bool resuming
Definition: internal.h:1510
MHD_TLS_CONN_CONNECTED
@ MHD_TLS_CONN_CONNECTED
Definition: internal.h:547
MHD_Connection::pool
struct MemoryPool * pool
Definition: internal.h:685
MHD_CONNECTION_CHUNKED_BODY_READY
@ MHD_CONNECTION_CHUNKED_BODY_READY
Definition: internal.h:501
MHD_Connection::send_cls
TransmitCallback send_cls
Definition: internal.h:711
MHD_TLS_CONN_TLS_FAILED
@ MHD_TLS_CONN_TLS_FAILED
Definition: internal.h:552
MHD_Daemon::pool_increment
size_t pool_increment
Definition: internal.h:1457
MHD_Daemon::notify_completed
MHD_RequestCompletedCallback notify_completed
Definition: internal.h:1377
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:952
MHD_Daemon::notify_connection_cls
void * notify_connection_cls
Definition: internal.h:1393
mhd_assert.h
macros for mhd_assert()
MHD_Daemon::per_ip_connection_limit
unsigned int per_ip_connection_limit
Definition: internal.h:1600
MHD_Daemon::apc_cls
void * apc_cls
Definition: internal.h:1371
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_Connection::headers_received_tail
struct MHD_HTTP_Header * headers_received_tail
Definition: internal.h:675
MHD_NonceNc
Definition: internal.h:227
MHD_EVENT_LOOP_INFO_READ
@ MHD_EVENT_LOOP_INFO_READ
Definition: internal.h:189
MHD_Connection::thread_joined
bool thread_joined
Definition: internal.h:779
MHD_TLS_CONN_WR_CLOSED
@ MHD_TLS_CONN_WR_CLOSED
Definition: internal.h:549
MHD_ContentReaderCallback
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
Definition: microhttpd.h:2315
MHD_Connection::read_buffer_offset
size_t read_buffer_offset
Definition: internal.h:789
MHD_NotifyConnectionCallback
void(* MHD_NotifyConnectionCallback)(void *cls, struct MHD_Connection *connection, void **socket_context, enum MHD_ConnectionNotificationCode toe)
Definition: microhttpd.h:2215
MHD_Daemon::default_handler_cls
void * default_handler_cls
Definition: internal.h:1268
MHD_Daemon::shutdown
volatile bool shutdown
Definition: internal.h:1526
MHD_Connection::have_chunked_upload
bool have_chunked_upload
Definition: internal.h:944
MHD_TLS_CONN_INVALID_STATE
@ MHD_TLS_CONN_INVALID_STATE
Definition: internal.h:553
MHD_Connection::headers_received
struct MHD_HTTP_Header * headers_received
Definition: internal.h:670
MHD_NonceNc::nmask
uint64_t nmask
Definition: internal.h:240
MHD_Connection::current_chunk_offset
uint64_t current_chunk_offset
Definition: internal.h:958
MHD_Daemon::pid
MHD_thread_handle_ID_ pid
Definition: internal.h:1249
MHD_Daemon::connection_timeout
time_t connection_timeout
Definition: internal.h:1594
MHD_Connection::state
enum MHD_CONNECTION_STATE state
Definition: internal.h:924
MHD_Daemon::cleanup_connection_mutex
MHD_mutex_ cleanup_connection_mutex
Definition: internal.h:1265
MHD_Connection::keepalive
enum MHD_ConnKeepAlive keepalive
Definition: internal.h:731
MHD_AccessHandlerCallback
int(* 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:2166
MHD_PanicCallback
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microhttpd.h:2107
MHD_Connection::prevX
struct MHD_Connection * prevX
Definition: internal.h:670
MHD_Response::mutex
MHD_mutex_ mutex
Definition: internal.h:1637
MHD_CONNECTION_CONTINUE_SENT
@ MHD_CONNECTION_CONTINUE_SENT
Definition: internal.h:457
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:245
MHD_Connection::version
char * version
Definition: internal.h:724
MHD_Daemon::manual_timeout_head
struct MHD_Connection * manual_timeout_head
Definition: internal.h:1143
MHD_ConnectionEventLoopInfo
MHD_ConnectionEventLoopInfo
Definition: internal.h:184
MHD_Connection::addr_len
socklen_t addr_len
Definition: internal.h:733
MHD_Daemon
Definition: internal.h:1000
MHD_TLS_CONN_HANDSHAKING
@ MHD_TLS_CONN_HANDSHAKING
Definition: internal.h:546
MHD_HTTP_Header::value
char * value
Definition: internal.h:352
MHD_Connection::colon
char * colon
Definition: internal.h:761
mhd_sockets.h
MHD_CONNECTION_FOOTER_PART_RECEIVED
@ MHD_CONNECTION_FOOTER_PART_RECEIVED
Definition: internal.h:468
MHD_Daemon::unescape_callback_cls
void * unescape_callback_cls
Definition: internal.h:1417
platform.h
platform-specific includes for libmicrohttpd
MHD_Connection::response_write_position
uint64_t response_write_position
Definition: internal.h:824
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:3295
MHD_Connection::event_loop_info
enum MHD_ConnectionEventLoopInfo event_loop_info
Definition: internal.h:929
MHD_ConnKeepAlive
MHD_ConnKeepAlive
Definition: internal.h:154
MHD_EVENT_LOOP_INFO_CLEANUP
@ MHD_EVENT_LOOP_INFO_CLEANUP
Definition: internal.h:204
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:587
MHD_Daemon::default_handler
MHD_AccessHandlerCallback default_handler
Definition: internal.h:1263
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:551
MHD_Connection::suspended_dummy
int suspended_dummy
Definition: internal.h:1017
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:817
MHD_Daemon::notify_connection
MHD_NotifyConnectionCallback notify_connection
Definition: internal.h:1388
MHD_Connection::response
struct MHD_Response * response
Definition: internal.h:680
microhttpd.h
public interface to libmicrohttpd
MHD_Connection::write_buffer
char * write_buffer
Definition: internal.h:744
mhd_itc_types.h
Types for platform-independent inter-thread communication.
MHD_CONNECTION_BODY_RECEIVED
@ MHD_CONNECTION_BODY_RECEIVED
Definition: internal.h:462
MHD_HTTP_Header
Definition: internal.h:337
MHD_Connection::in_idle
bool in_idle
Definition: internal.h:906
MHD_Connection::daemon
struct MHD_Daemon * daemon
Definition: internal.h:675
MHD_Daemon::was_quiesced
volatile bool was_quiesced
Definition: internal.h:1553
MHD_Connection::pid
MHD_thread_handle_ID_ pid
Definition: internal.h:723
MHD_CONNECTION_FOOTERS_SENT
@ MHD_CONNECTION_FOOTERS_SENT
Definition: internal.h:521
MHD_LogCallback
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
Definition: microhttpd.h:1329
MHD_Daemon::connections_tail
struct MHD_Connection * connections_tail
Definition: internal.h:1160
MHD_AcceptPolicyCallback
int(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
Definition: microhttpd.h:2121
MHD_Daemon::strict_for_client
int strict_for_client
Definition: internal.h:1615
MHD_ResponseFlags
MHD_ResponseFlags
Definition: microhttpd.h:2927
MHD_ValueKind
MHD_ValueKind
Definition: microhttpd.h:1757
MHD_CONNECTION_HEADERS_RECEIVED
@ MHD_CONNECTION_HEADERS_RECEIVED
Definition: internal.h:442
MHD_EPOLL_STATE_UNREADY
@ MHD_EPOLL_STATE_UNREADY
Definition: internal.h:594
MHD_CONNECTION_HEADERS_SENDING
@ MHD_CONNECTION_HEADERS_SENDING
Definition: internal.h:480
MHD_Response
Definition: internal.h:1567
MHD_Connection::responseCode
unsigned int responseCode
Definition: internal.h:935
MHD_Response::crc_cls
void * crc_cls
Definition: internal.h:1594
MHD_Connection::write_buffer_send_offset
size_t write_buffer_send_offset
Definition: internal.h:799
MHD_Connection
Definition: internal.h:633
MHD_TLS_CONN_NO_TLS
@ MHD_TLS_CONN_NO_TLS
Definition: internal.h:544
MHD_Daemon::connections_head
struct MHD_Connection * connections_head
Definition: internal.h:1155
MHD_Connection::header_size
size_t header_size
Definition: internal.h:811
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:1407
MHD_Connection::url
const char * url
Definition: internal.h:718
MHD_Connection::read_buffer_size
size_t read_buffer_size
Definition: internal.h:783
MHD_CONNECTION_STATE
MHD_CONNECTION_STATE
Definition: internal.h:421
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:545
MHD_PskServerCredentialsCallback
int(* MHD_PskServerCredentialsCallback)(void *cls, const struct MHD_Connection *connection, const char *username, void **psk, size_t *psk_size)
Definition: microhttpd.h:1347
MHD_Connection::method
char * method
Definition: internal.h:712
MHD_Response::flags
enum MHD_ResponseFlags flags
Definition: internal.h:401
MHD_Connection::client_aware
bool client_aware
Definition: internal.h:867
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:323
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:1507
MHD_CONNECTION_HEADER_PART_RECEIVED
@ MHD_CONNECTION_HEADER_PART_RECEIVED
Definition: internal.h:437
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:698
MHD_CONNECTION_INIT
@ MHD_CONNECTION_INIT
Definition: internal.h:427
MHD_Connection::last
char * last
Definition: internal.h:752
mhd_panic
MHD_PanicCallback mhd_panic
Definition: panic.c:31
MHD_TLS_CONN_TLS_CLOSING
@ MHD_TLS_CONN_TLS_CLOSING
Definition: internal.h:550
MHD_CONNECTION_HEADERS_SENT
@ MHD_CONNECTION_HEADERS_SENT
Definition: internal.h:485
MHD_Connection::continue_message_write_offset
size_t continue_message_write_offset
Definition: internal.h:838
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:194
MHD_Connection::read_buffer
char * read_buffer
Definition: internal.h:738
MHD_CONNECTION_FOOTERS_SENDING
@ MHD_CONNECTION_FOOTERS_SENDING
Definition: internal.h:516