34 #include <gnutls/gnutls.h> 35 #if GNUTLS_VERSION_MAJOR >= 3 36 #include <gnutls/abstract.h> 40 #include <sys/epoll.h> 42 #if HAVE_NETINET_TCP_H 44 #include <netinet/tcp.h> 52 #define EXTRA_CHECKS MHD_NO 54 #define MHD_MAX(a,b) (((a)<(b)) ? (b) : (a)) 55 #define MHD_MIN(a,b) (((a)<(b)) ? (a) : (b)) 65 #define MHD_BUF_INC_SIZE 1024 79 #if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 80 #define BUILTIN_NOT_REACHED __builtin_unreachable() 81 #elif defined(_MSC_FULL_VER) 82 #define BUILTIN_NOT_REACHED __assume(0) 84 #define BUILTIN_NOT_REACHED 94 #define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); BUILTIN_NOT_REACHED; } while (0) 101 #define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); BUILTIN_NOT_REACHED; } while (0) 179 #define MAX_NONCE_LENGTH 129 193 unsigned long int nc;
209 const char *format, ...);
475 #define DEBUG_STATES MHD_NO 509 const void *write_to,
848 gnutls_session_t tls_session;
887 (*LogCallback)(
void *cls,
1063 void (*custom_error_log) (
void *cls,
const char *fmt, va_list va);
1068 void *custom_error_log_cls;
1145 int listen_socket_in_epoll;
1203 gnutls_priority_t priority_cache;
1209 gnutls_credentials_type_t cred_type;
1214 gnutls_certificate_credentials_t x509_cred;
1219 gnutls_dh_params_t dh_params;
1221 #if GNUTLS_VERSION_MAJOR >= 3 1226 gnutls_certificate_retrieve_function2 *cert_callback;
1232 const char *https_mem_key;
1237 const char *https_mem_cert;
1242 const char *https_key_password;
1247 const char *https_mem_trust;
1252 gnutls_dh_params_t https_mem_dhparams;
1265 unsigned int num_tls_read_ready;
1269 #ifdef DAUTH_SUPPORT 1274 const char *digest_auth_random;
1284 MHD_mutex_ nnc_lock;
1289 size_t digest_auth_rand_size;
1294 unsigned int nonce_nc_size;
1302 unsigned int fastopen_queue_size;
1308 #define EXTRA_CHECK(a) do { if (!(a)) abort(); } while (0) 1310 #define EXTRA_CHECK(a) 1322 #define DLL_insert(head,tail,element) do { \ 1323 EXTRA_CHECK (NULL == (element)->next); \ 1324 EXTRA_CHECK (NULL == (element)->prev); \ 1325 (element)->next = (head); \ 1326 (element)->prev = NULL; \ 1327 if ((tail) == NULL) \ 1330 (head)->prev = element; \ 1331 (head) = (element); } while (0) 1343 #define DLL_remove(head,tail,element) do { \ 1344 EXTRA_CHECK ( (NULL != (element)->next) || ((element) == (tail))); \ 1345 EXTRA_CHECK ( (NULL != (element)->prev) || ((element) == (head))); \ 1346 if ((element)->prev == NULL) \ 1347 (head) = (element)->next; \ 1349 (element)->prev->next = (element)->next; \ 1350 if ((element)->next == NULL) \ 1351 (tail) = (element)->prev; \ 1353 (element)->next->prev = (element)->prev; \ 1354 (element)->next = NULL; \ 1355 (element)->prev = NULL; } while (0) 1367 #define XDLL_insert(head,tail,element) do { \ 1368 EXTRA_CHECK (NULL == (element)->nextX); \ 1369 EXTRA_CHECK (NULL == (element)->prevX); \ 1370 (element)->nextX = (head); \ 1371 (element)->prevX = NULL; \ 1372 if (NULL == (tail)) \ 1375 (head)->prevX = element; \ 1376 (head) = (element); } while (0) 1388 #define XDLL_remove(head,tail,element) do { \ 1389 EXTRA_CHECK ( (NULL != (element)->nextX) || ((element) == (tail))); \ 1390 EXTRA_CHECK ( (NULL != (element)->prevX) || ((element) == (head))); \ 1391 if (NULL == (element)->prevX) \ 1392 (head) = (element)->nextX; \ 1394 (element)->prevX->nextX = (element)->nextX; \ 1395 if (NULL == (element)->nextX) \ 1396 (tail) = (element)->prevX; \ 1398 (element)->nextX->prevX = (element)->prevX; \ 1399 (element)->nextX = NULL; \ 1400 (element)->prevX = NULL; } while (0) 1411 #define EDLL_insert(head,tail,element) do { \ 1412 (element)->nextE = (head); \ 1413 (element)->prevE = NULL; \ 1414 if ((tail) == NULL) \ 1417 (head)->prevE = element; \ 1418 (head) = (element); } while (0) 1430 #define EDLL_remove(head,tail,element) do { \ 1431 if ((element)->prevE == NULL) \ 1432 (head) = (element)->nextE; \ 1434 (element)->prevE->nextE = (element)->nextE; \ 1435 if ((element)->nextE == NULL) \ 1436 (tail) = (element)->prevE; \ 1438 (element)->nextE->prevE = (element)->prevE; \ 1439 (element)->nextE = NULL; \ 1440 (element)->prevE = NULL; } while (0) 1489 unsigned int *num_headers);
unsigned int per_ip_connection_limit
void * unescape_callback_cls
ssize_t(* TransmitCallback)(struct MHD_Connection *conn, const void *write_to, size_t max_bytes)
uint64_t response_write_position
public interface to libmicrohttpd
size_t current_chunk_size
MHD_PanicCallback mhd_panic
MHD_ContentReaderFreeCallback crfc
void(* MHD_ContentReaderFreeCallback)(void *cls)
struct MHD_Response * response
struct MHD_Connection * normal_timeout_tail
void *(* LogCallback)(void *cls, const char *uri, struct MHD_Connection *con)
struct MHD_HTTP_Header * first_header
MHD_AccessHandlerCallback default_handler
size_t current_chunk_offset
uint64_t remaining_upload_size
ssize_t(* ReceiveCallback)(struct MHD_Connection *conn, void *write_to, size_t max_bytes)
unsigned int responseCode
void * uri_log_callback_cls
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
struct MHD_Daemon * daemon
int(* idle_handler)(struct MHD_Connection *connection)
int listening_address_reuse
MHD_mutex_ per_ip_connection_mutex
struct MHD_Connection * manual_timeout_head
MHD_NotifyConnectionCallback notify_connection
struct MHD_Connection * cleanup_head
int(* MHD_ArgumentIterator_)(struct MHD_Connection *connection, const char *key, const char *value, enum MHD_ValueKind kind)
struct MHD_Connection * cleanup_tail
struct MHD_Connection * prev
size_t write_buffer_send_offset
struct MHD_Daemon * worker_pool
struct MHD_Connection * nextX
struct MHD_Connection * manual_timeout_tail
size_t continue_message_write_offset
unsigned int connection_limit
char nonce[MAX_NONCE_LENGTH]
unsigned int worker_pool_size
LogCallback uri_log_callback
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
unsigned int reference_count
int MHD_parse_arguments_(struct MHD_Connection *connection, enum MHD_ValueKind kind, char *args, MHD_ArgumentIterator_ cb, unsigned int *num_headers)
struct MHD_Connection * normal_timeout_head
UnescapeCallback unescape_callback
int(* write_handler)(struct MHD_Connection *connection)
struct MHD_Connection * connections_head
struct MHD_Daemon * master
struct MHD_Connection * next
MHD_AcceptPolicyCallback apc
unsigned int connection_timeout
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)
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
size_t write_buffer_append_offset
MHD_RequestCompletedCallback notify_completed
struct MHD_Connection * prevX
void * notify_completed_cls
TransmitCallback send_cls
size_t(* UnescapeCallback)(void *cls, struct MHD_Connection *conn, char *uri)
void * notify_connection_cls
MHD_ContentReaderCallback crc
struct MHD_Connection * suspended_connections_tail
MHD_ConnectionEventLoopInfo
void * per_ip_connection_count
size_t read_buffer_offset
void * default_handler_cls
unsigned int connection_timeout
MHD_mutex_ cleanup_connection_mutex
int(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
void(* MHD_NotifyConnectionCallback)(void *cls, struct MHD_Connection *connection, void **socket_context, enum MHD_ConnectionNotificationCode toe)
struct MHD_HTTP_Header * headers_received
struct MHD_Connection * connections_tail
MHD_FLAG
Flags for the struct MHD_Daemon.
struct MHD_HTTP_Header * headers_received_tail
void MHD_unescape_plus(char *arg)
struct MHD_Connection * suspended_connections_head