GNU libmicrohttpd 0.9.73
Loading...
Searching...
No Matches
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 } \
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
110#define _MHD_DEBUG_CONNECT _MHD_MACRO_NO
111#endif /* ! _MHD_DEBUG_CONNECT */
112
113#ifndef _MHD_DEBUG_SEND_DATA
117#define _MHD_DEBUG_SEND_DATA _MHD_MACRO_NO
118#endif /* ! _MHD_DEBUG_SEND_DATA */
119
120#ifndef _MHD_DEBUG_CLOSE
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
150extern 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_
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
181
182
187{
188
194
200
206
211
216
221
227
228
233{
238
243
248
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
302void
303MHD_DLOG (const struct MHD_Daemon *daemon,
304 const char *format,
305 ...);
306
307#endif
308
309
313struct MHD_HTTP_Header
314{
318 struct MHD_HTTP_Header *next;
319
323 char *header;
324
329
333 char *value;
334
339
344 enum MHD_ValueKind kind;
345
346};
347
348
349#if defined(MHD_WINSOCK_SOCKETS)
354typedef 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
360typedef unsigned long MHD_iov_size_;
361#elif defined(HAVE_SENDMSG) || defined(HAVE_WRITEV)
366typedef struct iovec MHD_iovec_;
367#define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX
368typedef size_t MHD_iov_size_;
369#else
374typedef struct MHD_IoVec MHD_iovec_;
375#define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX
376typedef size_t MHD_iov_size_;
377#endif
378
379
381{
388
393 size_t cnt;
394
400 size_t sent;
401};
402
406struct MHD_Response
407{
408
415
420 char *data;
421
426 void *crc_cls;
427
433
439
440#ifdef UPGRADE_SUPPORT
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)
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
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
649 MHD_CONNECTION_UPGRADE
650#endif /* UPGRADE_SUPPORT */
651
652};
653
654
659{
671
675#define DEBUG_STATES MHD_NO
676
677
678#ifdef HAVE_MESSAGES
679#if DEBUG_STATES
680const char *
681MHD_state_to_string (enum MHD_CONNECTION_STATE state);
682
683#endif
684#endif
685
694typedef ssize_t
695(*ReceiveCallback) (struct MHD_Connection *conn,
696 void *write_to,
697 size_t max_bytes);
698
699
708typedef ssize_t
709(*TransmitCallback) (struct MHD_Connection *conn,
710 const void *read_from,
711 size_t max_bytes);
712
713
718{
723
728
734
735
739struct MHD_Connection
740{
741
742#ifdef EPOLL_SUPPORT
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
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)
890 MHD_thread_handle_ID_ pid;
891#endif
892
900
906
911
916
922
928
934
941
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
1006
1010 bool sk_nonblck;
1011
1016
1021
1026
1033 bool read_closed;
1034
1035#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1039 bool thread_joined;
1040#endif
1041
1047
1053
1054#ifdef EPOLL_SUPPORT
1058 enum MHD_EpollState epoll_state;
1059#endif
1060
1065
1070
1075 unsigned int responseCode;
1076
1085
1093
1099
1104
1105#ifdef UPGRADE_SUPPORT
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
1171#define RESERVE_EBUF_SIZE 8
1172
1179struct UpgradeEpollHandle
1180{
1185 struct MHD_UpgradeResponseHandle *urh;
1186
1202 MHD_socket socket;
1203
1207 enum MHD_EpollState celi;
1208
1209};
1210
1211
1217struct MHD_UpgradeResponseHandle
1218{
1224 struct MHD_Connection *connection;
1225
1226#ifdef HTTPS_SUPPORT
1230 struct MHD_UpgradeResponseHandle *next;
1231
1235 struct MHD_UpgradeResponseHandle *prev;
1236
1237#ifdef EPOLL_SUPPORT
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
1365typedef void *
1366(*LogCallback)(void *cls,
1367 const char *uri,
1368 struct MHD_Connection *con);
1369
1379typedef size_t
1380(*UnescapeCallback)(void *cls,
1381 struct MHD_Connection *conn,
1382 char *uri);
1383
1384
1392struct MHD_Daemon
1393{
1394
1399
1404
1412
1417
1422
1427
1432
1437
1442
1447
1452
1457
1458#ifdef EPOLL_SUPPORT
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
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
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)
1643 struct MHD_Daemon *worker_pool;
1644#endif
1645
1650
1657 unsigned int connections;
1658
1663
1668
1669#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
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
1768
1772 unsigned int connection_limit;
1773
1779
1785
1790
1795
1796#ifdef HTTPS_SUPPORT
1797#ifdef UPGRADE_SUPPORT
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
1844 gnutls_certificate_retrieve_function2 *cert_callback;
1845
1850
1854 void *cred_callback_cls;
1855#endif
1856
1857#if GNUTLS_VERSION_NUMBER >= 0x030603
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)
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
1937 unsigned int fastopen_queue_size;
1938#endif
1939
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
2098void
2100
2101
2115typedef 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
2138enum MHD_Result
2139MHD_parse_arguments_ (struct MHD_Connection *connection,
2140 enum MHD_ValueKind kind,
2141 char *args,
2143 unsigned int *num_headers);
2144
2145
2162bool
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
2194void
2195internal_suspend_connection_ (struct MHD_Connection *connection);
2196
2197#endif
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microhttpd.h:2168
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
Definition: microhttpd.h:1349
void(* MHD_NotifyConnectionCallback)(void *cls, struct MHD_Connection *connection, void **socket_context, enum MHD_ConnectionNotificationCode toe)
Definition: microhttpd.h:2276
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
Definition: microhttpd.h:2250
void(* MHD_ContentReaderFreeCallback)(void *cls)
Definition: microhttpd.h:2392
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:538
@ MHD_CONNECTION_BODY_RECEIVED
Definition: internal.h:578
@ MHD_CONNECTION_HEADER_PART_RECEIVED
Definition: internal.h:553
@ MHD_CONNECTION_HEADERS_SENDING
Definition: internal.h:596
@ MHD_CONNECTION_FOOTERS_SENDING
Definition: internal.h:632
@ MHD_CONNECTION_FOOTERS_RECEIVED
Definition: internal.h:590
@ MHD_CONNECTION_HEADERS_SENT
Definition: internal.h:601
@ MHD_CONNECTION_HEADERS_PROCESSED
Definition: internal.h:563
@ MHD_CONNECTION_INIT
Definition: internal.h:543
@ MHD_CONNECTION_CLOSED
Definition: internal.h:642
@ MHD_CONNECTION_NORMAL_BODY_UNREADY
Definition: internal.h:612
@ MHD_CONNECTION_HEADERS_RECEIVED
Definition: internal.h:558
@ MHD_CONNECTION_NORMAL_BODY_READY
Definition: internal.h:606
@ MHD_CONNECTION_CHUNKED_BODY_READY
Definition: internal.h:617
@ MHD_CONNECTION_FOOTER_PART_RECEIVED
Definition: internal.h:584
@ MHD_CONNECTION_CONTINUE_SENT
Definition: internal.h:573
@ MHD_CONNECTION_FOOTERS_SENT
Definition: internal.h:637
@ MHD_CONNECTION_CHUNKED_BODY_UNREADY
Definition: internal.h:622
@ MHD_CONNECTION_BODY_SENT
Definition: internal.h:627
@ MHD_CONNECTION_CONTINUE_SENDING
Definition: internal.h:568
@ MHD_CONNECTION_URL_RECEIVED
Definition: internal.h:548
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_EpollState
Definition: internal.h:187
void internal_suspend_connection_(struct MHD_Connection *connection)
Definition: daemon.c:3038
MHD_TLS_CONN_STATE
Definition: internal.h:659
@ MHD_TLS_CONN_TLS_CLOSING
Definition: internal.h:666
@ MHD_TLS_CONN_WR_CLOSING
Definition: internal.h:664
@ MHD_TLS_CONN_INVALID_STATE
Definition: internal.h:669
@ MHD_TLS_CONN_WR_CLOSED
Definition: internal.h:665
@ MHD_TLS_CONN_NO_TLS
Definition: internal.h:660
@ MHD_TLS_CONN_INIT
Definition: internal.h:661
@ MHD_TLS_CONN_TLS_CLOSED
Definition: internal.h:667
@ MHD_TLS_CONN_TLS_FAILED
Definition: internal.h:668
@ MHD_TLS_CONN_CONNECTED
Definition: internal.h:663
@ MHD_TLS_CONN_HANDSHAKING
Definition: internal.h:662
MHD_ConnectionEventLoopInfo
Definition: internal.h:233
@ MHD_EVENT_LOOP_INFO_READ
Definition: internal.h:237
@ MHD_EVENT_LOOP_INFO_WRITE
Definition: internal.h:242
@ MHD_EVENT_LOOP_INFO_CLEANUP
Definition: internal.h:252
@ MHD_EVENT_LOOP_INFO_BLOCK
Definition: internal.h:247
struct MHD_IoVec MHD_iovec_
Definition: internal.h:374
size_t MHD_iov_size_
Definition: internal.h:376
void *(* LogCallback)(void *cls, const char *uri, struct MHD_Connection *con)
Definition: internal.h:1366
MHD_ConnKeepAlive
Definition: internal.h:718
ssize_t(* ReceiveCallback)(struct MHD_Connection *conn, void *write_to, size_t max_bytes)
Definition: internal.h:695
#define MAX_NONCE_LENGTH
Definition: internal.h:268
void MHD_unescape_plus(char *arg)
Definition: internal.c:123
size_t(* UnescapeCallback)(void *cls, struct MHD_Connection *conn, char *uri)
Definition: internal.h:1380
MHD_tristate
Definition: internal.h:174
@ _MHD_ON
Definition: internal.h:178
@ _MHD_UNKNOWN
Definition: internal.h:175
@ _MHD_YES
Definition: internal.h:179
@ _MHD_OFF
Definition: internal.h:176
@ _MHD_NO
Definition: internal.h:177
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:193
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_DisableSanityCheck
Definition: microhttpd.h:1759
MHD_Result
Definition: microhttpd.h:139
enum MHD_Result(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
Definition: microhttpd.h:2182
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
Definition: microhttpd.h:2376
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_ValueKind
Definition: microhttpd.h:1800
int(* MHD_PskServerCredentialsCallback)(void *cls, const struct MHD_Connection *connection, const char *username, void **psk, size_t *psk_size)
Definition: microhttpd.h:1367
MHD_FLAG
Flags for the struct MHD_Daemon.
Definition: microhttpd.h:1050
MHD_ResponseFlags
Definition: microhttpd.h:3024
platform-specific includes for libmicrohttpd
MHD_socket socket_fd
Definition: internal.h:752
enum MHD_tristate sk_nodelay
Definition: internal.h:1025
size_t write_buffer_size
Definition: internal.h:910
size_t write_buffer_send_offset
Definition: internal.h:915
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:1069
size_t write_buffer_append_offset
Definition: internal.h:921
char * last
Definition: internal.h:868
enum MHD_tristate is_nonip
Definition: internal.h:1005
char * write_buffer
Definition: internal.h:860
bool tls_read_ready
Definition: internal.h:769
uint64_t remaining_upload_size
Definition: internal.h:933
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:877
volatile bool resuming
Definition: internal.h:1157
size_t header_size
Definition: internal.h:927
struct MHD_Response * response
Definition: internal.h:796
const char * url
Definition: internal.h:834
char * version
Definition: internal.h:840
bool sk_nonblck
Definition: internal.h:784
struct MHD_Connection * next
Definition: internal.h:651
enum MHD_ConnKeepAlive keepalive
Definition: internal.h:847
time_t connection_timeout
Definition: internal.h:745
struct MHD_HTTP_Header * headers_received
Definition: internal.h:786
size_t continue_message_write_offset
Definition: internal.h:963
uint64_t response_write_position
Definition: internal.h:940
struct MHD_HTTP_Header * headers_received_tail
Definition: internal.h:791
char * method
Definition: internal.h:828
uint64_t current_chunk_offset
Definition: internal.h:1098
struct MemoryPool * pool
Definition: internal.h:685
size_t read_buffer_offset
Definition: internal.h:905
struct MHD_Connection * prev
Definition: internal.h:656
uint64_t current_chunk_size
Definition: internal.h:1092
int suspended_dummy
Definition: internal.h:1152
bool client_aware
Definition: internal.h:992
struct MHD_iovec_track_ resp_iov
Definition: internal.h:948
unsigned int responseCode
Definition: internal.h:1075
MHD_thread_handle_ID_ pid
Definition: internal.h:723
struct MHD_Connection * nextX
Definition: internal.h:665
bool have_chunked_upload
Definition: internal.h:1084
bool read_closed
Definition: internal.h:792
time_t last_activity
Definition: internal.h:739
void * client_context
Definition: internal.h:814
enum MHD_CONNECTION_STATE state
Definition: internal.h:1064
char * read_buffer
Definition: internal.h:854
struct sockaddr * addr
Definition: internal.h:883
struct MHD_Daemon * daemon
Definition: internal.h:675
unsigned int connection_timeout_dummy
Definition: internal.h:985
bool sk_spipe_suppress
Definition: internal.h:1015
size_t read_buffer_size
Definition: internal.h:899
enum MHD_tristate sk_corked
Definition: internal.h:1020
bool thread_joined
Definition: internal.h:779
size_t pool_size
Definition: internal.h:1662
MHD_NotifyConnectionCallback notify_connection
Definition: internal.h:1574
MHD_AccessHandlerCallback default_handler
Definition: internal.h:1398
LogCallback uri_log_callback
Definition: internal.h:1588
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:1421
uint16_t port
Definition: internal.h:1611
unsigned int connection_limit
Definition: internal.h:1772
void * unescape_callback_cls
Definition: internal.h:1603
MHD_mutex_ cleanup_connection_mutex
Definition: internal.h:1265
enum MHD_DisableSanityCheck insanity_level
Definition: internal.h:1706
struct MHD_Connection * connections_head
Definition: internal.h:1155
unsigned int listen_backlog_size
Definition: internal.h:1943
MHD_RequestCompletedCallback notify_completed
Definition: internal.h:1563
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:1717
void * apc_cls
Definition: internal.h:1557
unsigned int per_ip_connection_limit
Definition: internal.h:1784
struct MHD_Connection * manual_timeout_tail
Definition: internal.h:1150
volatile bool shutdown
Definition: internal.h:1526
enum MHD_FLAG options
Definition: internal.h:1411
void * notify_connection_cls
Definition: internal.h:1579
bool sigpipe_blocked
Definition: internal.h:1794
UnescapeCallback unescape_callback
Definition: internal.h:1598
void * notify_completed_cls
Definition: internal.h:1568
struct MHD_Connection * cleanup_tail
Definition: internal.h:1182
volatile bool was_quiesced
Definition: internal.h:1736
size_t num_opts
Definition: internal.h:1952
struct MHD_Daemon * worker_pool
Definition: internal.h:1073
struct MHD_Connection * new_connections_head
Definition: internal.h:1416
MHD_thread_handle_ID_ pid
Definition: internal.h:1249
struct MHD_Connection * manual_timeout_head
Definition: internal.h:1143
enum MHD_tristate listen_is_unix
Definition: internal.h:1456
volatile bool resuming
Definition: internal.h:1750
void * default_handler_cls
Definition: internal.h:1403
struct MHD_Connection * suspended_connections_tail
Definition: internal.h:1172
time_t connection_timeout
Definition: internal.h:1778
MHD_AcceptPolicyCallback apc
Definition: internal.h:1552
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:1756
size_t pool_increment
Definition: internal.h:1667
MHD_socket listen_fd
Definition: internal.h:1637
void * uri_log_callback_cls
Definition: internal.h:1593
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:1789
size_t value_size
Definition: internal.h:338
char * header
Definition: internal.h:347
enum MHD_ValueKind kind
Definition: internal.h:358
size_t header_size
Definition: internal.h:328
struct MHD_HTTP_Header * next
Definition: internal.h:342
char * value
Definition: internal.h:352
uint64_t nc
Definition: internal.h:282
uint64_t nmask
Definition: internal.h:288
char nonce[MAX_NONCE_LENGTH]
Definition: internal.h:293
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
MHD_iovec_ * data_iov
Definition: internal.h:513
uint64_t data_start
Definition: internal.h:1648
MHD_ContentReaderCallback crc
Definition: internal.h:1600
bool is_pipe
Definition: internal.h:508
unsigned int data_iovcnt
Definition: internal.h:518
size_t data_size
Definition: internal.h:1659
enum MHD_ResponseFlags flags
Definition: internal.h:503
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
MHD_iovec_ * iov
Definition: internal.h:387