GNU libmicrohttpd 0.9.71
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#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
115extern 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_
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
179
180
185{
190
195
200
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
254void
255MHD_DLOG (const struct MHD_Daemon *daemon,
256 const char *format,
257 ...);
258
259#endif
260
261
265struct MHD_HTTP_Header
266{
270 struct MHD_HTTP_Header *next;
271
275 char *header;
276
281
285 char *value;
286
291
296 enum MHD_ValueKind kind;
297
298};
299
300
304struct MHD_Response
305{
306
313
318 char *data;
319
324 void *crc_cls;
325
331
337
338#ifdef UPGRADE_SUPPORT
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)
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
533 MHD_CONNECTION_UPGRADE
534#endif /* UPGRADE_SUPPORT */
535
536};
537
538
543{
555
559#define DEBUG_STATES MHD_NO
560
561
562#ifdef HAVE_MESSAGES
563#if DEBUG_STATES
564const char *
565MHD_state_to_string (enum MHD_CONNECTION_STATE state);
566
567#endif
568#endif
569
578typedef ssize_t
579(*ReceiveCallback) (struct MHD_Connection *conn,
580 void *write_to,
581 size_t max_bytes);
582
583
592typedef ssize_t
593(*TransmitCallback) (struct MHD_Connection *conn,
594 const void *read_from,
595 size_t max_bytes);
596
597
602{
607
612
618
619
623struct MHD_Connection
624{
625
626#ifdef EPOLL_SUPPORT
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
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)
774 MHD_thread_handle_ID_ pid;
775#endif
776
784
790
795
800
806
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)
899 bool thread_joined;
900#endif
901
907
913
914#ifdef EPOLL_SUPPORT
918 enum MHD_EpollState epoll_state;
919#endif
920
925
930
935 unsigned int responseCode;
936
945
953
959
964
965#ifdef UPGRADE_SUPPORT
972 struct MHD_UpgradeResponseHandle *urh;
973#endif /* UPGRADE_SUPPORT */
974
975#ifdef HTTPS_SUPPORT
976
980 gnutls_session_t tls_session;
981
985 int protocol;
986
990 int cipher;
991
995 enum MHD_TLS_CONN_STATE tls_state;
996
1001 bool tls_read_ready;
1002#endif /* HTTPS_SUPPORT */
1003
1007 bool suspended;
1008
1013
1017 bool resuming;
1018};
1019
1020
1021#ifdef UPGRADE_SUPPORT
1031#define RESERVE_EBUF_SIZE 8
1032
1039struct UpgradeEpollHandle
1040{
1045 struct MHD_UpgradeResponseHandle *urh;
1046
1062 MHD_socket socket;
1063
1067 enum MHD_EpollState celi;
1068
1069};
1070
1071
1077struct MHD_UpgradeResponseHandle
1078{
1084 struct MHD_Connection *connection;
1085
1086#ifdef HTTPS_SUPPORT
1090 struct MHD_UpgradeResponseHandle *next;
1091
1095 struct MHD_UpgradeResponseHandle *prev;
1096
1097#ifdef EPOLL_SUPPORT
1101 struct MHD_UpgradeResponseHandle *nextE;
1102
1106 struct MHD_UpgradeResponseHandle *prevE;
1107
1111 bool in_eready_list;
1112#endif
1113
1119 char *in_buffer;
1120
1126 char *out_buffer;
1127
1133 size_t in_buffer_size;
1134
1140 size_t out_buffer_size;
1141
1149 size_t in_buffer_used;
1150
1158 size_t out_buffer_used;
1159
1163 struct UpgradeEpollHandle app;
1164
1169 struct UpgradeEpollHandle mhd;
1170
1175 char e_buf[RESERVE_EBUF_SIZE];
1176
1177#endif /* HTTPS_SUPPORT */
1178
1189 volatile bool was_closed;
1190
1212 bool clean_ready;
1213};
1214#endif /* UPGRADE_SUPPORT */
1215
1216
1225typedef void *
1226(*LogCallback)(void *cls,
1227 const char *uri,
1228 struct MHD_Connection *con);
1229
1239typedef size_t
1240(*UnescapeCallback)(void *cls,
1241 struct MHD_Connection *conn,
1242 char *uri);
1243
1244
1252struct MHD_Daemon
1253{
1254
1259
1264
1269
1274
1279
1284
1289
1294
1295#ifdef EPOLL_SUPPORT
1299 struct MHD_Connection *eready_head;
1300
1304 struct MHD_Connection *eready_tail;
1305
1306#ifdef UPGRADE_SUPPORT
1310 struct MHD_UpgradeResponseHandle *eready_urh_head;
1311
1315 struct MHD_UpgradeResponseHandle *eready_urh_tail;
1316#endif /* UPGRADE_SUPPORT */
1317#endif /* EPOLL_SUPPORT */
1318
1334
1341
1349
1356
1362
1366 void *apc_cls;
1367
1373
1378
1384
1389
1398
1403
1408
1413
1414#ifdef HAVE_MESSAGES
1419 MHD_LogCallback custom_error_log;
1420
1424 void *custom_error_log_cls;
1425#endif
1426
1430 struct MHD_Daemon *master;
1431
1432#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1436 struct MHD_Daemon *worker_pool;
1437#endif
1438
1443
1448
1453
1454#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1458 size_t thread_stack_size;
1459
1463 unsigned int worker_pool_size;
1464
1468 MHD_thread_handle_ID_ pid;
1469
1473 MHD_mutex_ per_ip_connection_mutex;
1474
1479 MHD_mutex_ cleanup_connection_mutex;
1480#endif
1481
1487
1492
1503
1504#ifdef EPOLL_SUPPORT
1508 int epoll_fd;
1509
1514 bool listen_socket_in_epoll;
1515
1516#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
1521 int epoll_upgrade_fd;
1522
1527 bool upgrade_fd_in_epoll;
1528#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
1529
1530#endif
1531
1536 struct MHD_itc_ itc;
1537
1541 volatile bool shutdown;
1542
1548 volatile bool was_quiesced;
1549
1557 bool at_limit;
1558
1559 /*
1560 * Do we need to process resuming connections?
1561 */
1562 bool resuming;
1563
1574
1578 unsigned int connections;
1579
1583 unsigned int connection_limit;
1584
1590
1596
1601
1605 uint16_t port;
1606
1611
1612#ifdef HTTPS_SUPPORT
1613#ifdef UPGRADE_SUPPORT
1619 struct MHD_UpgradeResponseHandle *urh_head;
1620
1626 struct MHD_UpgradeResponseHandle *urh_tail;
1627#endif /* UPGRADE_SUPPORT */
1628
1632 gnutls_priority_t priority_cache;
1633
1638 gnutls_credentials_type_t cred_type;
1639
1643 gnutls_certificate_credentials_t x509_cred;
1644
1648 gnutls_dh_params_t dh_params;
1649
1653 gnutls_psk_server_credentials_t psk_cred;
1654
1655#if GNUTLS_VERSION_MAJOR >= 3
1660 gnutls_certificate_retrieve_function2 *cert_callback;
1661
1666
1670 void *cred_callback_cls;
1671#endif
1672
1673#if GNUTLS_VERSION_NUMBER >= 0x030603
1678 gnutls_certificate_retrieve_function3 *cert_callback2;
1679#endif
1680
1684 const char *https_mem_key;
1685
1689 const char *https_mem_cert;
1690
1694 const char *https_key_password;
1695
1699 const char *https_mem_trust;
1700
1704 gnutls_dh_params_t https_mem_dhparams;
1705
1709 bool have_dhparams;
1710
1711#endif /* HTTPS_SUPPORT */
1712
1713#ifdef DAUTH_SUPPORT
1714
1718 const char *digest_auth_random;
1719
1723 struct MHD_NonceNc *nnc;
1724
1725#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
1729 MHD_mutex_ nnc_lock;
1730#endif
1731
1735 size_t digest_auth_rand_size;
1736
1740 unsigned int nonce_nc_size;
1741
1742#endif
1743
1744#ifdef TCP_FASTOPEN
1748 unsigned int fastopen_queue_size;
1749#endif
1750
1755};
1756
1757
1766#define DLL_insert(head,tail,element) do { \
1767 mhd_assert (NULL == (element)->next); \
1768 mhd_assert (NULL == (element)->prev); \
1769 (element)->next = (head); \
1770 (element)->prev = NULL; \
1771 if ((tail) == NULL) \
1772 (tail) = element; \
1773 else \
1774 (head)->prev = element; \
1775 (head) = (element); } while (0)
1776
1777
1787#define DLL_remove(head,tail,element) do { \
1788 mhd_assert ( (NULL != (element)->next) || ((element) == (tail))); \
1789 mhd_assert ( (NULL != (element)->prev) || ((element) == (head))); \
1790 if ((element)->prev == NULL) \
1791 (head) = (element)->next; \
1792 else \
1793 (element)->prev->next = (element)->next; \
1794 if ((element)->next == NULL) \
1795 (tail) = (element)->prev; \
1796 else \
1797 (element)->next->prev = (element)->prev; \
1798 (element)->next = NULL; \
1799 (element)->prev = NULL; } while (0)
1800
1801
1810#define XDLL_insert(head,tail,element) do { \
1811 mhd_assert (NULL == (element)->nextX); \
1812 mhd_assert (NULL == (element)->prevX); \
1813 (element)->nextX = (head); \
1814 (element)->prevX = NULL; \
1815 if (NULL == (tail)) \
1816 (tail) = element; \
1817 else \
1818 (head)->prevX = element; \
1819 (head) = (element); } while (0)
1820
1821
1831#define XDLL_remove(head,tail,element) do { \
1832 mhd_assert ( (NULL != (element)->nextX) || ((element) == (tail))); \
1833 mhd_assert ( (NULL != (element)->prevX) || ((element) == (head))); \
1834 if (NULL == (element)->prevX) \
1835 (head) = (element)->nextX; \
1836 else \
1837 (element)->prevX->nextX = (element)->nextX; \
1838 if (NULL == (element)->nextX) \
1839 (tail) = (element)->prevX; \
1840 else \
1841 (element)->nextX->prevX = (element)->prevX; \
1842 (element)->nextX = NULL; \
1843 (element)->prevX = NULL; } while (0)
1844
1845
1854#define EDLL_insert(head,tail,element) do { \
1855 (element)->nextE = (head); \
1856 (element)->prevE = NULL; \
1857 if ((tail) == NULL) \
1858 (tail) = element; \
1859 else \
1860 (head)->prevE = element; \
1861 (head) = (element); } while (0)
1862
1863
1873#define EDLL_remove(head,tail,element) do { \
1874 if ((element)->prevE == NULL) \
1875 (head) = (element)->nextE; \
1876 else \
1877 (element)->prevE->nextE = (element)->nextE; \
1878 if ((element)->nextE == NULL) \
1879 (tail) = (element)->prevE; \
1880 else \
1881 (element)->nextE->prevE = (element)->prevE; \
1882 (element)->nextE = NULL; \
1883 (element)->prevE = NULL; } while (0)
1884
1885
1891void
1893
1894
1908typedef enum MHD_Result
1909(*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
1910 const char *key,
1911 size_t key_size,
1912 const char *value,
1913 size_t value_size,
1914 enum MHD_ValueKind kind);
1915
1916
1931enum MHD_Result
1932MHD_parse_arguments_ (struct MHD_Connection *connection,
1933 enum MHD_ValueKind kind,
1934 char *args,
1936 unsigned int *num_headers);
1937
1938
1955bool
1957 const char *key,
1958 size_t key_len,
1959 const char *token,
1960 size_t token_len);
1961
1973#define MHD_check_response_header_s_token_ci(r,k,tkn) \
1974 MHD_check_response_header_token_ci ((r),(k),MHD_STATICSTR_LEN_ (k), \
1975 (tkn),MHD_STATICSTR_LEN_ (tkn))
1976
1977
1987void
1988internal_suspend_connection_ (struct MHD_Connection *connection);
1989
1990#endif
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microhttpd.h:2116
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
Definition: microhttpd.h:1337
void(* MHD_NotifyConnectionCallback)(void *cls, struct MHD_Connection *connection, void **socket_context, enum MHD_ConnectionNotificationCode toe)
Definition: microhttpd.h:2224
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
Definition: microhttpd.h:2198
void(* MHD_ContentReaderFreeCallback)(void *cls)
Definition: microhttpd.h:2340
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:422
@ MHD_CONNECTION_BODY_RECEIVED
Definition: internal.h:462
@ MHD_CONNECTION_HEADER_PART_RECEIVED
Definition: internal.h:437
@ MHD_CONNECTION_HEADERS_SENDING
Definition: internal.h:480
@ MHD_CONNECTION_FOOTERS_SENDING
Definition: internal.h:516
@ MHD_CONNECTION_FOOTERS_RECEIVED
Definition: internal.h:474
@ MHD_CONNECTION_HEADERS_SENT
Definition: internal.h:485
@ MHD_CONNECTION_HEADERS_PROCESSED
Definition: internal.h:447
@ MHD_CONNECTION_INIT
Definition: internal.h:427
@ MHD_CONNECTION_CLOSED
Definition: internal.h:526
@ MHD_CONNECTION_NORMAL_BODY_UNREADY
Definition: internal.h:496
@ MHD_CONNECTION_HEADERS_RECEIVED
Definition: internal.h:442
@ MHD_CONNECTION_NORMAL_BODY_READY
Definition: internal.h:490
@ MHD_CONNECTION_CHUNKED_BODY_READY
Definition: internal.h:501
@ MHD_CONNECTION_FOOTER_PART_RECEIVED
Definition: internal.h:468
@ MHD_CONNECTION_CONTINUE_SENT
Definition: internal.h:457
@ MHD_CONNECTION_FOOTERS_SENT
Definition: internal.h:521
@ MHD_CONNECTION_CHUNKED_BODY_UNREADY
Definition: internal.h:506
@ MHD_CONNECTION_BODY_SENT
Definition: internal.h:511
@ MHD_CONNECTION_CONTINUE_SENDING
Definition: internal.h:452
@ MHD_CONNECTION_URL_RECEIVED
Definition: internal.h:432
bool MHD_check_response_header_token_ci(const struct MHD_Response *response, const char *key, size_t key_len, const char *token, size_t token_len)
Definition: response.c:323
void internal_suspend_connection_(struct MHD_Connection *connection)
Definition: daemon.c:2810
MHD_TLS_CONN_STATE
Definition: internal.h:543
@ MHD_TLS_CONN_TLS_CLOSING
Definition: internal.h:550
@ MHD_TLS_CONN_WR_CLOSING
Definition: internal.h:548
@ MHD_TLS_CONN_INVALID_STATE
Definition: internal.h:553
@ MHD_TLS_CONN_WR_CLOSED
Definition: internal.h:549
@ MHD_TLS_CONN_NO_TLS
Definition: internal.h:544
@ MHD_TLS_CONN_INIT
Definition: internal.h:545
@ MHD_TLS_CONN_TLS_CLOSED
Definition: internal.h:551
@ MHD_TLS_CONN_TLS_FAILED
Definition: internal.h:552
@ MHD_TLS_CONN_CONNECTED
Definition: internal.h:547
@ MHD_TLS_CONN_HANDSHAKING
Definition: internal.h:546
MHD_ConnectionEventLoopInfo
Definition: internal.h:185
@ MHD_EVENT_LOOP_INFO_READ
Definition: internal.h:189
@ MHD_EVENT_LOOP_INFO_WRITE
Definition: internal.h:194
@ MHD_EVENT_LOOP_INFO_CLEANUP
Definition: internal.h:204
@ MHD_EVENT_LOOP_INFO_BLOCK
Definition: internal.h:199
void *(* LogCallback)(void *cls, const char *uri, struct MHD_Connection *con)
Definition: internal.h:1226
#define MAX_NONCE_LENGTH
Definition: internal.h:220
void MHD_unescape_plus(char *arg)
Definition: internal.c:123
size_t(* UnescapeCallback)(void *cls, struct MHD_Connection *conn, char *uri)
Definition: internal.h:1240
macros for mhd_assert()
Types for platform-independent inter-thread communication.
public interface to libmicrohttpd
int MHD_socket
Definition: microhttpd.h:195
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:3304
MHD_DisableSanityCheck
Definition: microhttpd.h:1725
MHD_Result
Definition: microhttpd.h:141
enum MHD_Result(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
Definition: microhttpd.h:2130
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
Definition: microhttpd.h:2324
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:2175
MHD_ValueKind
Definition: microhttpd.h:1766
int(* MHD_PskServerCredentialsCallback)(void *cls, const struct MHD_Connection *connection, const char *username, void **psk, size_t *psk_size)
Definition: microhttpd.h:1355
MHD_FLAG
Flags for the struct MHD_Daemon.
Definition: microhttpd.h:1038
MHD_ResponseFlags
Definition: microhttpd.h:2937
platform-specific includes for libmicrohttpd
MHD_socket socket_fd
Definition: internal.h:752
size_t write_buffer_size
Definition: internal.h:794
size_t write_buffer_send_offset
Definition: internal.h:799
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:929
size_t write_buffer_append_offset
Definition: internal.h:805
char * last
Definition: internal.h:752
char * write_buffer
Definition: internal.h:744
bool sk_cork_on
Definition: internal.h:885
bool tls_read_ready
Definition: internal.h:769
uint64_t remaining_upload_size
Definition: internal.h:817
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:761
size_t header_size
Definition: internal.h:811
struct MHD_Response * response
Definition: internal.h:680
const char * url
Definition: internal.h:718
char * version
Definition: internal.h:724
bool sk_nonblck
Definition: internal.h:784
struct MHD_Connection * next
Definition: internal.h:651
enum MHD_ConnKeepAlive keepalive
Definition: internal.h:731
time_t connection_timeout
Definition: internal.h:745
struct MHD_HTTP_Header * headers_received
Definition: internal.h:670
size_t continue_message_write_offset
Definition: internal.h:838
uint64_t response_write_position
Definition: internal.h:824
struct MHD_HTTP_Header * headers_received_tail
Definition: internal.h:675
char * method
Definition: internal.h:712
uint64_t current_chunk_offset
Definition: internal.h:958
struct MemoryPool * pool
Definition: internal.h:685
size_t read_buffer_offset
Definition: internal.h:789
struct MHD_Connection * prev
Definition: internal.h:656
uint64_t current_chunk_size
Definition: internal.h:952
int suspended_dummy
Definition: internal.h:1012
bool client_aware
Definition: internal.h:867
unsigned int responseCode
Definition: internal.h:935
MHD_thread_handle_ID_ pid
Definition: internal.h:723
struct MHD_Connection * nextX
Definition: internal.h:665
bool have_chunked_upload
Definition: internal.h:944
bool read_closed
Definition: internal.h:792
time_t last_activity
Definition: internal.h:739
bool in_cleanup
Definition: internal.h:912
void * client_context
Definition: internal.h:698
enum MHD_CONNECTION_STATE state
Definition: internal.h:924
char * read_buffer
Definition: internal.h:738
struct sockaddr * addr
Definition: internal.h:767
struct MHD_Daemon * daemon
Definition: internal.h:675
unsigned int connection_timeout_dummy
Definition: internal.h:860
size_t read_buffer_size
Definition: internal.h:783
bool thread_joined
Definition: internal.h:779
size_t pool_size
Definition: internal.h:1447
MHD_NotifyConnectionCallback notify_connection
Definition: internal.h:1383
MHD_AccessHandlerCallback default_handler
Definition: internal.h:1258
LogCallback uri_log_callback
Definition: internal.h:1397
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
uint16_t port
Definition: internal.h:1605
unsigned int connection_limit
Definition: internal.h:1583
void * unescape_callback_cls
Definition: internal.h:1412
MHD_mutex_ cleanup_connection_mutex
Definition: internal.h:1265
enum MHD_DisableSanityCheck insanity_level
Definition: internal.h:1486
struct MHD_Connection * connections_head
Definition: internal.h:1155
unsigned int listen_backlog_size
Definition: internal.h:1754
MHD_RequestCompletedCallback notify_completed
Definition: internal.h:1372
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:1502
void * apc_cls
Definition: internal.h:1366
unsigned int per_ip_connection_limit
Definition: internal.h:1595
struct MHD_Connection * manual_timeout_tail
Definition: internal.h:1150
volatile bool shutdown
Definition: internal.h:1526
enum MHD_FLAG options
Definition: internal.h:1600
void * notify_connection_cls
Definition: internal.h:1388
UnescapeCallback unescape_callback
Definition: internal.h:1407
void * notify_completed_cls
Definition: internal.h:1377
struct MHD_Connection * cleanup_tail
Definition: internal.h:1182
volatile bool was_quiesced
Definition: internal.h:1548
bool resuming
Definition: internal.h:1510
struct MHD_Daemon * worker_pool
Definition: internal.h:1073
MHD_thread_handle_ID_ pid
Definition: internal.h:1249
struct MHD_Connection * manual_timeout_head
Definition: internal.h:1143
void * default_handler_cls
Definition: internal.h:1263
struct MHD_Connection * suspended_connections_tail
Definition: internal.h:1172
time_t connection_timeout
Definition: internal.h:1589
MHD_AcceptPolicyCallback apc
Definition: internal.h:1361
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
size_t pool_increment
Definition: internal.h:1452
MHD_socket listen_fd
Definition: internal.h:1491
void * uri_log_callback_cls
Definition: internal.h:1402
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:1610
size_t value_size
Definition: internal.h:290
char * header
Definition: internal.h:347
enum MHD_ValueKind kind
Definition: internal.h:358
size_t header_size
Definition: internal.h:280
struct MHD_HTTP_Header * next
Definition: internal.h:342
char * value
Definition: internal.h:352
uint64_t nc
Definition: internal.h:234
uint64_t nmask
Definition: internal.h:240
char nonce[MAX_NONCE_LENGTH]
Definition: internal.h:245
MHD_ContentReaderFreeCallback crfc
Definition: internal.h:1606
struct MHD_HTTP_Header * first_header
Definition: internal.h:1582
void * crc_cls
Definition: internal.h:1594
size_t data_buffer_size
Definition: internal.h:1664
uint64_t data_start
Definition: internal.h:1648
MHD_ContentReaderCallback crc
Definition: internal.h:1600
size_t data_size
Definition: internal.h:1659
enum MHD_ResponseFlags flags
Definition: internal.h:401
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