mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
Backported headers changes
This commit is contained in:
+41
-17
@@ -56,7 +56,7 @@ Comment: Bind to the given TCP port and address family.
|
||||
Argument1: enum MHD_AddressFamily af
|
||||
Description1: the address family to use,
|
||||
+ the #MHD_AF_NONE to disable listen socket (the same effect as if this option is not used)
|
||||
Argument2: uint_fast16_t port
|
||||
Argument2: uint_least16_t port
|
||||
Description2: port to use, 0 to let system assign any free port,
|
||||
+ ignored if @a af is #MHD_AF_NONE
|
||||
|
||||
@@ -70,15 +70,25 @@ Comment: Bind to the given socket address.
|
||||
+ If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection.
|
||||
Argument1: size_t sa_len
|
||||
Description1: the size of the socket address pointed by @a sa.
|
||||
Argument2: const struct sockaddr *sa
|
||||
Argument2: /* const */ struct sockaddr *sa
|
||||
Description2: the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or even a UNIX domain socket (AF_UNIX)
|
||||
Argument3: enum MHD_Bool v_dual
|
||||
Description3: When a previous version of the protocol exist (like IPv4 when @a v_sa is IPv6) bind to both protocols (IPv6 and IPv4).
|
||||
CustomSetter: /* custom setter */
|
||||
+ if (option->val.bind_sa.v_sa_len > sizeof (bind_sa))
|
||||
+ return MHD_SC_OPTIONS_INVALID;
|
||||
+ memcpy (&settings->bind_sa.ss,
|
||||
+ option->val.bind_sa.v_sa,
|
||||
+ option->val.bind_sa.v_sa_len);
|
||||
+ settings->bind_sa.ss_len = option->val.bind_sa.v_sa_len;
|
||||
+ if (0 != option->val.bind_sa.v_sa_len)
|
||||
+ {
|
||||
+ if (NULL != settings->bind_sa.v_sa)
|
||||
+ free (settings->bind_sa.v_sa);
|
||||
+
|
||||
+ settings->bind_sa.v_sa = malloc (option->val.bind_sa.v_sa_len);
|
||||
+ if (NULL == settings->bind_sa.v_sa)
|
||||
+ return MHD_SC_DAEMON_MALLOC_FAILURE;
|
||||
+
|
||||
+ memcpy (settings->bind_sa.v_sa, option->val.bind_sa.v_sa,
|
||||
+ option->val.bind_sa.v_sa_len);
|
||||
+ settings->bind_sa.v_sa_len = option->val.bind_sa.v_sa_len;
|
||||
+ settings->bind_sa.v_dual = option->val.bind_sa.v_dual;
|
||||
+ }
|
||||
|
||||
Name: listen_socket
|
||||
Value: 82
|
||||
@@ -121,6 +131,7 @@ Value: 102
|
||||
Comment: Use the given backlog for the listen() call.
|
||||
+
|
||||
+ Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used.
|
||||
+ Zero parameter treated as MHD/system default.
|
||||
Argument1: unsigned int backlog_size
|
||||
Description1: FIXME
|
||||
|
||||
@@ -188,7 +199,10 @@ Description1: the in seconds, zero for no timeout
|
||||
|
||||
Name: GLOBAL_CONNECTION_LIMIT
|
||||
Value: 161
|
||||
Comment: Maximum number of (concurrent) network connections served by daemon
|
||||
Comment: Maximum number of (concurrent) network connections served by daemon.
|
||||
+ @note The real maximum number of network connections could be smaller
|
||||
+ than requested due to the system limitations, like FD_SETSIZE when
|
||||
+ polling by select() is used.
|
||||
Argument1: unsigned int glob_limit
|
||||
Description1: FIXME
|
||||
|
||||
@@ -284,8 +298,7 @@ Comment: The the maximum FD value.
|
||||
+ If listen socket FD is equal or higher that specified value, the daemon fail to start.
|
||||
+ If new connection FD is equal or higher that specified value, the connection is rejected.
|
||||
+ Useful if application uses select() for polling the sockets, system FD_SETSIZE is good value for this option in such case.
|
||||
+ Does not work with #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION().
|
||||
+ Does not work on W32 (WinSock sockets).
|
||||
+ Silently ignored on W32 (WinSock sockets).
|
||||
Argument1: MHD_Socket max_fd
|
||||
Description1: FIXME
|
||||
|
||||
@@ -371,12 +384,23 @@ Argument2: const void *buf
|
||||
Description2: the buffer with strong random data, the content will be copied by MHD
|
||||
Type: struct MHD_DaemonOptionEntropySeed
|
||||
CustomSetter: /* custom setter */
|
||||
+ if (0 != option->val.random_entropy.v_buf_size)
|
||||
+ {
|
||||
+ MHD_entropy_hash_ (&settings->random_entropy,
|
||||
+ option->val.random_entropy.v_buf,
|
||||
+ option->val.random_entropy.v_buf_size);
|
||||
+ }
|
||||
+ /* The is not an easy for automatic generations */
|
||||
+ if (0 != option->val.random_entropy.v_buf_size)
|
||||
+ {
|
||||
+ if (NULL != settings->random_entropy.v_buf)
|
||||
+ free (settings->random_entropy.v_buf);
|
||||
+
|
||||
+ settings->random_entropy.v_buf =
|
||||
+ malloc (option->val.random_entropy.v_buf_size);
|
||||
+ if (NULL == settings->random_entropy.v_buf)
|
||||
+ return MHD_SC_DAEMON_MALLOC_FAILURE;
|
||||
+
|
||||
+ memcpy (settings->random_entropy.v_buf,
|
||||
+ option->val.random_entropy.v_buf,
|
||||
+ option->val.random_entropy.v_buf_size);
|
||||
+ settings->random_entropy.v_buf_size =
|
||||
+ option->val.random_entropy.v_buf_size;
|
||||
+ }
|
||||
|
||||
|
||||
Name: dauth_map_size
|
||||
|
||||
+377
-183
@@ -90,9 +90,10 @@
|
||||
* error code otherwise
|
||||
*/
|
||||
MHD_EXTERN_ enum MHD_StatusCode
|
||||
MHD_daemon_set_options (struct MHD_Daemon *daemon,
|
||||
const struct MHD_DaemonOptionAndValue *options,
|
||||
size_t options_max_num)
|
||||
MHD_daemon_set_options (
|
||||
struct MHD_Daemon *MHD_RESTRICT daemon,
|
||||
const struct MHD_DaemonOptionAndValue *MHD_RESTRICT options,
|
||||
size_t options_max_num)
|
||||
MHD_FN_PAR_NONNULL_ALL_;
|
||||
|
||||
|
||||
@@ -230,9 +231,6 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* other things required to run webserver.
|
||||
* Once all connections are processed, function returns.
|
||||
*
|
||||
* The optional @a next_max_wait pointer returns the same value as
|
||||
* if #MHD_DAEMON_INFO_DYNAMIC_MAX_TIME_TO_WAIT would requested immediately.
|
||||
*
|
||||
* @param daemon the daemon to run
|
||||
* @return #MHD_SC_OK on success, otherwise
|
||||
* an error code
|
||||
@@ -252,6 +250,7 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* The given client socket will be managed (and closed!) by MHD after
|
||||
* this call and must no longer be used directly by the application
|
||||
* afterwards.
|
||||
* The client socket will be closed by MHD even if error returned.
|
||||
*
|
||||
* @param daemon daemon that manages the connection
|
||||
* @param client_socket socket to manage (MHD will expect
|
||||
@@ -265,7 +264,7 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* @ingroup specialized
|
||||
*/
|
||||
MHD_EXTERN_ enum MHD_StatusCode
|
||||
MHD_daemon_add_connection (struct MHD_Daemon *daemon,
|
||||
MHD_daemon_add_connection (struct MHD_Daemon *MHD_RESTRICT daemon,
|
||||
MHD_Socket client_socket,
|
||||
size_t addrlen,
|
||||
const struct sockaddr *addr,
|
||||
@@ -433,8 +432,8 @@ MHD_RESTORE_WARN_UNUSED_FUNC_
|
||||
*/
|
||||
MHD_EXTERN_ enum MHD_StatusCode
|
||||
MHD_connection_set_options (
|
||||
struct MHD_Connection *connection,
|
||||
const struct MHD_ConnectionOptionAndValue *options,
|
||||
struct MHD_Connection *MHD_RESTRICT connection,
|
||||
const struct MHD_ConnectionOptionAndValue *MHD_RESTRICT options,
|
||||
size_t options_max_num)
|
||||
MHD_FN_PAR_NONNULL_ALL_;
|
||||
|
||||
@@ -678,14 +677,15 @@ MHD_FN_PAR_NONNULL_ (4) MHD_FN_PAR_OUT_SIZE_ (4,3);
|
||||
*
|
||||
* @param request request to get values from
|
||||
* @param kind what kind of value are we looking for
|
||||
* @param key the header to look for, NULL to lookup 'trailing' value without a key
|
||||
* @param key the header to look for, empty to lookup 'trailing' value
|
||||
* without a key
|
||||
* @return NULL if no such item was found
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_String *
|
||||
MHD_request_get_value (struct MHD_Request *request,
|
||||
MHD_EXTERN_ const struct MHD_StringNullable *
|
||||
MHD_request_get_value (struct MHD_Request *MHD_RESTRICT request,
|
||||
enum MHD_ValueKind kind,
|
||||
const char *key)
|
||||
const char *MHD_RESTRICT key)
|
||||
MHD_FN_PAR_NONNULL_ (1)
|
||||
MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_CSTR_ (3);
|
||||
|
||||
@@ -696,140 +696,220 @@ MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_CSTR_ (3);
|
||||
* @defgroup httpcode HTTP response codes
|
||||
* @{
|
||||
*/
|
||||
/* Registry export date: 2023-09-29 */
|
||||
/* See http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml */
|
||||
enum MHD_FIXED_ENUM_APP_SET_ MHD_HTTP_StatusCode
|
||||
{
|
||||
/* 100 "Continue". RFC9110, Section 15.2.1. */
|
||||
MHD_HTTP_STATUS_CONTINUE = 100
|
||||
,
|
||||
/* 101 "Switching Protocols". RFC9110, Section 15.2.2. */
|
||||
MHD_HTTP_STATUS_SWITCHING_PROTOCOLS = 101
|
||||
,
|
||||
/* 102 "Processing". RFC2518. */
|
||||
MHD_HTTP_STATUS_PROCESSING = 102
|
||||
,
|
||||
/* 103 "Early Hints". RFC8297. */
|
||||
MHD_HTTP_STATUS_EARLY_HINTS = 103
|
||||
,
|
||||
|
||||
MHD_HTTP_STATUS_CONTINUE = 100
|
||||
/* 200 "OK". RFC9110, Section 15.3.1. */
|
||||
MHD_HTTP_STATUS_OK = 200
|
||||
,
|
||||
MHD_HTTP_STATUS_SWITCHING_PROTOCOLS = 101
|
||||
/* 201 "Created". RFC9110, Section 15.3.2. */
|
||||
MHD_HTTP_STATUS_CREATED = 201
|
||||
,
|
||||
MHD_HTTP_STATUS_PROCESSING = 102
|
||||
,
|
||||
MHD_HTTP_STATUS_OK = 200
|
||||
,
|
||||
MHD_HTTP_STATUS_CREATED = 201
|
||||
,
|
||||
MHD_HTTP_STATUS_ACCEPTED = 202
|
||||
/* 202 "Accepted". RFC9110, Section 15.3.3. */
|
||||
MHD_HTTP_STATUS_ACCEPTED = 202
|
||||
,
|
||||
/* 203 "Non-Authoritative Information". RFC9110, Section 15.3.4. */
|
||||
MHD_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203
|
||||
,
|
||||
MHD_HTTP_STATUS_NO_CONTENT = 204
|
||||
/* 204 "No Content". RFC9110, Section 15.3.5. */
|
||||
MHD_HTTP_STATUS_NO_CONTENT = 204
|
||||
,
|
||||
MHD_HTTP_STATUS_RESET_CONTENT = 205
|
||||
/* 205 "Reset Content". RFC9110, Section 15.3.6. */
|
||||
MHD_HTTP_STATUS_RESET_CONTENT = 205
|
||||
,
|
||||
MHD_HTTP_STATUS_PARTIAL_CONTENT = 206
|
||||
/* 206 "Partial Content". RFC9110, Section 15.3.7. */
|
||||
MHD_HTTP_STATUS_PARTIAL_CONTENT = 206
|
||||
,
|
||||
MHD_HTTP_STATUS_MULTI_STATUS = 207
|
||||
/* 207 "Multi-Status". RFC4918. */
|
||||
MHD_HTTP_STATUS_MULTI_STATUS = 207
|
||||
,
|
||||
MHD_HTTP_STATUS_ALREADY_REPORTED = 208
|
||||
/* 208 "Already Reported". RFC5842. */
|
||||
MHD_HTTP_STATUS_ALREADY_REPORTED = 208
|
||||
,
|
||||
MHD_HTTP_STATUS_IM_USED = 226
|
||||
|
||||
/* 226 "IM Used". RFC3229. */
|
||||
MHD_HTTP_STATUS_IM_USED = 226
|
||||
,
|
||||
MHD_HTTP_STATUS_MULTIPLE_CHOICES = 300
|
||||
|
||||
/* 300 "Multiple Choices". RFC9110, Section 15.4.1. */
|
||||
MHD_HTTP_STATUS_MULTIPLE_CHOICES = 300
|
||||
,
|
||||
MHD_HTTP_STATUS_MOVED_PERMANENTLY = 301
|
||||
/* 301 "Moved Permanently". RFC9110, Section 15.4.2. */
|
||||
MHD_HTTP_STATUS_MOVED_PERMANENTLY = 301
|
||||
,
|
||||
MHD_HTTP_STATUS_FOUND = 302
|
||||
/* 302 "Found". RFC9110, Section 15.4.3. */
|
||||
MHD_HTTP_STATUS_FOUND = 302
|
||||
,
|
||||
MHD_HTTP_STATUS_SEE_OTHER = 303
|
||||
/* 303 "See Other". RFC9110, Section 15.4.4. */
|
||||
MHD_HTTP_STATUS_SEE_OTHER = 303
|
||||
,
|
||||
MHD_HTTP_STATUS_NOT_MODIFIED = 304
|
||||
/* 304 "Not Modified". RFC9110, Section 15.4.5. */
|
||||
MHD_HTTP_STATUS_NOT_MODIFIED = 304
|
||||
,
|
||||
MHD_HTTP_STATUS_USE_PROXY = 305
|
||||
/* 305 "Use Proxy". RFC9110, Section 15.4.6. */
|
||||
MHD_HTTP_STATUS_USE_PROXY = 305
|
||||
,
|
||||
MHD_HTTP_STATUS_SWITCH_PROXY = 306 /* IANA: unused */
|
||||
/* 306 "Switch Proxy". Not used! RFC9110, Section 15.4.7. */
|
||||
MHD_HTTP_STATUS_SWITCH_PROXY = 306
|
||||
,
|
||||
MHD_HTTP_STATUS_TEMPORARY_REDIRECT = 307
|
||||
/* 307 "Temporary Redirect". RFC9110, Section 15.4.8. */
|
||||
MHD_HTTP_STATUS_TEMPORARY_REDIRECT = 307
|
||||
,
|
||||
MHD_HTTP_STATUS_PERMANENT_REDIRECT = 308
|
||||
/* 308 "Permanent Redirect". RFC9110, Section 15.4.9. */
|
||||
MHD_HTTP_STATUS_PERMANENT_REDIRECT = 308
|
||||
,
|
||||
MHD_HTTP_STATUS_BAD_REQUEST = 400
|
||||
|
||||
/* 400 "Bad Request". RFC9110, Section 15.5.1. */
|
||||
MHD_HTTP_STATUS_BAD_REQUEST = 400
|
||||
,
|
||||
MHD_HTTP_STATUS_UNAUTHORIZED = 401
|
||||
/* 401 "Unauthorized". RFC9110, Section 15.5.2. */
|
||||
MHD_HTTP_STATUS_UNAUTHORIZED = 401
|
||||
,
|
||||
MHD_HTTP_STATUS_PAYMENT_REQUIRED = 402
|
||||
/* 402 "Payment Required". RFC9110, Section 15.5.3. */
|
||||
MHD_HTTP_STATUS_PAYMENT_REQUIRED = 402
|
||||
,
|
||||
MHD_HTTP_STATUS_FORBIDDEN = 403
|
||||
/* 403 "Forbidden". RFC9110, Section 15.5.4. */
|
||||
MHD_HTTP_STATUS_FORBIDDEN = 403
|
||||
,
|
||||
MHD_HTTP_STATUS_NOT_FOUND = 404
|
||||
/* 404 "Not Found". RFC9110, Section 15.5.5. */
|
||||
MHD_HTTP_STATUS_NOT_FOUND = 404
|
||||
,
|
||||
MHD_HTTP_STATUS_METHOD_NOT_ALLOWED = 405
|
||||
/* 405 "Method Not Allowed". RFC9110, Section 15.5.6. */
|
||||
MHD_HTTP_STATUS_METHOD_NOT_ALLOWED = 405
|
||||
,
|
||||
MHD_HTTP_STATUS_NOT_ACCEPTABLE = 406
|
||||
/* 406 "Not Acceptable". RFC9110, Section 15.5.7. */
|
||||
MHD_HTTP_STATUS_NOT_ACCEPTABLE = 406
|
||||
,
|
||||
/* 407 "Proxy Authentication Required". RFC9110, Section 15.5.8. */
|
||||
MHD_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407
|
||||
,
|
||||
MHD_HTTP_STATUS_REQUEST_TIMEOUT = 408
|
||||
/* 408 "Request Timeout". RFC9110, Section 15.5.9. */
|
||||
MHD_HTTP_STATUS_REQUEST_TIMEOUT = 408
|
||||
,
|
||||
MHD_HTTP_STATUS_CONFLICT = 409
|
||||
/* 409 "Conflict". RFC9110, Section 15.5.10. */
|
||||
MHD_HTTP_STATUS_CONFLICT = 409
|
||||
,
|
||||
MHD_HTTP_STATUS_GONE = 410
|
||||
/* 410 "Gone". RFC9110, Section 15.5.11. */
|
||||
MHD_HTTP_STATUS_GONE = 410
|
||||
,
|
||||
MHD_HTTP_STATUS_LENGTH_REQUIRED = 411
|
||||
/* 411 "Length Required". RFC9110, Section 15.5.12. */
|
||||
MHD_HTTP_STATUS_LENGTH_REQUIRED = 411
|
||||
,
|
||||
MHD_HTTP_STATUS_PRECONDITION_FAILED = 412
|
||||
/* 412 "Precondition Failed". RFC9110, Section 15.5.13. */
|
||||
MHD_HTTP_STATUS_PRECONDITION_FAILED = 412
|
||||
,
|
||||
MHD_HTTP_STATUS_PAYLOAD_TOO_LARGE = 413
|
||||
/* 413 "Content Too Large". RFC9110, Section 15.5.14. */
|
||||
MHD_HTTP_STATUS_CONTENT_TOO_LARGE = 413
|
||||
,
|
||||
MHD_HTTP_STATUS_URI_TOO_LONG = 414
|
||||
/* 414 "URI Too Long". RFC9110, Section 15.5.15. */
|
||||
MHD_HTTP_STATUS_URI_TOO_LONG = 414
|
||||
,
|
||||
MHD_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415
|
||||
/* 415 "Unsupported Media Type". RFC9110, Section 15.5.16. */
|
||||
MHD_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415
|
||||
,
|
||||
MHD_HTTP_STATUS_RANGE_NOT_SATISFIABLE = 416
|
||||
/* 416 "Range Not Satisfiable". RFC9110, Section 15.5.17. */
|
||||
MHD_HTTP_STATUS_RANGE_NOT_SATISFIABLE = 416
|
||||
,
|
||||
MHD_HTTP_STATUS_EXPECTATION_FAILED = 417
|
||||
/* 417 "Expectation Failed". RFC9110, Section 15.5.18. */
|
||||
MHD_HTTP_STATUS_EXPECTATION_FAILED = 417
|
||||
,
|
||||
MHD_HTTP_STATUS_MISDIRECTED_REQUEST = 421
|
||||
|
||||
|
||||
/* 421 "Misdirected Request". RFC9110, Section 15.5.20. */
|
||||
MHD_HTTP_STATUS_MISDIRECTED_REQUEST = 421
|
||||
,
|
||||
MHD_HTTP_STATUS_UNPROCESSABLE_ENTITY = 422
|
||||
/* 422 "Unprocessable Content". RFC9110, Section 15.5.21. */
|
||||
MHD_HTTP_STATUS_UNPROCESSABLE_CONTENT = 422
|
||||
,
|
||||
MHD_HTTP_STATUS_LOCKED = 423
|
||||
/* 423 "Locked". RFC4918. */
|
||||
MHD_HTTP_STATUS_LOCKED = 423
|
||||
,
|
||||
MHD_HTTP_STATUS_FAILED_DEPENDENCY = 424
|
||||
/* 424 "Failed Dependency". RFC4918. */
|
||||
MHD_HTTP_STATUS_FAILED_DEPENDENCY = 424
|
||||
,
|
||||
MHD_HTTP_STATUS_UNORDERED_COLLECTION = 425 /* IANA: unused */
|
||||
/* 425 "Too Early". RFC8470. */
|
||||
MHD_HTTP_STATUS_TOO_EARLY = 425
|
||||
,
|
||||
MHD_HTTP_STATUS_UPGRADE_REQUIRED = 426
|
||||
/* 426 "Upgrade Required". RFC9110, Section 15.5.22. */
|
||||
MHD_HTTP_STATUS_UPGRADE_REQUIRED = 426
|
||||
,
|
||||
MHD_HTTP_STATUS_PRECONDITION_REQUIRED = 428
|
||||
|
||||
/* 428 "Precondition Required". RFC6585. */
|
||||
MHD_HTTP_STATUS_PRECONDITION_REQUIRED = 428
|
||||
,
|
||||
MHD_HTTP_STATUS_TOO_MANY_REQUESTS = 429
|
||||
/* 429 "Too Many Requests". RFC6585. */
|
||||
MHD_HTTP_STATUS_TOO_MANY_REQUESTS = 429
|
||||
,
|
||||
|
||||
/* 431 "Request Header Fields Too Large". RFC6585. */
|
||||
MHD_HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431
|
||||
,
|
||||
MHD_HTTP_STATUS_NO_RESPONSE = 444 /* IANA: unused */
|
||||
,
|
||||
MHD_HTTP_STATUS_RETRY_WITH = 449 /* IANA: unused */
|
||||
,
|
||||
MHD_HTTP_STATUS_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = 450 /* IANA: unused */
|
||||
,
|
||||
|
||||
/* 451 "Unavailable For Legal Reasons". RFC7725. */
|
||||
MHD_HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451
|
||||
,
|
||||
MHD_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500
|
||||
,
|
||||
MHD_HTTP_STATUS_NOT_IMPLEMENTED = 501
|
||||
,
|
||||
MHD_HTTP_STATUS_BAD_GATEWAY = 502
|
||||
,
|
||||
MHD_HTTP_STATUS_SERVICE_UNAVAILABLE = 503
|
||||
,
|
||||
MHD_HTTP_STATUS_GATEWAY_TIMEOUT = 504
|
||||
,
|
||||
MHD_HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505
|
||||
,
|
||||
MHD_HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506
|
||||
,
|
||||
MHD_HTTP_STATUS_INSUFFICIENT_STORAGE = 507
|
||||
,
|
||||
MHD_HTTP_STATUS_LOOP_DETECTED = 508
|
||||
,
|
||||
MHD_HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509 /* IANA: unused */
|
||||
,
|
||||
MHD_HTTP_STATUS_NOT_EXTENDED = 510
|
||||
,
|
||||
MHD_HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511
|
||||
|
||||
/* 500 "Internal Server Error". RFC9110, Section 15.6.1. */
|
||||
MHD_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500
|
||||
,
|
||||
/* 501 "Not Implemented". RFC9110, Section 15.6.2. */
|
||||
MHD_HTTP_STATUS_NOT_IMPLEMENTED = 501
|
||||
,
|
||||
/* 502 "Bad Gateway". RFC9110, Section 15.6.3. */
|
||||
MHD_HTTP_STATUS_BAD_GATEWAY = 502
|
||||
,
|
||||
/* 503 "Service Unavailable". RFC9110, Section 15.6.4. */
|
||||
MHD_HTTP_STATUS_SERVICE_UNAVAILABLE = 503
|
||||
,
|
||||
/* 504 "Gateway Timeout". RFC9110, Section 15.6.5. */
|
||||
MHD_HTTP_STATUS_GATEWAY_TIMEOUT = 504
|
||||
,
|
||||
/* 505 "HTTP Version Not Supported". RFC9110, Section 15.6.6. */
|
||||
MHD_HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505
|
||||
,
|
||||
/* 506 "Variant Also Negotiates". RFC2295. */
|
||||
MHD_HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506
|
||||
,
|
||||
/* 507 "Insufficient Storage". RFC4918. */
|
||||
MHD_HTTP_STATUS_INSUFFICIENT_STORAGE = 507
|
||||
,
|
||||
/* 508 "Loop Detected". RFC5842. */
|
||||
MHD_HTTP_STATUS_LOOP_DETECTED = 508
|
||||
,
|
||||
|
||||
/* 510 "Not Extended". (OBSOLETED) RFC2774; status-change-http-experiments-to-historic. */
|
||||
MHD_HTTP_STATUS_NOT_EXTENDED = 510
|
||||
,
|
||||
/* 511 "Network Authentication Required". RFC6585. */
|
||||
MHD_HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511
|
||||
,
|
||||
|
||||
|
||||
/* Not registered non-standard codes */
|
||||
/* 449 "Reply With". MS IIS extension. */
|
||||
MHD_HTTP_STATUS_RETRY_WITH = 449
|
||||
,
|
||||
|
||||
/* 450 "Blocked by Windows Parental Controls". MS extension. */
|
||||
MHD_HTTP_STATUS_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = 450
|
||||
,
|
||||
|
||||
/* 509 "Bandwidth Limit Exceeded". Apache extension. */
|
||||
MHD_HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509
|
||||
};
|
||||
|
||||
|
||||
@@ -843,10 +923,19 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_HTTP_StatusCode
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_String *
|
||||
MHD_HTTP_status_code_to_string (enum MHD_HTTP_StatusCode code)
|
||||
MHD_FN_PURE_;
|
||||
MHD_FN_CONST_;
|
||||
|
||||
/**
|
||||
* Get the pointer to the C string for the HTTP response code, never NULL.
|
||||
*/
|
||||
#define MHD_HTTP_status_code_to_string_lazy(code) \
|
||||
(MHD_HTTP_status_code_to_string ((code)) ? \
|
||||
((MHD_HTTP_status_code_to_string (code))->cstr) : ("[No status]") )
|
||||
|
||||
|
||||
/** @} */ /* end of group httpcode */
|
||||
|
||||
#ifndef MHD_HTTP_PROTOCOL_VER_DEFINED
|
||||
|
||||
/**
|
||||
* @brief HTTP protocol versions
|
||||
@@ -861,13 +950,16 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_HTTP_ProtocolVersion
|
||||
,
|
||||
MHD_HTTP_VERSION_1_1 = 2
|
||||
,
|
||||
MHD_HTTP_VERSION_2_0 = 3
|
||||
MHD_HTTP_VERSION_2 = 3
|
||||
,
|
||||
MHD_HTTP_VERSION_3_0 = 4
|
||||
MHD_HTTP_VERSION_3 = 4
|
||||
,
|
||||
MHD_HTTP_VERSION_FUTURE = 99
|
||||
MHD_HTTP_VERSION_FUTURE = 255
|
||||
};
|
||||
|
||||
#define MHD_HTTP_PROTOCOL_VER_DEFINED 1
|
||||
#endif /* ! MHD_HTTP_PROTOCOL_VER_DEFINED */
|
||||
|
||||
/**
|
||||
* Return the string representation of the requested HTTP version.
|
||||
* Note: this is suitable mainly for logging and similar proposes as
|
||||
@@ -878,27 +970,27 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_HTTP_ProtocolVersion
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_String *
|
||||
MHD_protocol_version_to_string (enum MHD_HTTP_ProtocolVersion pv)
|
||||
MHD_FN_PURE_;
|
||||
MHD_FN_CONST_;
|
||||
|
||||
/**
|
||||
* HTTP/1.0 identification string
|
||||
*/
|
||||
#define MHD_HTTP_VERSION_1_0 "HTTP/1.0"
|
||||
#define MHD_HTTP_VERSION_1_0_STR "HTTP/1.0"
|
||||
/**
|
||||
* HTTP/1.1 identification string
|
||||
*/
|
||||
#define MHD_HTTP_VERSION_1_1 "HTTP/1.1"
|
||||
#define MHD_HTTP_VERSION_1_1_STR "HTTP/1.1"
|
||||
/**
|
||||
* HTTP/2 identification string.
|
||||
* Not used by the HTTP protocol (except non-TLS handshake), useful for logs and
|
||||
* similar proposes.
|
||||
*/
|
||||
#define MHD_HTTP_VERSION_2 "HTTP/2"
|
||||
#define MHD_HTTP_VERSION_2_STR "HTTP/2"
|
||||
/**
|
||||
* HTTP/3 identification string.
|
||||
* Not used by the HTTP protocol, useful for logs and similar proposes.
|
||||
*/
|
||||
#define MHD_HTTP_VERSION_3 "HTTP/3"
|
||||
#define MHD_HTTP_VERSION_3_STR "HTTP/3"
|
||||
|
||||
/** @} */ /* end of group versions */
|
||||
|
||||
@@ -968,21 +1060,14 @@ struct MHD_Response;
|
||||
* client.
|
||||
*
|
||||
* @param[in,out] request the request for which the action is generated
|
||||
* @param suspend_microsec the maximum duration of suspension after which
|
||||
* the request is automatically resumed, if not
|
||||
* resumed earlier by #MHD_request_resume(),
|
||||
* the precise resume moment is not guaranteed, it
|
||||
* may happen later (but not earlier) depending
|
||||
* on timer granularity and the system load;
|
||||
* if set to #MHD_WAIT_INDEFINITELY (or higher)
|
||||
* the request is not resumed automatically
|
||||
* @return action to cause a request to be suspended.
|
||||
* @return action to cause a request to be suspended,
|
||||
* NULL if any action has been already created for the @a request
|
||||
* @ingroup action
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_Action *
|
||||
MHD_action_suspend (struct MHD_Request *request,
|
||||
uint_fast64_t suspend_microsec)
|
||||
MHD_FN_RETURNS_NONNULL_ MHD_FN_PAR_NONNULL_ALL_;
|
||||
MHD_action_suspend (struct MHD_Request *request)
|
||||
MHD_FN_PAR_NONNULL_ALL_;
|
||||
|
||||
|
||||
/**
|
||||
* Converts a @a response to an action. If #MHD_R_O_REUSABLE
|
||||
@@ -996,17 +1081,31 @@ MHD_FN_RETURNS_NONNULL_ MHD_FN_PAR_NONNULL_ALL_;
|
||||
* @param request the request to create the action for
|
||||
* @param[in] response the response to convert,
|
||||
* if NULL then this function is equivalent to
|
||||
* #MHD_action_close_connection() call
|
||||
* #MHD_action_abort_connection() call
|
||||
* @return pointer to the action, the action must be consumed
|
||||
* otherwise response object may leak;
|
||||
* NULL if failed (no memory), when failed
|
||||
* the response object is consumed and need not
|
||||
* to be "destroyed".
|
||||
* NULL if failed (no memory) or if any action has been already
|
||||
* created for the @a request;
|
||||
* when failed the response object is consumed and need not
|
||||
* to be "destroyed"
|
||||
* @ingroup action
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_Action *
|
||||
MHD_action_from_response (struct MHD_Request *request,
|
||||
struct MHD_Response *response);
|
||||
MHD_action_from_response (struct MHD_Request *MHD_RESTRICT request,
|
||||
struct MHD_Response *MHD_RESTRICT response)
|
||||
MHD_FN_PAR_NONNULL_ (1);
|
||||
|
||||
|
||||
/**
|
||||
* Action telling MHD to close the connection hard
|
||||
* (kind-of breaking HTTP specification).
|
||||
*
|
||||
* @param req the request to make an action
|
||||
* @return action operation, always NULL
|
||||
* @ingroup action
|
||||
*/
|
||||
#define MHD_action_abort_request(req) \
|
||||
MHD_STATIC_CAST_ (const struct MHD_Action *, NULL)
|
||||
|
||||
|
||||
/**
|
||||
@@ -1025,9 +1124,10 @@ MHD_action_from_response (struct MHD_Request *request,
|
||||
* error code otherwise
|
||||
*/
|
||||
MHD_EXTERN_ enum MHD_StatusCode
|
||||
MHD_response_set_options (struct MHD_Response *response,
|
||||
const struct MHD_ResponseOptionAndValue *options,
|
||||
size_t options_max_num)
|
||||
MHD_response_set_options (
|
||||
struct MHD_Response *MHD_RESTRICT response,
|
||||
const struct MHD_ResponseOptionAndValue *MHD_RESTRICT options,
|
||||
size_t options_max_num)
|
||||
MHD_FN_PAR_NONNULL_ALL_;
|
||||
|
||||
|
||||
@@ -1129,19 +1229,16 @@ struct MHD_DynContentZCIoVec
|
||||
* The number of elements in @a iov
|
||||
*/
|
||||
unsigned int iov_count;
|
||||
|
||||
/**
|
||||
* The pointer to the array with @a iov_count elements.
|
||||
*/
|
||||
const struct MHD_IoVec *iov;
|
||||
|
||||
/**
|
||||
* The callback to free resources.
|
||||
* It is called once the full array of iov elements is sent.
|
||||
* No callback is called if NULL.
|
||||
*/
|
||||
MHD_FreeCallback iov_fcb;
|
||||
|
||||
/**
|
||||
* The parameter for @a iov_fcb
|
||||
*/
|
||||
@@ -1167,7 +1264,7 @@ struct MHD_DynamicContentCreatorContext;
|
||||
* The total size of the data in the buffer and in @a iov_data must
|
||||
* be non-zero.
|
||||
* @param[in,out] ctx the pointer the context as provided to the callback
|
||||
* @param data_size the amount of the data placed to the provided buffer (not @a iov_data),
|
||||
* @param data_size the amount of the data placed to the provided buffer,
|
||||
* cannot be larger than provided buffer size,
|
||||
* must be non-zero if @a iov_data is NULL or has no data,
|
||||
* @param iov_data the optional pointer to the iov data,
|
||||
@@ -1184,7 +1281,7 @@ MHD_DCC_action_continue_zc (
|
||||
struct MHD_DynamicContentCreatorContext *ctx,
|
||||
size_t data_size,
|
||||
const struct MHD_DynContentZCIoVec *iov_data,
|
||||
const char *chunk_ext)
|
||||
const char *MHD_RESTRICT chunk_ext)
|
||||
MHD_FN_PAR_NONNULL_ (1)
|
||||
MHD_FN_PAR_CSTR_ (4);
|
||||
|
||||
@@ -1325,6 +1422,7 @@ typedef const struct MHD_DynamicContentCreatorAction *
|
||||
* @param dyn_cont_cls extra argument to @a crc
|
||||
* @param dyn_cont_fc callback to call to free @a dyn_cont_cls resources
|
||||
* @return NULL on error (i.e. invalid arguments, out of memory)
|
||||
* FIXME: Call free callback on error?
|
||||
* @ingroup response
|
||||
*/
|
||||
MHD_EXTERN_ struct MHD_Response *
|
||||
@@ -1349,6 +1447,7 @@ MHD_response_from_callback (enum MHD_HTTP_StatusCode sc,
|
||||
* to skip the free/cleanup callback
|
||||
* @param free_cb_cls the parameter for @a free_cb
|
||||
* @return NULL on error (i.e. invalid arguments, out of memory)
|
||||
* FIXME: Call free callback on error?
|
||||
* @ingroup response
|
||||
*/
|
||||
MHD_EXTERN_ struct MHD_Response *
|
||||
@@ -1361,6 +1460,22 @@ MHD_response_from_buffer (
|
||||
MHD_FN_PAR_IN_SIZE_ (3,2);
|
||||
|
||||
|
||||
/**
|
||||
* Create a response object with body that is a
|
||||
* statically allocated buffer that never needs to
|
||||
* be freed as its lifetime exceeds that of the
|
||||
* daemon.
|
||||
*
|
||||
* The response object can be extended with header information and then be used
|
||||
* any number of times.
|
||||
* @param sc status code to use for the response
|
||||
* @param len number of bytes in @a buf
|
||||
* @param buf buffer with response payload
|
||||
*/
|
||||
#define MHD_response_from_buffer_static(sc, len, buf) \
|
||||
MHD_response_from_buffer (sc, len, buf, NULL, NULL)
|
||||
|
||||
|
||||
/**
|
||||
* Create a response object with empty (zero size) body.
|
||||
*
|
||||
@@ -1369,7 +1484,7 @@ MHD_FN_PAR_IN_SIZE_ (3,2);
|
||||
* @param sc status code to use for the response
|
||||
*/
|
||||
#define MHD_response_from_empty(sc) \
|
||||
MHD_response_from_buffer (sc, 0, NULL, NULL, NULL)
|
||||
MHD_response_from_buffer_static (sc, 0, "")
|
||||
|
||||
|
||||
/**
|
||||
@@ -1382,6 +1497,7 @@ MHD_FN_PAR_IN_SIZE_ (3,2);
|
||||
* an internal copy will be made, there is no need to
|
||||
* keep this data after return from this function
|
||||
* @return NULL on error (i.e. invalid arguments, out of memory)
|
||||
* FIXME: Call free callback on error?
|
||||
* @ingroup response
|
||||
*/
|
||||
MHD_EXTERN_ struct MHD_Response *
|
||||
@@ -1455,6 +1571,7 @@ MHD_response_from_iovec (
|
||||
* sizes larger than 2 GiB may be not supported by OS or
|
||||
* MHD build; see #MHD_LIB_INFO_FIXED_HAS_LARGE_FILE
|
||||
* @return NULL on error (i.e. invalid arguments, out of memory)
|
||||
* FIXME: Call free callback on error?
|
||||
* @ingroup response
|
||||
*/
|
||||
MHD_EXTERN_ struct MHD_Response *
|
||||
@@ -1484,7 +1601,9 @@ MHD_FN_PAR_FD_READ_ (2);
|
||||
*/
|
||||
MHD_EXTERN_ struct MHD_Response *
|
||||
MHD_response_from_pipe (enum MHD_HTTP_StatusCode sc,
|
||||
int fd);
|
||||
int fd)
|
||||
MHD_FN_PAR_FD_READ_ (2);
|
||||
;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1516,7 +1635,7 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* @ingroup response
|
||||
*/
|
||||
MHD_EXTERN_ enum MHD_StatusCode
|
||||
MHD_response_add_header (struct MHD_Response *response,
|
||||
MHD_response_add_header (struct MHD_Response *MHD_RESTRICT response,
|
||||
const char *name,
|
||||
const char *value)
|
||||
MHD_FN_PAR_NONNULL_ (1)
|
||||
@@ -1536,9 +1655,9 @@ MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_CSTR_ (3);
|
||||
* @ingroup response
|
||||
*/
|
||||
MHD_EXTERN_ enum MHD_StatusCode
|
||||
MHD_response_add_predef_header (struct MHD_Response *response,
|
||||
MHD_response_add_predef_header (struct MHD_Response *MHD_RESTRICT response,
|
||||
enum MHD_PredefinedHeader stk,
|
||||
const char *content)
|
||||
const char *MHD_RESTRICT content)
|
||||
MHD_FN_PAR_NONNULL_ (1)
|
||||
MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_CSTR_ (3);
|
||||
|
||||
@@ -1547,14 +1666,65 @@ MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_CSTR_ (3);
|
||||
|
||||
|
||||
/**
|
||||
* Action telling MHD to continue processing the upload.
|
||||
* Suspend handling of network data for a given request. This can
|
||||
* be used to dequeue a request from MHD's event loop for a while.
|
||||
*
|
||||
* @param req the request to make an action
|
||||
* @return action operation, never NULL
|
||||
* Suspended requests continue to count against the total number of
|
||||
* requests allowed (per daemon, as well as per IP, if such limits
|
||||
* are set). Suspended requests will NOT time out; timeouts will
|
||||
* restart when the request handling is resumed. While a
|
||||
* request is suspended, MHD may not detect disconnects by the
|
||||
* client.
|
||||
*
|
||||
* @param[in,out] request the request for which the action is generated
|
||||
* @return action to cause a request to be suspended,
|
||||
* NULL if any action has been already created for the @a request
|
||||
* @ingroup action
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_Action *
|
||||
MHD_action_continue (struct MHD_Request *req);
|
||||
MHD_EXTERN_ const struct MHD_UploadAction *
|
||||
MHD_upload_action_suspend (struct MHD_Request *request)
|
||||
MHD_FN_RETURNS_NONNULL_ MHD_FN_PAR_NONNULL_ALL_;
|
||||
|
||||
/**
|
||||
* Converts a @a response to an action. If #MHD_R_O_REUSABLE
|
||||
* is not set, the reference to the @a response is consumed
|
||||
* by the conversion. If #MHD_R_O_REUSABLE is #MHD_YES,
|
||||
* then the @a response can be used again to create actions in
|
||||
* the future.
|
||||
* However, the @a response is frozen by this step and
|
||||
* must no longer be modified (i.e. by setting headers).
|
||||
*
|
||||
* @param request the request to create the action for
|
||||
* @param[in] response the response to convert,
|
||||
* if NULL then this function is equivalent to
|
||||
* #MHD_upload_action_abort_request() call
|
||||
* @return pointer to the action, the action must be consumed
|
||||
* otherwise response object may leak;
|
||||
* NULL if failed (no memory) or if any action has been already
|
||||
* created for the @a request;
|
||||
* when failed the response object is consumed and need not
|
||||
* to be "destroyed"
|
||||
* @ingroup action
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_UploadAction *
|
||||
MHD_upload_action_from_response (struct MHD_Request *MHD_RESTRICT request,
|
||||
struct MHD_Response *MHD_RESTRICT response)
|
||||
MHD_FN_PAR_NONNULL_ (1);
|
||||
|
||||
/**
|
||||
* Action telling MHD to continue processing the upload.
|
||||
* Valid only for incremental upload processing.
|
||||
* Works as #MHD_upload_action_abort_request() if used for full upload callback
|
||||
* or for the final (with zero data) incremental callback.
|
||||
*
|
||||
* @param request the request to make an action
|
||||
* @return action operation,
|
||||
* NULL if any action has been already created for the @a request
|
||||
* @ingroup action
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_UploadAction *
|
||||
MHD_upload_action_continue (struct MHD_Request *request)
|
||||
MHD_FN_RETURNS_NONNULL_;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1565,9 +1735,10 @@ MHD_action_continue (struct MHD_Request *req);
|
||||
* @return action operation, always NULL
|
||||
* @ingroup action
|
||||
*/
|
||||
#define MHD_action_close_connection(req) \
|
||||
MHD_STATIC_CAST_ (const struct MHD_Action *, NULL)
|
||||
#define MHD_upload_action_abort_request(req) \
|
||||
MHD_STATIC_CAST_ (const struct MHD_UploadAction *, NULL)
|
||||
|
||||
#ifndef MHD_UPLOADCALLBACK_DEFINED
|
||||
|
||||
/**
|
||||
* Function to process data uploaded by a client.
|
||||
@@ -1576,26 +1747,30 @@ MHD_action_continue (struct MHD_Request *req);
|
||||
* pointer when the handler was registered with MHD
|
||||
* @param request the request is being processed
|
||||
* @param content_data_size the size of the @a content_data,
|
||||
* zero if all data have been processed
|
||||
* zero when all data have been processed
|
||||
* @param[in] content_data the uploaded content data,
|
||||
* may be modified in the callback,
|
||||
* valid only until return from the callback,
|
||||
* NULL is all data have been processed
|
||||
* @return action specifying how to proceed, often
|
||||
* #MHD_action_continue() if all is well,
|
||||
* #MHD_action_suspend() to stop reading the upload until
|
||||
* the request is resumed,
|
||||
* MHD_action_close_connection to close the socket, or a response
|
||||
* to discard the rest of the upload and return the data given
|
||||
* NULL when all data have been processed
|
||||
* @return action specifying how to proceed:
|
||||
* #MHD_upload_action_continue() to continue upload (for incremental
|
||||
* upload processing only),
|
||||
* #MHD_upload_action_suspend() to stop reading the upload until
|
||||
* the request is resumed,
|
||||
* #MHD_upload_action_abort_request() to close the socket,
|
||||
* or a response to discard the rest of the upload and transmit
|
||||
* the response
|
||||
* @ingroup action
|
||||
*/
|
||||
typedef const struct MHD_Action *
|
||||
(MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_IN_SIZE_ (4,3)
|
||||
typedef const struct MHD_UploadAction *
|
||||
(MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_INOUT_SIZE_ (4,3)
|
||||
*MHD_UploadCallback)(void *upload_cls,
|
||||
struct MHD_Request *request,
|
||||
size_t content_data_size,
|
||||
void *content_data);
|
||||
|
||||
#define MHD_UPLOADCALLBACK_DEFINED 1
|
||||
#endif /* ! MHD_UPLOADCALLBACK_DEFINED */
|
||||
|
||||
/**
|
||||
* Create an action that handles an upload.
|
||||
@@ -1604,10 +1779,10 @@ typedef const struct MHD_Action *
|
||||
* then request is aborted without response.
|
||||
*
|
||||
* @param request the request to create action for
|
||||
* @param upload_buffer_size how large should the upload buffer be.
|
||||
* May allocate memory from the shared "large"
|
||||
* memory pool if necessary and non-zero is given.
|
||||
* Must be zero if @a uc_full is NULL.
|
||||
* @param large_buffer_size how large should the upload buffer be.
|
||||
* May allocate memory from the shared "large"
|
||||
* memory pool if necessary and non-zero is given.
|
||||
* Must be zero if @a uc_full is NULL.
|
||||
* @param uc_full the function to call when complete upload
|
||||
* is received (only if fit @a upload_buffer_size),
|
||||
* can be NULL if uc_inc is not NULL,
|
||||
@@ -1619,14 +1794,17 @@ typedef const struct MHD_Action *
|
||||
* @a uc_full is NULL,
|
||||
* can be NULL if uc_full is not NULL
|
||||
* @param uc_inc_cls closure for @a uc_inc
|
||||
* @return NULL on error (out of memory. both @a uc_full and @a uc_inc are NULL)
|
||||
* @return NULL on error (out of memory, invalid parameters)
|
||||
* @return pointer to the action,
|
||||
* NULL if failed (no memory) or if any action has been already
|
||||
* created for the @a request.
|
||||
* @sa #MHD_D_OPTION_LARGE_POOL_SIZE()
|
||||
* @ingroup action
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_Action *
|
||||
MHD_action_process_upload (
|
||||
struct MHD_Request *request,
|
||||
size_t upload_buffer_size,
|
||||
size_t large_buffer_size,
|
||||
MHD_UploadCallback uc_full,
|
||||
void *uc_full_cls,
|
||||
MHD_UploadCallback uc_inc,
|
||||
@@ -1642,7 +1820,7 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* @param uc the function to call when complete upload
|
||||
* is received (only if fit @a upload_buffer_size)
|
||||
* @param uc_cls closure for @a uc
|
||||
* @return NULL on error (out of memory. both @a uc_full and @a uc_inc are NULL)
|
||||
* @return NULL on error (out of memory. both @a uc is NULL)
|
||||
* @ingroup action
|
||||
*/
|
||||
#define MHD_action_process_upload_full(request,buff_size,uc,uc_cls) \
|
||||
@@ -1654,12 +1832,13 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* @param request the request to create action for
|
||||
* @param uc the function to incrementally process the upload data
|
||||
* @param uc_cls closure for @a uc
|
||||
* @return NULL on error (out of memory. both @a uc_full and @a uc_inc are NULL)
|
||||
* @return NULL on error (out of memory. both @a uc is NULL)
|
||||
* @ingroup action
|
||||
*/
|
||||
#define MHD_action_process_upload_inc(request,uc,uc_cls) \
|
||||
MHD_action_process_upload (request, 0, NULL, NULL, uc, uc_cls)
|
||||
|
||||
#ifndef MHD_POST_DATA_READER_DEFINED
|
||||
|
||||
/**
|
||||
* Iterator over key-value pairs where the value maybe made available
|
||||
@@ -1677,15 +1856,16 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* NOT zero-terminated
|
||||
* @param off offset of data in the overall value
|
||||
* @param size number of bytes in @a data available
|
||||
* @return action specifying how to proceed, often
|
||||
* #MHD_action_continue() if all is well,
|
||||
* #MHD_action_suspend() to stop reading the upload until
|
||||
* the request is resumed,
|
||||
* NULL to close the socket, or a response
|
||||
* to discard the rest of the upload and return the data given
|
||||
* @return action specifying how to proceed:
|
||||
* #MHD_upload_action_continue() if all is well,
|
||||
* #MHD_upload_action_suspend() to stop reading the upload until
|
||||
* the request is resumed,
|
||||
* #MHD_upload_action_abort_request() to close the socket,
|
||||
* or a response to discard the rest of the upload and transmit
|
||||
* the response
|
||||
* @ingroup action
|
||||
*/
|
||||
typedef const struct MHD_Action *
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataReader) (void *cls,
|
||||
const struct MHD_String *name,
|
||||
const struct MHD_String *filename,
|
||||
@@ -1701,12 +1881,15 @@ typedef const struct MHD_Action *
|
||||
* of the postprocessor upload data.
|
||||
* @param req the request
|
||||
* @param cls the closure
|
||||
* @return the action to proceed
|
||||
* @return the action to proceed, #MHD_upload_action_continue() is not possible
|
||||
* an
|
||||
*/
|
||||
typedef const struct MHD_Action *
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataFinished) (struct MHD_Request *req,
|
||||
void *cls);
|
||||
|
||||
#define MHD_POST_DATA_READER_DEFINED 1
|
||||
#endif /* ! MHD_POST_DATA_READER_DEFINED */
|
||||
|
||||
/**
|
||||
* Create an action to parse the POSTed body from the client.
|
||||
@@ -1715,8 +1898,8 @@ typedef const struct MHD_Action *
|
||||
* @param pp_buffer_size how much data should the post processor
|
||||
* buffer in memory. May allocate memory from
|
||||
* the shared "large" memory pool if necessary.
|
||||
* @param pp_stream_limit values above which length should be
|
||||
* given to @a iter for stream processing
|
||||
* @param pp_stream_limit values above which length should be // FIXME: Remove? Duplicated with pp_buffer_size
|
||||
* given to @a iter for stream processing // FIXME: iter??
|
||||
* @param enc the data encoding to use,
|
||||
* set to #MHD_HTTP_POST_ENCODING_OTHER to detect automatically
|
||||
* @param reader function to call for "oversize" values in the stream,
|
||||
@@ -1728,13 +1911,16 @@ typedef const struct MHD_Action *
|
||||
* #MHD_request_get_values_cb(), #MHD_request_get_values_list() and
|
||||
* #MHD_request_get_post_data_cb(), #MHD_request_get_post_data_list()
|
||||
* @param done_cb_cls closure for @a done_cb
|
||||
* @return pointer to the action,
|
||||
* NULL if failed (no memory) or if any action has been already
|
||||
* created for the @a request.
|
||||
* @sa #MHD_D_OPTION_LARGE_POOL_SIZE()
|
||||
* @ingroup action
|
||||
*/
|
||||
MHD_EXTERN_ struct MHD_Action *
|
||||
MHD_EXTERN_ const struct MHD_Action *
|
||||
MHD_action_post_processor (struct MHD_Request *request,
|
||||
size_t pp_buffer_size,
|
||||
size_t pp_stream_limit,
|
||||
size_t pp_stream_limit, // FIXME: Remove? Duplicated with pp_buffer_size
|
||||
enum MHD_HTTP_PostEncoding enc,
|
||||
MHD_PostDataReader reader,
|
||||
void *reader_cls,
|
||||
@@ -1946,11 +2132,11 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
*/
|
||||
typedef void
|
||||
(*MHD_UpgradeHandler)(void *cls,
|
||||
struct MHD_Request *request,
|
||||
struct MHD_Request *MHD_RESTRICT request,
|
||||
size_t extra_in_size,
|
||||
const char *extra_in,
|
||||
MHD_Socket sock,
|
||||
struct MHD_UpgradeHandle *urh);
|
||||
struct MHD_UpgradeHandle *MHD_RESTRICT urh);
|
||||
|
||||
|
||||
/**
|
||||
@@ -2297,7 +2483,7 @@ MHD_digest_auth_calc_userhash (enum MHD_DigestAuthAlgo algo,
|
||||
const char *username,
|
||||
const char *realm,
|
||||
size_t bin_buf_size,
|
||||
void *userhash_bin)
|
||||
void *MHD_RESTRICT userhash_bin)
|
||||
MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (2)
|
||||
MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_OUT_SIZE_ (5,4);
|
||||
|
||||
@@ -3606,7 +3792,7 @@ union MHD_DaemonInfoFixedData
|
||||
/**
|
||||
* Port number
|
||||
*/
|
||||
uint_fast16_t v_port;
|
||||
uint_least16_t v_port;
|
||||
|
||||
/**
|
||||
* Unused member.
|
||||
@@ -4466,11 +4652,15 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
MHD_REQUEST_INFO_DYNAMIC_HEADER_SIZE = 21
|
||||
,
|
||||
/**
|
||||
* Returns the client-specific pointer to a `void *` that
|
||||
* is specific to this request.
|
||||
* The result is placed in @a v_pvoid member.
|
||||
* Returns the request-specific pointer to a `void *`. The pointer obtainable
|
||||
* by this pointer is the same as provided for #MHD_EarlyUriLogCallback and
|
||||
* #MHD_RequestTerminationCallback.
|
||||
* By using provided pointer application may get or set the pointer to
|
||||
* any data specific for the particular request.
|
||||
* The result is placed in @a v_ppvoid member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_CLIENT_CONTEXT = 31
|
||||
MHD_REQUEST_INFO_DYNAMIC_APP_CONTEXT = 31
|
||||
,
|
||||
/**
|
||||
* Returns pointer to information about username in client's digest auth
|
||||
@@ -4537,9 +4727,9 @@ union MHD_RequestInfoDynamicData
|
||||
*/
|
||||
uint_fast64_t v_uint64;
|
||||
/**
|
||||
* The pointer to void
|
||||
* The pointer to pointer to the data.
|
||||
*/
|
||||
void *v_pvoid;
|
||||
void **v_ppvoid;
|
||||
|
||||
/**
|
||||
* The information about client provided username for digest auth
|
||||
@@ -4603,19 +4793,23 @@ MHD_FN_PURE_;
|
||||
* Callback for serious error condition. The default action is to print
|
||||
* an error message and `abort()`.
|
||||
* The callback should not return.
|
||||
* Some parameters could be empty strings (the strings with zero-termination at
|
||||
* zero position) if MHD built without log messages (only for embedded
|
||||
* projects).
|
||||
*
|
||||
* @param cls user specified value
|
||||
* @param file where the error occurred, could be NULL if MHD built without
|
||||
* messages (only for embedded project)
|
||||
* @param file where the error occurred, could be empty
|
||||
* @param func the name of the function, where the error occurred, may be empty
|
||||
* @param line where the error occurred
|
||||
* @param reason error detail, may be NULL
|
||||
* @param message the error details, could be empty
|
||||
* @ingroup logging
|
||||
*/
|
||||
typedef void
|
||||
(*MHD_PanicCallback) (void *cls,
|
||||
const char *file,
|
||||
const char *func,
|
||||
unsigned int line,
|
||||
const char *reason);
|
||||
const char *message);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -171,6 +171,8 @@ enum MHD_Bool
|
||||
MHD_YES = 1
|
||||
};
|
||||
|
||||
#ifndef MHD_STRINGS_DEFINED
|
||||
|
||||
|
||||
/**
|
||||
* String with length data.
|
||||
@@ -209,20 +211,24 @@ struct MHD_StringNullable
|
||||
const char *cstr;
|
||||
};
|
||||
|
||||
#define MHD_STRINGS_DEFINED 1
|
||||
#endif /* ! MHD_STRINGS_DEFINED */
|
||||
|
||||
/**
|
||||
* Constant used to indicate unknown size (use when
|
||||
* creating a response).
|
||||
* Constant used to indicate unknown size (use when creating a response).
|
||||
* Any possible larger sizes are interpreted as the same value.
|
||||
*/
|
||||
#ifdef UINT64_MAX
|
||||
# define MHD_SIZE_UNKNOWN UINT64_MAX
|
||||
#else
|
||||
# define MHD_SIZE_UNKNOWN MHD_STATIC_CAST_ (uint_fast64_t,0xffffffffffffffffU)
|
||||
# define MHD_SIZE_UNKNOWN \
|
||||
MHD_STATIC_CAST_ (uint_fast64_t,0xffffffffffffffffU)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Constant used to indicate unlimited wait time.
|
||||
* Any possible larger values are interpreted as the this value.
|
||||
*/
|
||||
#ifdef UINT64_MAX
|
||||
# define MHD_WAIT_INDEFINITELY UINT64_MAX
|
||||
@@ -285,13 +291,22 @@ struct MHD_Request;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Actions are returned by the application to drive the request
|
||||
* handling of MHD.
|
||||
* @brief Actions are returned by the application when processed client header
|
||||
* to drive the request handling of MHD.
|
||||
*
|
||||
* @defgroup action Request actions
|
||||
*/
|
||||
struct MHD_Action;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Actions are returned by the application when processing client upload
|
||||
* to drive the request handling of MHD.
|
||||
*
|
||||
* @defgroup action Request actions
|
||||
*/
|
||||
struct MHD_UploadAction;
|
||||
|
||||
/**
|
||||
* @defgroup general Primary MHD functions and data
|
||||
*/
|
||||
@@ -331,11 +346,6 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
*/
|
||||
MHD_SC_OK = 0
|
||||
,
|
||||
/**
|
||||
* We were asked to return a timeout, but, there is no timeout.
|
||||
*/
|
||||
MHD_SC_NO_TIMEOUT = 1
|
||||
,
|
||||
|
||||
/* 10000-level status codes indicate intermediate
|
||||
results of some kind. */
|
||||
@@ -365,6 +375,17 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
*/
|
||||
MHD_SC_ACCEPT_FAILED_EAGAIN = 10004
|
||||
,
|
||||
/**
|
||||
* Accepted socket is unknown type (probably non-IP).
|
||||
*/
|
||||
MHD_SC_ACCEPTED_UNKNOWN_TYPE = 10040
|
||||
,
|
||||
/**
|
||||
* The sockaddr for the accepted socket does not fit the buffer.
|
||||
* (Strange)
|
||||
*/
|
||||
MHD_SC_ACCEPTED_SOCKADDR_TOO_LARGE = 10041
|
||||
,
|
||||
|
||||
/* 20000-level status codes indicate success of some kind. */
|
||||
|
||||
@@ -391,71 +412,96 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
*/
|
||||
MHD_SC_LIMIT_CONNECTIONS_REACHED = 30000
|
||||
,
|
||||
/**
|
||||
* We failed to allocate memory for poll() syscall.
|
||||
* (May be transient.)
|
||||
*/
|
||||
MHD_SC_POLL_MALLOC_FAILURE = 30001
|
||||
,
|
||||
/**
|
||||
* The operation failed because the respective
|
||||
* daemon is already too deep inside of the shutdown
|
||||
* activity.
|
||||
*/
|
||||
MHD_SC_DAEMON_ALREADY_SHUTDOWN = 30002
|
||||
MHD_SC_DAEMON_ALREADY_SHUTDOWN = 30020
|
||||
,
|
||||
/**
|
||||
* We failed to start a thread.
|
||||
* Failed to start new thread because of system limits.
|
||||
*/
|
||||
MHD_SC_THREAD_LAUNCH_FAILURE = 30003
|
||||
MHD_SC_CONNECTION_THREAD_SYS_LIMITS_REACHED = 30030
|
||||
,
|
||||
/**
|
||||
* Failed to start a thread.
|
||||
*/
|
||||
MHD_SC_CONNECTION_THREAD_LAUNCH_FAILURE = 30031
|
||||
,
|
||||
/**
|
||||
* The operation failed because we either have no
|
||||
* listen socket or were already quiesced.
|
||||
*/
|
||||
MHD_SC_DAEMON_ALREADY_QUIESCED = 30004
|
||||
MHD_SC_DAEMON_ALREADY_QUIESCED = 30040
|
||||
,
|
||||
/**
|
||||
* The operation failed because client disconnected
|
||||
* faster than we could accept().
|
||||
*/
|
||||
MHD_SC_ACCEPT_FAST_DISCONNECT = 30005
|
||||
MHD_SC_ACCEPT_FAST_DISCONNECT = 30040
|
||||
,
|
||||
/**
|
||||
* Operating resource limits hit on accept().
|
||||
*/
|
||||
MHD_SC_ACCEPT_SYSTEM_LIMIT_REACHED = 30006
|
||||
MHD_SC_ACCEPT_SYSTEM_LIMIT_REACHED = 30060
|
||||
,
|
||||
/**
|
||||
* Connection was refused by accept policy callback.
|
||||
*/
|
||||
MHD_SC_ACCEPT_POLICY_REJECTED = 30007
|
||||
MHD_SC_ACCEPT_POLICY_REJECTED = 30070
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory for the daemon resources.
|
||||
*/
|
||||
MHD_SC_DAEMON_MALLOC_FAILURE = 30081
|
||||
,
|
||||
/**
|
||||
* We failed to allocate memory for the connection.
|
||||
* (May be transient.)
|
||||
*/
|
||||
MHD_SC_CONNECTION_MALLOC_FAILURE = 30008
|
||||
MHD_SC_CONNECTION_MALLOC_FAILURE = 30082
|
||||
,
|
||||
/**
|
||||
* We failed to allocate memory for the connection's memory pool.
|
||||
* (May be transient.)
|
||||
*/
|
||||
MHD_SC_POOL_MALLOC_FAILURE = 30009
|
||||
MHD_SC_POOL_MALLOC_FAILURE = 30083
|
||||
,
|
||||
/**
|
||||
* We failed to forward data from a Web socket to the
|
||||
* application to the remote side due to the socket
|
||||
* being closed prematurely. (May be transient.)
|
||||
*/
|
||||
MHD_SC_UPGRADE_FORWARD_INCOMPLETE = 30010
|
||||
MHD_SC_UPGRADE_FORWARD_INCOMPLETE = 30100
|
||||
,
|
||||
/**
|
||||
* We failed to allocate memory for generating the response from our
|
||||
* memory pool. Likely the request header was too large to leave
|
||||
* Failed to allocate memory from our memory pool for processing
|
||||
* the request. Likely the request fields are too large to leave
|
||||
* enough room.
|
||||
*/
|
||||
MHD_SC_CONNECTION_POOL_MALLOC_FAILURE = 30011
|
||||
MHD_SC_CONNECTION_POOL_MALLOC_FAILURE_REQ = 30130
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory from our memory pool to store GET parameter.
|
||||
* Likely the request URI or header fields are too large to leave enough room.
|
||||
*/
|
||||
MHD_SC_CONNECTION_POOL_NO_MEM_GET_PARAM = 30131
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory from our memory pool to store parsed cookie.
|
||||
*/
|
||||
MHD_SC_CONNECTION_POOL_NO_MEM_COOKIE = 30132
|
||||
,
|
||||
/**
|
||||
* Detected jump back of system clock
|
||||
*/
|
||||
MHD_SC_SYS_CLOCK_JUMP_BACK_LARGE = 30140
|
||||
,
|
||||
/**
|
||||
* Detected correctable jump back of system clock
|
||||
*/
|
||||
MHD_SC_SYS_CLOCK_JUMP_BACK_CORRECTED = 30141
|
||||
,
|
||||
|
||||
/* 40000-level errors are caused by the HTTP client
|
||||
@@ -473,36 +519,129 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
MHD_SC_CONNECTION_RESET_CLOSED = 40001
|
||||
,
|
||||
/**
|
||||
* MHD is closing a connection because reading the
|
||||
* MHD is closing a connection because receiving the
|
||||
* request failed.
|
||||
*/
|
||||
MHD_SC_CONNECTION_READ_FAIL_CLOSED = 40002
|
||||
MHD_SC_CONNECTION_RECV_FAIL_CLOSED = 40002
|
||||
,
|
||||
/**
|
||||
* MHD is closing a connection because writing the response failed.
|
||||
* MHD is closing a connection because sending the response failed.
|
||||
*/
|
||||
MHD_SC_CONNECTION_WRITE_FAIL_CLOSED = 40003
|
||||
MHD_SC_CONNECTION_SEND_FAIL_CLOSED = 40003
|
||||
,
|
||||
/**
|
||||
* MHD is returning an error because the header provided
|
||||
* by the client is too big.
|
||||
*/
|
||||
MHD_SC_CLIENT_HEADER_TOO_BIG = 40004
|
||||
MHD_SC_CLIENT_HEADER_TOO_BIG = 40020
|
||||
,
|
||||
/**
|
||||
* An HTTP/1.1 request was sent without the "Host:" header.
|
||||
*/
|
||||
MHD_SC_HOST_HEADER_MISSING = 40005
|
||||
MHD_SC_HOST_HEADER_MISSING = 40060
|
||||
,
|
||||
/**
|
||||
* Request has more than one "Host:" header.
|
||||
*/
|
||||
MHD_SC_HOST_HEADER_SEVERAL = 40061
|
||||
,
|
||||
/**
|
||||
* The given content length was not a number.
|
||||
*/
|
||||
MHD_SC_CONTENT_LENGTH_MALFORMED = 40006
|
||||
MHD_SC_CONTENT_LENGTH_MALFORMED = 40062
|
||||
,
|
||||
/**
|
||||
* Request has more than one "Content-Length:" header with the same value.
|
||||
*/
|
||||
MHD_SC_CONTENT_LENGTH_SEVERAL_SAME = 40063
|
||||
,
|
||||
/**
|
||||
* Request has more than one "Content-Length:" header with the different
|
||||
* values.
|
||||
*/
|
||||
MHD_SC_CONTENT_LENGTH_SEVERAL_DIFFERENT = 40064
|
||||
,
|
||||
/**
|
||||
* The BOTH Content-Length and Transfer-Encoding headers are used.
|
||||
*/
|
||||
MHD_SC_CONTENT_LENGTH_AND_TR_ENC = 40065
|
||||
,
|
||||
/**
|
||||
* The Content-Length is too large to be handled.
|
||||
*/
|
||||
MHD_SC_CONTENT_LENGTH_TOO_LARGE = 40066
|
||||
,
|
||||
/**
|
||||
* Transfer encoding in request is unsupported or invalid.
|
||||
*/
|
||||
MHD_SC_CHUNKED_ENCODING_UNSUPPORTED = 40067
|
||||
,
|
||||
/**
|
||||
* The given uploaded, chunked-encoded body was malformed.
|
||||
*/
|
||||
MHD_SC_CHUNKED_ENCODING_MALFORMED = 40007
|
||||
MHD_SC_CHUNKED_ENCODING_MALFORMED = 40080
|
||||
,
|
||||
/**
|
||||
* The first header line has whitespace at the start
|
||||
*/
|
||||
MHD_SC_REQ_FIRST_HEADER_LINE_SPACE_PREFIXED = 40100
|
||||
,
|
||||
/**
|
||||
* The request target (URI) has whitespace character
|
||||
*/
|
||||
MHD_SC_REQ_TARGET_HAS_WHITESPACE = 40101
|
||||
,
|
||||
/**
|
||||
* Wrong bare CR characters has been replaced with space.
|
||||
*/
|
||||
MHD_SC_REQ_HEADER_CR_REPLACED = 40120
|
||||
,
|
||||
/**
|
||||
* Header line has not colon and skipped.
|
||||
*/
|
||||
MHD_SC_REQ_HEADER_LINE_NO_COLON = 40121
|
||||
,
|
||||
/**
|
||||
* Wrong bare CR characters has been replaced with space.
|
||||
*/
|
||||
MHD_SC_REQ_FOOTER_CR_REPLACED = 40140
|
||||
,
|
||||
/**
|
||||
* Footer line has not colon and skipped.
|
||||
*/
|
||||
MHD_SC_REQ_FOOTER_LINE_NO_COLON = 40141
|
||||
,
|
||||
/**
|
||||
* The request is malformed.
|
||||
*/
|
||||
MHD_SC_REQ_MALFORMED = 40155
|
||||
,
|
||||
/**
|
||||
* The cookie string has been parsed, but it is not fully compliant with
|
||||
* specifications
|
||||
*/
|
||||
MHD_SC_REQ_COOKIE_PARSED_NOT_COMPLIANT = 40160
|
||||
,
|
||||
/**
|
||||
* The cookie string has been parsed only partially
|
||||
*/
|
||||
MHD_SC_REQ_COOKIE_PARSED_PARTIALLY = 40161
|
||||
,
|
||||
/**
|
||||
* The cookie string is ignored, as it is not fully compliant with
|
||||
* specifications
|
||||
*/
|
||||
MHD_SC_REQ_COOKIE_IGNORED_NOT_COMPLIANT = 40162
|
||||
,
|
||||
/**
|
||||
* The cookie string has been ignored as it is invalid
|
||||
*/
|
||||
MHD_SC_REQ_COOKIE_INVALID = 40163
|
||||
,
|
||||
/**
|
||||
* The request cannot be processed. Sending error reply.
|
||||
*/
|
||||
MHD_SC_REQ_PROCCESSING_ERR_REPLY = 40200
|
||||
,
|
||||
|
||||
/* 50000-level errors are because of an error internal
|
||||
@@ -532,276 +671,437 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
MHD_SC_ITC_INITIALIZATION_FAILED = 50005
|
||||
,
|
||||
/**
|
||||
* File descriptor for ITC channel too large.
|
||||
* File descriptor for ITC cannot be used because the FD number is higher
|
||||
* than the limit set by FD_SETSIZE (if internal polling with select is used)
|
||||
* or by application.
|
||||
*/
|
||||
MHD_SC_ITC_DESCRIPTOR_TOO_LARGE = 50006
|
||||
MHD_SC_ITC_FD_OUTSIDE_OF_SET_RANGE = 50006
|
||||
,
|
||||
/**
|
||||
* The specified value for the NC length is way too large
|
||||
* for this platform (integer overflow on `size_t`).
|
||||
*/
|
||||
MHD_SC_DIGEST_AUTH_NC_LENGTH_TOO_BIG = 50007
|
||||
MHD_SC_DIGEST_AUTH_NC_LENGTH_TOO_BIG = 50010
|
||||
,
|
||||
/**
|
||||
* We failed to allocate memory for the specified nonce
|
||||
* counter array. The option was not set.
|
||||
*/
|
||||
MHD_SC_DIGEST_AUTH_NC_ALLOCATION_FAILURE = 50008
|
||||
MHD_SC_DIGEST_AUTH_NC_ALLOCATION_FAILURE = 50011
|
||||
,
|
||||
/**
|
||||
* This build of the library does not support
|
||||
* digest authentication.
|
||||
*/
|
||||
MHD_SC_DIGEST_AUTH_NOT_SUPPORTED_BY_BUILD = 50009
|
||||
MHD_SC_DIGEST_AUTH_NOT_SUPPORTED_BY_BUILD = 50012
|
||||
,
|
||||
/**
|
||||
* IPv6 requested but not supported by this build.
|
||||
* @sa #MHD_SC_AF_NOT_SUPPORTED_BY_BUILD
|
||||
*/
|
||||
MHD_SC_IPV6_NOT_SUPPORTED_BY_BUILD = 50010
|
||||
MHD_SC_IPV6_NOT_SUPPORTED_BY_BUILD = 50020
|
||||
,
|
||||
/**
|
||||
* We failed to open the listen socket. Maybe the build
|
||||
* supports IPv6, but your kernel does not?
|
||||
* Specified address/protocol family is not supported by this build.
|
||||
* @sa MHD_SC_IPV6_NOT_SUPPORTED_BY_BUILD
|
||||
*/
|
||||
MHD_SC_FAILED_TO_OPEN_LISTEN_SOCKET = 50011
|
||||
MHD_SC_AF_NOT_SUPPORTED_BY_BUILD = 50021
|
||||
,
|
||||
/**
|
||||
* Specified address family is not supported by this build.
|
||||
* The requested address/protocol family is rejected by the OS.
|
||||
* @sa #MHD_SC_AF_NOT_SUPPORTED_BY_BUILD
|
||||
*/
|
||||
MHD_SC_AF_NOT_SUPPORTED_BY_BUILD = 50012
|
||||
MHD_SC_AF_NOT_AVAILABLE = 500022
|
||||
,
|
||||
/**
|
||||
* We failed to open the listen socket.
|
||||
*/
|
||||
MHD_SC_FAILED_TO_OPEN_LISTEN_SOCKET = 50040
|
||||
,
|
||||
/**
|
||||
* Failed to enable listen port reuse.
|
||||
*/
|
||||
MHD_SC_LISTEN_PORT_REUSE_ENABLE_FAILED = 50041
|
||||
,
|
||||
/**
|
||||
* Failed to enable listen port reuse.
|
||||
*/
|
||||
MHD_SC_LISTEN_PORT_REUSE_ENABLE_NOT_SUPPORTED = 50042
|
||||
,
|
||||
/**
|
||||
* Failed to enable listen address reuse.
|
||||
*/
|
||||
MHD_SC_LISTEN_ADDRESS_REUSE_ENABLE_FAILED = 50013
|
||||
MHD_SC_LISTEN_ADDRESS_REUSE_ENABLE_FAILED = 50043
|
||||
,
|
||||
/**
|
||||
* Enabling listen address reuse is not supported by this platform.
|
||||
*/
|
||||
MHD_SC_LISTEN_ADDRESS_REUSE_ENABLE_NOT_SUPPORTED = 50014
|
||||
MHD_SC_LISTEN_ADDRESS_REUSE_ENABLE_NOT_SUPPORTED = 50044
|
||||
,
|
||||
/**
|
||||
* Failed to disable listen address reuse.
|
||||
* Failed to enable exclusive use of listen address.
|
||||
*/
|
||||
MHD_SC_LISTEN_ADDRESS_REUSE_DISABLE_FAILED = 50015
|
||||
MHD_SC_LISTEN_ADDRESS_EXCLUSIVE_ENABLE_FAILED = 50045
|
||||
,
|
||||
/**
|
||||
* Disabling listen address reuse is not supported by this platform.
|
||||
* Dual stack configuration is not possible for provided sockaddr.
|
||||
*/
|
||||
MHD_SC_LISTEN_ADDRESS_REUSE_DISABLE_NOT_SUPPORTED = 50016
|
||||
MHD_SC_LISTEN_DUAL_STACK_NOT_SUITABLE = 50046
|
||||
,
|
||||
/**
|
||||
* We failed to explicitly enable or disable dual stack for
|
||||
* the IPv6 listen socket. The socket will be used in whatever
|
||||
* the default is the OS gives us.
|
||||
* Failed to enable or disable dual stack for the IPv6 listen socket.
|
||||
* The OS default dual-stack setting is different from what is requested.
|
||||
*/
|
||||
MHD_SC_LISTEN_DUAL_STACK_CONFIGURATION_FAILED = 50017
|
||||
MHD_SC_LISTEN_DUAL_STACK_CONFIGURATION_REJECTED = 50047
|
||||
,
|
||||
/**
|
||||
* Failed to enable or disable dual stack for the IPv6 listen socket.
|
||||
* The socket will be used in whatever the default is the OS uses.
|
||||
*/
|
||||
MHD_SC_LISTEN_DUAL_STACK_CONFIGURATION_UNKNOWN = 50048
|
||||
,
|
||||
/**
|
||||
* On this platform, MHD does not support explicitly configuring
|
||||
* dual stack behavior.
|
||||
* dual stack behaviour.
|
||||
*/
|
||||
MHD_SC_LISTEN_DUAL_STACK_CONFIGURATION_NOT_SUPPORTED = 50018
|
||||
MHD_SC_LISTEN_DUAL_STACK_CONFIGURATION_NOT_SUPPORTED = 50049
|
||||
,
|
||||
/**
|
||||
* Failed to enable TCP FAST OPEN option.
|
||||
*/
|
||||
MHD_SC_FAST_OPEN_FAILURE = 50020
|
||||
MHD_SC_LISTEN_FAST_OPEN_FAILURE = 50050
|
||||
,
|
||||
/**
|
||||
* Failed to start listening on listen socket.
|
||||
* TCP FAST OPEN is not supported by the platform or by this MHD build.
|
||||
*/
|
||||
MHD_SC_LISTEN_FAILURE = 50021
|
||||
,
|
||||
/**
|
||||
* Failed to obtain our listen port via introspection.
|
||||
*/
|
||||
MHD_SC_LISTEN_PORT_INTROSPECTION_FAILURE = 50022
|
||||
,
|
||||
/**
|
||||
* Failed to obtain our listen port via introspection
|
||||
* due to unsupported address family being used.
|
||||
*/
|
||||
MHD_SC_LISTEN_PORT_INTROSPECTION_UNKNOWN_AF = 50023
|
||||
MHD_SC_FAST_OPEN_NOT_SUPPORTED = 50051
|
||||
,
|
||||
/**
|
||||
* We failed to set the listen socket to non-blocking.
|
||||
*/
|
||||
MHD_SC_LISTEN_SOCKET_NONBLOCKING_FAILURE = 50024
|
||||
MHD_SC_LISTEN_SOCKET_NONBLOCKING_FAILURE = 50052
|
||||
,
|
||||
/**
|
||||
* Listen socket value is too large (for use with select()).
|
||||
* Failed to configure listen socket to be non-inheritable.
|
||||
*/
|
||||
MHD_SC_LISTEN_SOCKET_TOO_LARGE = 50025
|
||||
MHD_SC_LISTEN_SOCKET_NOINHERIT_FAILED = 50053
|
||||
,
|
||||
/**
|
||||
* We failed to allocate memory for the thread pool.
|
||||
* Listen socket FD cannot be used because the FD number is higher than
|
||||
* the limit set by FD_SETSIZE (if internal polling with select is used) or
|
||||
* by application.
|
||||
*/
|
||||
MHD_SC_THREAD_POOL_MALLOC_FAILURE = 50026
|
||||
MHD_SC_LISTEN_FD_OUTSIDE_OF_SET_RANGE = 50054
|
||||
,
|
||||
/**
|
||||
* We failed to allocate mutex for thread pool worker.
|
||||
* We failed to bind the listen socket.
|
||||
*/
|
||||
MHD_SC_THREAD_POOL_CREATE_MUTEX_FAILURE = 50027
|
||||
MHD_SC_LISTEN_SOCKET_BIND_FAILED = 50055
|
||||
,
|
||||
/**
|
||||
* There was an attempt to upgrade a connection on
|
||||
* a daemon where upgrades are disallowed.
|
||||
* Failed to start listening on listen socket.
|
||||
*/
|
||||
MHD_SC_UPGRADE_ON_DAEMON_WITH_UPGRADE_DISALLOWED = 50028
|
||||
MHD_SC_LISTEN_FAILURE = 50056
|
||||
,
|
||||
/**
|
||||
* Failed to signal via ITC channel.
|
||||
* Failed to detect the port number on the listening socket
|
||||
*/
|
||||
MHD_SC_ITC_USE_FAILED = 50029
|
||||
,
|
||||
/**
|
||||
* We failed to initialize the main thread for listening.
|
||||
*/
|
||||
MHD_SC_THREAD_MAIN_LAUNCH_FAILURE = 50030
|
||||
,
|
||||
/**
|
||||
* We failed to initialize the threads for the worker pool.
|
||||
*/
|
||||
MHD_SC_THREAD_POOL_LAUNCH_FAILURE = 50031
|
||||
,
|
||||
/**
|
||||
* We failed to add a socket to the epoll() set.
|
||||
*/
|
||||
MHD_SC_EPOLL_CTL_ADD_FAILED = 50032
|
||||
MHD_SC_LISTEN_PORT_DETECT_FAILURE = 50057
|
||||
,
|
||||
/**
|
||||
* We failed to create control socket for the epoll().
|
||||
*/
|
||||
MHD_SC_EPOLL_CTL_CREATE_FAILED = 50034
|
||||
MHD_SC_EPOLL_CTL_CREATE_FAILED = 50060
|
||||
,
|
||||
/**
|
||||
* We failed to configure control socket for the epoll()
|
||||
* to be non-inheritable.
|
||||
*/
|
||||
MHD_SC_EPOLL_CTL_CONFIGURE_NOINHERIT_FAILED = 50035
|
||||
MHD_SC_EPOLL_CTL_CONFIGURE_NOINHERIT_FAILED = 50061
|
||||
,
|
||||
/**
|
||||
* We failed to build the FD set because a socket was
|
||||
* outside of the permitted range.
|
||||
* The epoll() control FD cannot be used because the FD number is higher
|
||||
* than the limit set by application.
|
||||
*/
|
||||
MHD_SC_SOCKET_OUTSIDE_OF_FDSET_RANGE = 50036
|
||||
MHD_SC_EPOLL_CTL_OUTSIDE_OF_SET_RANGE = 50062
|
||||
,
|
||||
/**
|
||||
* This daemon was not configured with options that
|
||||
* would allow us to build an FD set for select().
|
||||
* Failed to allocate memory for daemon's fd_sets
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_MISMATCH_FOR_GET_FDSET = 50037
|
||||
MHD_SC_FD_SET_MEMORY_ALLOCATE_FAILURE = 50063
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory for poll() structures
|
||||
*/
|
||||
MHD_SC_POLL_FDS_MEMORY_ALLOCATE_FAILURE = 50063
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory for epoll data
|
||||
*/
|
||||
MHD_SC_EPOLL_EVENTS_MEMORY_ALLOCATE_FAILURE = 50064
|
||||
,
|
||||
/**
|
||||
* Failed to add daemon's FDs (ITC and/or listening) to the epoll monitoring
|
||||
*/
|
||||
MHD_SC_EPOLL_ADD_DAEMON_FDS_FAILURE = 50065
|
||||
,
|
||||
/**
|
||||
* The select() syscall is not available on this platform or in this MHD
|
||||
* build.
|
||||
*/
|
||||
MHD_SC_SELECT_SYSCALL_NOT_AVAILABLE = 50070
|
||||
,
|
||||
/**
|
||||
* The poll() syscall is not available on this platform or in this MHD
|
||||
* build.
|
||||
*/
|
||||
MHD_SC_POLL_SYSCALL_NOT_AVAILABLE = 50071
|
||||
,
|
||||
/**
|
||||
* The epoll syscalls are not available on this platform or in this MHD
|
||||
* build.
|
||||
*/
|
||||
MHD_SC_EPOLL_SYSCALL_NOT_AVAILABLE = 50072
|
||||
,
|
||||
/**
|
||||
* Failed to obtain our listen port via introspection.
|
||||
* FIXME: remove?
|
||||
*/
|
||||
MHD_SC_LISTEN_PORT_INTROSPECTION_FAILURE = 50080
|
||||
,
|
||||
/**
|
||||
* Failed to obtain our listen port via introspection
|
||||
* due to unsupported address family being used.
|
||||
*/
|
||||
MHD_SC_LISTEN_PORT_INTROSPECTION_UNKNOWN_AF = 50081
|
||||
,
|
||||
/**
|
||||
* Failed to initialise mutex.
|
||||
*/
|
||||
MHD_SC_MUTEX_INIT_FAILURE = 50085
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory for the thread pool.
|
||||
*/
|
||||
MHD_SC_THREAD_POOL_MALLOC_FAILURE = 50090
|
||||
,
|
||||
/**
|
||||
* We failed to allocate mutex for thread pool worker.
|
||||
*/
|
||||
MHD_SC_THREAD_POOL_CREATE_MUTEX_FAILURE = 50093
|
||||
,
|
||||
/**
|
||||
* Failed to start the main daemon thread.
|
||||
*/
|
||||
MHD_SC_THREAD_MAIN_LAUNCH_FAILURE = 50095
|
||||
,
|
||||
/**
|
||||
* Failed to start the daemon thread for listening.
|
||||
*/
|
||||
MHD_SC_THREAD_LISTENING_LAUNCH_FAILURE = 50096
|
||||
,
|
||||
/**
|
||||
* Failed to start the worker thread for the thread pool.
|
||||
*/
|
||||
MHD_SC_THREAD_WORKER_LAUNCH_FAILURE = 50097
|
||||
,
|
||||
/**
|
||||
* There was an attempt to upgrade a connection on
|
||||
* a daemon where upgrades are disallowed.
|
||||
*/
|
||||
MHD_SC_UPGRADE_ON_DAEMON_WITH_UPGRADE_DISALLOWED = 50100
|
||||
,
|
||||
/**
|
||||
* Failed to signal via ITC channel.
|
||||
*/
|
||||
MHD_SC_ITC_USE_FAILED = 500101
|
||||
,
|
||||
/**
|
||||
* Failed to check for the signal on the ITC channel.
|
||||
*/
|
||||
MHD_SC_ITC_CHECK_FAILED = 500102
|
||||
,
|
||||
/**
|
||||
* System reported error conditions on the ITC FD..
|
||||
*/
|
||||
MHD_SC_ITC_STATUS_ERROR = 500104
|
||||
,
|
||||
/**
|
||||
* Failed to add a socket to the epoll set.
|
||||
*/
|
||||
MHD_SC_EPOLL_CTL_ADD_FAILED = 500110
|
||||
,
|
||||
/**
|
||||
* Socket FD cannot be used because the FD number is higher than the limit set
|
||||
* by FD_SETSIZE (if internal polling with select is used) or by application.
|
||||
*/
|
||||
MHD_SC_SOCKET_OUTSIDE_OF_SET_RANGE = 500111
|
||||
,
|
||||
/**
|
||||
* The daemon cannot be started with the specified settings as no space
|
||||
* left for the connections sockets within limits set by FD_SETSIZE.
|
||||
* Consider use another sockets polling syscall (only select() has such
|
||||
* limitations)
|
||||
*/
|
||||
MHD_SC_SYS_FD_SETSIZE_TOO_STRICT = 50112
|
||||
,
|
||||
/**
|
||||
* This daemon was not configured with options that
|
||||
* would allow us to obtain a meaningful timeout.
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_MISMATCH_FOR_GET_TIMEOUT = 50038
|
||||
MHD_SC_CONFIGURATION_MISMATCH_FOR_GET_TIMEOUT = 50113
|
||||
,
|
||||
/**
|
||||
* This daemon was not configured with options that
|
||||
* would allow us to run with select() data.
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_MISMATCH_FOR_RUN_SELECT = 50039
|
||||
MHD_SC_CONFIGURATION_MISMATCH_FOR_RUN_SELECT = 50114
|
||||
,
|
||||
/**
|
||||
* This daemon was not configured to run with an
|
||||
* external event loop.
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_MISMATCH_FOR_RUN_EXTERNAL = 50040
|
||||
,
|
||||
/**
|
||||
* Encountered an unexpected event loop style
|
||||
* (should never happen).
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_UNEXPECTED_ELS = 50041
|
||||
MHD_SC_CONFIGURATION_MISMATCH_FOR_RUN_EXTERNAL = 50115
|
||||
,
|
||||
/**
|
||||
* Encountered an unexpected error from select()
|
||||
* (should never happen).
|
||||
*/
|
||||
MHD_SC_UNEXPECTED_SELECT_ERROR = 50042
|
||||
MHD_SC_UNEXPECTED_SELECT_ERROR = 50116
|
||||
,
|
||||
/**
|
||||
* Failed to remove a socket to the epoll set.
|
||||
*/
|
||||
MHD_SC_EPOLL_CTL_REMOVE_FAILED = 50117
|
||||
,
|
||||
/**
|
||||
* poll() is not supported.
|
||||
*/
|
||||
MHD_SC_POLL_NOT_SUPPORTED = 50043
|
||||
MHD_SC_POLL_NOT_SUPPORTED = 50120
|
||||
,
|
||||
/**
|
||||
* Encountered an unexpected error from poll()
|
||||
* (should never happen).
|
||||
* Encountered a (potentially) recoverable error from poll().
|
||||
*/
|
||||
MHD_SC_UNEXPECTED_POLL_ERROR = 50044
|
||||
MHD_SC_POLL_SOFT_ERROR = 50121
|
||||
,
|
||||
/**
|
||||
* Encountered an unrecoverable error from poll().
|
||||
*/
|
||||
MHD_SC_POLL_HARD_ERROR = 50122
|
||||
,
|
||||
/**
|
||||
* Encountered a (potentially) recoverable error from select().
|
||||
*/
|
||||
MHD_SC_SELECT_SOFT_ERROR = 50123
|
||||
,
|
||||
/**
|
||||
* Encountered an unrecoverable error from select().
|
||||
*/
|
||||
MHD_SC_SELECT_HARD_ERROR = 50124
|
||||
,
|
||||
/**
|
||||
* System reported error conditions on the listening socket.
|
||||
*/
|
||||
MHD_SC_LISTEN_STATUS_ERROR = 50129
|
||||
,
|
||||
/**
|
||||
* Encountered an unrecoverable error from epoll function.
|
||||
*/
|
||||
MHD_SC_EPOLL_HARD_ERROR = 50130
|
||||
,
|
||||
/**
|
||||
* We failed to configure accepted socket
|
||||
* to not use a signal pipe.
|
||||
* to not use a SIGPIPE.
|
||||
*/
|
||||
MHD_SC_ACCEPT_CONFIGURE_NOSIGPIPE_FAILED = 50045
|
||||
,
|
||||
/**
|
||||
* Encountered an unexpected error from epoll_wait()
|
||||
* (should never happen).
|
||||
*/
|
||||
MHD_SC_UNEXPECTED_EPOLL_WAIT_ERROR = 50046
|
||||
,
|
||||
/**
|
||||
* epoll file descriptor is invalid (strange)
|
||||
*/
|
||||
MHD_SC_EPOLL_FD_INVALID = 50047
|
||||
MHD_SC_ACCEPT_CONFIGURE_NOSIGPIPE_FAILED = 50140
|
||||
,
|
||||
/**
|
||||
* We failed to configure accepted socket
|
||||
* to be non-inheritable.
|
||||
*/
|
||||
MHD_SC_ACCEPT_CONFIGURE_NOINHERIT_FAILED = 50048
|
||||
MHD_SC_ACCEPT_CONFIGURE_NOINHERIT_FAILED = 50141
|
||||
,
|
||||
/**
|
||||
* We failed to configure accepted socket
|
||||
* to be non-blocking.
|
||||
*/
|
||||
MHD_SC_ACCEPT_CONFIGURE_NONBLOCKING_FAILED = 50049
|
||||
MHD_SC_ACCEPT_CONFIGURE_NONBLOCKING_FAILED = 50142
|
||||
,
|
||||
/**
|
||||
* accept() returned non-transient error.
|
||||
* The accepted socket FD value is too large.
|
||||
*/
|
||||
MHD_SC_ACCEPT_FAILED_UNEXPECTEDLY = 50050
|
||||
MHD_SC_ACCEPT_OUTSIDE_OF_SET_RANGE = 50143
|
||||
,
|
||||
/**
|
||||
* accept() returned unexpected error.
|
||||
*/
|
||||
MHD_SC_ACCEPT_FAILED_UNEXPECTEDLY = 50144
|
||||
,
|
||||
/**
|
||||
* Operating resource limits hit on accept() while
|
||||
* zero connections are active. Oopsie.
|
||||
*/
|
||||
MHD_SC_ACCEPT_SYSTEM_LIMIT_REACHED_INSTANTLY = 50051
|
||||
MHD_SC_ACCEPT_SYSTEM_LIMIT_REACHED_INSTANTLY = 50145
|
||||
,
|
||||
/**
|
||||
* The daemon sockets polling mode requires non-blocking sockets.
|
||||
*/
|
||||
MHD_SC_NONBLOCKING_REQUIRED = 50146
|
||||
,
|
||||
/**
|
||||
* Encountered an unexpected error from epoll_wait()
|
||||
* (should never happen).
|
||||
*/
|
||||
MHD_SC_UNEXPECTED_EPOLL_WAIT_ERROR = 50150
|
||||
,
|
||||
/**
|
||||
* epoll file descriptor is invalid (strange)
|
||||
*/
|
||||
MHD_SC_EPOLL_FD_INVALID = 50151
|
||||
,
|
||||
/**
|
||||
* Unexpected socket error (strange)
|
||||
*/
|
||||
MHD_SC_UNEXPECTED_SOCKET_ERROR = 50152
|
||||
,
|
||||
/**
|
||||
* Failed to add IP address to per-IP counter for
|
||||
* some reason.
|
||||
*/
|
||||
MHD_SC_IP_COUNTER_FAILURE = 50052
|
||||
MHD_SC_IP_COUNTER_FAILURE = 50160
|
||||
,
|
||||
/**
|
||||
* Application violated our API by calling shutdown
|
||||
* while having an upgrade connection still open.
|
||||
*/
|
||||
MHD_SC_SHUTDOWN_WITH_OPEN_UPGRADED_CONNECTION = 50053
|
||||
MHD_SC_SHUTDOWN_WITH_OPEN_UPGRADED_CONNECTION = 50180
|
||||
,
|
||||
/**
|
||||
* Due to an unexpected internal error with the
|
||||
* state machine, we closed the connection.
|
||||
*/
|
||||
MHD_SC_STATEMACHINE_FAILURE_CONNECTION_CLOSED = 50054
|
||||
MHD_SC_STATEMACHINE_FAILURE_CONNECTION_CLOSED = 50200
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory in connection's pool
|
||||
* to parse the cookie header.
|
||||
*/
|
||||
MHD_SC_COOKIE_POOL_ALLOCATION_FAILURE = 50055
|
||||
MHD_SC_COOKIE_POOL_ALLOCATION_FAILURE = 50220
|
||||
,
|
||||
/**
|
||||
* MHD failed to build the response header.
|
||||
*/
|
||||
MHD_SC_FAILED_RESPONSE_HEADER_GENERATION = 50056
|
||||
MHD_SC_REPLY_FAILED_HEADER_GENERATION = 50230
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory in connection's pool for the reply.
|
||||
*/
|
||||
MHD_SC_REPLY_POOL_ALLOCATION_FAILURE = 50231
|
||||
,
|
||||
/**
|
||||
* Failed to allocate memory in connection's pool for the reply.
|
||||
*/
|
||||
MHD_SC_ERR_RESPONSE_ALLOCATION_FAILURE = 50250
|
||||
,
|
||||
/**
|
||||
* The feature is not supported by this MHD build (either
|
||||
@@ -812,7 +1112,7 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
* will be run on another kernel, computer or system
|
||||
* configuration.
|
||||
*/
|
||||
MHD_SC_FEATURE_DISABLED = 500057
|
||||
MHD_SC_FEATURE_DISABLED = 50300
|
||||
,
|
||||
/**
|
||||
* The feature is not supported by this platform, while
|
||||
@@ -821,7 +1121,66 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
* running on another computer or with other system
|
||||
* configuration.
|
||||
*/
|
||||
MHD_SC_FEATURE_NOT_AVAILABLE = 500058
|
||||
MHD_SC_FEATURE_NOT_AVAILABLE = 50320
|
||||
,
|
||||
/**
|
||||
* Failed to stop the thread
|
||||
*/
|
||||
MHD_SC_DAEMON_THREAD_STOP_ERROR = 50350
|
||||
,
|
||||
/**
|
||||
* Unexpected reasons for thread stop
|
||||
*/
|
||||
MHD_SC_DAEMON_THREAD_STOP_UNEXPECTED = 50350
|
||||
,
|
||||
/**
|
||||
* Failed to acquire response mutex lock
|
||||
*/
|
||||
MHD_SC_RESPONSE_MUTEX_LOCK_FAILED = 50500
|
||||
,
|
||||
/**
|
||||
* Failed to initialise response mutex
|
||||
*/
|
||||
MHD_SC_RESPONSE_MUTEX_INIT_FAILED = 50501
|
||||
,
|
||||
/**
|
||||
* Unable to clear "reusable" flag.
|
||||
* One this flag set, it cannot be removed for the response lifetime.
|
||||
*/
|
||||
MHD_SC_RESPONSE_CANNOT_CLEAR_REUSE = 50520
|
||||
,
|
||||
/**
|
||||
* Unable to allocate memory for the response header
|
||||
*/
|
||||
MHD_SC_RESPONSE_HEADER_MALLOC_FAILED = 50540
|
||||
,
|
||||
/**
|
||||
* Failed to switch TCP_NODELAY option for the socket
|
||||
*/
|
||||
MHD_SC_SOCKET_TCP_NODELAY_FAILED = 50600
|
||||
,
|
||||
/**
|
||||
* Failed to switch TCP_CORK or TCP_NOPUSH option for the socket
|
||||
*/
|
||||
MHD_SC_SOCKET_TCP_CORK_NOPUSH_FAILED = 50601
|
||||
,
|
||||
/**
|
||||
* Failed to force flush the last part of the response header or
|
||||
* the response content
|
||||
*/
|
||||
MHD_SC_SOCKET_FLUSH_LAST_PART_FAILED = 50620
|
||||
,
|
||||
/**
|
||||
* Failed to push buffered data by zero-sized send()
|
||||
*/
|
||||
MHD_SC_SOCKET_ZERO_SEND_FAILED = 50621
|
||||
,
|
||||
/**
|
||||
* Something wrong in the internal MHD logic.
|
||||
* This error should be never returned if MHD works as expected.
|
||||
* If this code is ever returned, please report to MHD maintainers.
|
||||
*/
|
||||
MHD_SC_INTERNAL_ERROR = 51000
|
||||
,
|
||||
|
||||
/* 60000-level errors are because the application
|
||||
@@ -829,9 +1188,9 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
|
||||
/**
|
||||
* MHD does not support the requested combination of
|
||||
* EPOLL with thread-per-connection mode.
|
||||
* the sockets polling syscall and the work mode.
|
||||
*/
|
||||
MHD_SC_SYSCALL_THREAD_COMBINATION_INVALID = 60000
|
||||
MHD_SC_SYSCALL_WORK_MODE_COMBINATION_INVALID = 60000
|
||||
,
|
||||
/**
|
||||
* MHD does not support quiescing if ITC was disabled
|
||||
@@ -839,11 +1198,6 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
*/
|
||||
MHD_SC_SYSCALL_QUIESCE_REQUIRES_ITC = 60001
|
||||
,
|
||||
/**
|
||||
* We failed to bind the listen socket.
|
||||
*/
|
||||
MHD_SC_LISTEN_SOCKET_BIND_FAILED = 60002
|
||||
,
|
||||
/**
|
||||
* The application requested an unsupported TLS backend to be used.
|
||||
*/
|
||||
@@ -865,7 +1219,7 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
* MHD is closing a connection because the application
|
||||
* callback told it to do so.
|
||||
*/
|
||||
MHD_SC_APPLICATION_CALLBACK_FAILURE_CLOSED = 60006
|
||||
MHD_SC_APPLICATION_CALLBACK_ABORT_ACTION = 60006
|
||||
,
|
||||
/**
|
||||
* Application only partially processed upload and did
|
||||
@@ -894,11 +1248,108 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
MHD_SC_OPTIONS_CONFLICT = 60010
|
||||
,
|
||||
/**
|
||||
* Attempted to set an invalid option value.
|
||||
* Attempted to set an option that not recognised by MHD.
|
||||
*/
|
||||
MHD_SC_OPTIONS_INVALID = 60011
|
||||
|
||||
|
||||
MHD_SC_OPTION_UNKNOWN = 60011
|
||||
,
|
||||
/**
|
||||
* Parameter specified unknown work mode.
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_UNEXPECTED_WM = 60012
|
||||
,
|
||||
/**
|
||||
* Parameter specified unknown socket poll syscall.
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_UNEXPECTED_SPS = 60013
|
||||
,
|
||||
/**
|
||||
* The size of the provided sockaddr does not match address family.
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_WRONG_SA_SIZE = 60014
|
||||
,
|
||||
/**
|
||||
* The number set by #MHD_D_O_FD_NUMBER_LIMIT is too strict to run
|
||||
* the daemon
|
||||
*/
|
||||
MHD_SC_MAX_FD_NUMBER_LIMIT_TOO_STRICT = 60015
|
||||
,
|
||||
/**
|
||||
* The number set by #MHD_D_O_GLOBAL_CONNECTION_LIMIT is too for the daemon
|
||||
* configuration
|
||||
*/
|
||||
MHD_SC_CONFIGURATION_CONN_LIMIT_TOO_SMALL = 60016
|
||||
,
|
||||
/**
|
||||
* The response header name has forbidden characters
|
||||
*/
|
||||
MHD_SC_RESP_HEADER_NAME_INVALID = 60050
|
||||
,
|
||||
/**
|
||||
* The response header value has forbidden characters
|
||||
*/
|
||||
MHD_SC_RESP_HEADER_VALUE_INVALID = 60051
|
||||
,
|
||||
/**
|
||||
* The provided MHD_Action is invalid
|
||||
*/
|
||||
MHD_SC_ACTION_INVALID = 60080
|
||||
,
|
||||
/**
|
||||
* The provided MHD_UploadAction is invalid
|
||||
*/
|
||||
MHD_SC_UPLOAD_ACTION_INVALID = 60081
|
||||
,
|
||||
/**
|
||||
* The response must be empty
|
||||
*/
|
||||
MHD_SC_REPLY_NOT_EMPTY_RESPONSE = 60101
|
||||
,
|
||||
/**
|
||||
* The "Content-Length" header is not allowed in the reply
|
||||
*/
|
||||
MHD_SC_REPLY_CONTENT_LENGTH_NOT_ALLOWED = 60102
|
||||
,
|
||||
/**
|
||||
* The new connection cannot be used because the FD number is higher than
|
||||
* the limit set by FD_SETSIZE (if internal polling with select is used) or
|
||||
* by application.
|
||||
*/
|
||||
MHD_SC_NEW_CONN_FD_OUTSIDE_OF_SET_RANGE = 60140
|
||||
,
|
||||
/**
|
||||
* The requested type of information is not recognised.
|
||||
*/
|
||||
MHD_SC_INFO_TYPE_UNKNOWN = 60200
|
||||
,
|
||||
/**
|
||||
* The requested type of information is not recognised.
|
||||
*/
|
||||
MHD_SC_INFO_GET_INFO_TYPE_UNKNOWN = 60200
|
||||
,
|
||||
/**
|
||||
* The information of the requested type is too large to fit into
|
||||
* the provided buffer.
|
||||
*/
|
||||
MHD_SC_INFO_GET_BUFF_TOO_SMALL = 60201
|
||||
,
|
||||
/**
|
||||
* The type of the information is not supported by this MHD build.
|
||||
* It can be information not supported on the current platform or related
|
||||
* to feature disabled for this build.
|
||||
*/
|
||||
MHD_SC_INFO_GET_TYPE_NOT_SUPP_BY_BUILD = 60202
|
||||
,
|
||||
/**
|
||||
* The type of the information is not available due to configuration
|
||||
* or state of the object.
|
||||
*/
|
||||
MHD_SC_INFO_GET_TYPE_UNSUPPORTED = 60203
|
||||
,
|
||||
/**
|
||||
* The type of the information should be available for the object, but
|
||||
* cannot be provided due to some error or other reasons.
|
||||
*/
|
||||
MHD_SC_INFO_GET_TYPE_UNAVAILALBE = 60204
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -913,7 +1364,16 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_String *
|
||||
MHD_status_code_to_string (enum MHD_StatusCode code)
|
||||
MHD_FN_PURE_;
|
||||
MHD_FN_CONST_;
|
||||
|
||||
/**
|
||||
* Get the pointer to the C string for the MHD error code, never NULL.
|
||||
*/
|
||||
#define MHD_status_code_to_string_lazy(code) \
|
||||
(MHD_status_code_to_string ((code)) ? \
|
||||
((MHD_status_code_to_string (code))->cstr) : ("[No code]") )
|
||||
|
||||
#ifndef MHD_HTTP_METHOD_DEFINED
|
||||
|
||||
/**
|
||||
* @brief HTTP request methods
|
||||
@@ -936,13 +1396,13 @@ MHD_FN_PURE_;
|
||||
* #MHD_HTTP_METHOD_OTHER today, it may return a method-specific header in the
|
||||
* future!
|
||||
*/
|
||||
enum MHD_FIXED_ENUM_ MHD_HTTP_Method
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_HTTP_Method
|
||||
{
|
||||
|
||||
/**
|
||||
* Method did not match any of the methods given below.
|
||||
*/
|
||||
MHD_HTTP_METHOD_OTHER = 0
|
||||
MHD_HTTP_METHOD_OTHER = 255
|
||||
,
|
||||
/* Main HTTP methods. */
|
||||
|
||||
@@ -1001,6 +1461,9 @@ enum MHD_FIXED_ENUM_ MHD_HTTP_Method
|
||||
MHD_HTTP_METHOD_ASTERISK = 9
|
||||
};
|
||||
|
||||
#define MHD_HTTP_METHOD_DEFINED 1
|
||||
#endif /* ! MHD_HTTP_METHOD_DEFINED */
|
||||
|
||||
/**
|
||||
* Get text version of the method name.
|
||||
* @param method the method to get the text version
|
||||
@@ -1010,7 +1473,8 @@ enum MHD_FIXED_ENUM_ MHD_HTTP_Method
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_String *
|
||||
MHD_http_method_to_string (enum MHD_HTTP_Method method)
|
||||
MHD_FN_PURE_;
|
||||
MHD_FN_CONST_;
|
||||
|
||||
|
||||
/* Main HTTP methods. */
|
||||
/* Safe. Idempotent. RFC9110, Section 9.3.1. */
|
||||
@@ -1030,7 +1494,7 @@ MHD_FN_PURE_;
|
||||
/* Safe. Idempotent. RFC9110, Section 9.3.8. */
|
||||
#define MHD_HTTP_METHOD_STR_TRACE "TRACE"
|
||||
/* Not safe. Not idempotent. RFC9110, Section 18.2. */
|
||||
#define MHD_HTTP_METHOD_STR_ASTERISK "*"
|
||||
#define MHD_HTTP_METHOD_STR_ASTERISK "*"
|
||||
|
||||
/* Additional HTTP methods. */
|
||||
/* Not safe. Idempotent. RFC3744, Section 8.1. */
|
||||
@@ -1098,6 +1562,8 @@ MHD_FN_PURE_;
|
||||
|
||||
/** @} */ /* end of group methods */
|
||||
|
||||
#ifndef MHD_HTTP_POSTENCODING_DEFINED
|
||||
|
||||
|
||||
/**
|
||||
* @brief Possible encodings for HTML forms submitted as HTTP POST requests
|
||||
@@ -1141,6 +1607,9 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_HTTP_PostEncoding
|
||||
|
||||
/** @} */ /* end of group postenc */
|
||||
|
||||
#define MHD_HTTP_POSTENCODING_DEFINED 1
|
||||
#endif /* ! MHD_HTTP_POSTENCODING_DEFINED */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Standard headers found in HTTP requests and responses.
|
||||
@@ -1694,7 +2163,7 @@ enum MHD_PredefinedHeader
|
||||
*/
|
||||
MHD_EXTERN_ const struct MHD_String *
|
||||
MHD_predef_header_to_string (enum MHD_PredefinedHeader stk)
|
||||
MHD_FN_PURE_;
|
||||
MHD_FN_CONST_;
|
||||
|
||||
/** @} */ /* end of group headers */
|
||||
|
||||
@@ -1702,6 +2171,9 @@ MHD_FN_PURE_;
|
||||
* A client has requested the given url using the given method
|
||||
* (#MHD_HTTP_METHOD_GET, #MHD_HTTP_METHOD_PUT,
|
||||
* #MHD_HTTP_METHOD_DELETE, #MHD_HTTP_METHOD_POST, etc).
|
||||
* If @a upload_size is not zero and response action is provided by this
|
||||
* callback, then upload will be discarded and the stream (the connection for
|
||||
* HTTP/1.1) will be closed after sending the response.
|
||||
*
|
||||
* @param cls argument given together with the function
|
||||
* pointer when the handler was registered with MHD
|
||||
@@ -1713,7 +2185,7 @@ MHD_FN_PURE_;
|
||||
* #MHD_SIZE_UNKNOWN for chunked uploads (if the
|
||||
* final chunk has not been processed yet)
|
||||
* @return action how to proceed, NULL
|
||||
* if the request must be closed due to a serious
|
||||
* if the request must be aborted due to a serious
|
||||
* error while handling the request (implies closure
|
||||
* of underling data stream, for HTTP/1.1 it means
|
||||
* socket closure).
|
||||
@@ -1721,8 +2193,8 @@ MHD_FN_PURE_;
|
||||
typedef const struct MHD_Action *
|
||||
(MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_NONNULL_ (3)
|
||||
*MHD_RequestCallback)(void *cls,
|
||||
struct MHD_Request *request,
|
||||
const struct MHD_String *path,
|
||||
struct MHD_Request *MHD_RESTRICT request,
|
||||
const struct MHD_String *MHD_RESTRICT path,
|
||||
enum MHD_HTTP_Method method,
|
||||
uint_fast64_t upload_size);
|
||||
|
||||
@@ -1975,7 +2447,7 @@ struct MHD_EventUpdateContext;
|
||||
* NULL if @a fd socket was not registered before
|
||||
* @param ecb_cntx the context handle to be used
|
||||
* with #MHD_daemon_event_update()
|
||||
* @return NULL if error (to connection will be closed),
|
||||
* @return NULL if error (to connection will be aborted),
|
||||
* or the new socket context
|
||||
* @ingroup event
|
||||
*/
|
||||
@@ -2005,8 +2477,8 @@ typedef MHD_APP_SOCKET_CNTX_TYPE *
|
||||
*/
|
||||
MHD_EXTERN_ void
|
||||
MHD_daemon_event_update (
|
||||
struct MHD_Daemon *daemon,
|
||||
struct MHD_EventUpdateContext *ecb_cntx,
|
||||
struct MHD_Daemon *MHD_RESTRICT daemon,
|
||||
struct MHD_EventUpdateContext *MHD_RESTRICT ecb_cntx,
|
||||
enum MHD_FdState fd_current_state)
|
||||
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2);
|
||||
|
||||
@@ -2076,7 +2548,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_WorkMode
|
||||
* that gets triggered by any MHD event.
|
||||
* This FD can be watched as an aggregate indicator for all MHD events.
|
||||
* This mode is available only on selected platforms (currently
|
||||
* GNU/Linux only), see #MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD.
|
||||
* GNU/Linux and OpenIndiana only), see #MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD.
|
||||
* When the FD is triggered, #MHD_daemon_process_nonblocking() should
|
||||
* be called.
|
||||
* Use helper macro #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH() to enable
|
||||
@@ -2441,20 +2913,38 @@ typedef void
|
||||
enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOptionBindType
|
||||
{
|
||||
/**
|
||||
* The listen socket bind to the networks address without sharing the address.
|
||||
* The listen socket bind to the networks address with sharing the address.
|
||||
* Several sockets can bind to the same address.
|
||||
*/
|
||||
MHD_D_OPTION_BIND_TYPE_SHARED = -1
|
||||
,
|
||||
/**
|
||||
* The listen socket bind to the networks address without sharing the address,
|
||||
* except allowing binding to port/address which has TIME_WAIT state (the
|
||||
* state after closing connection).
|
||||
* On some platforms it may also allow to bind to specific address if other
|
||||
* socket already bond to the same port of wildcard address (or bind to
|
||||
* wildcard address when other socket already bond to specific address
|
||||
* with the same port).
|
||||
* Typically achieved by enabling 'SO_REUSEADDR' socket option.
|
||||
* Default.
|
||||
*/
|
||||
MHD_D_OPTION_BIND_TYPE_NOT_SHARED = 0
|
||||
,
|
||||
/**
|
||||
* The listen socket bind to the networks address with sharing the address.
|
||||
* Several sockets can bind to the same address.
|
||||
* The listen socket bind to the networks address without sharing the address.
|
||||
* The daemon way fail to start when any sockets still in "TIME_WAIT" state
|
||||
* on the same port, which effectively prevents quick restart of the daemon
|
||||
* on the same port.
|
||||
* On W32 systems it works like #MHD_D_OPTION_BIND_TYPE_NOT_SHARED due to
|
||||
* the OS limitations.
|
||||
*/
|
||||
MHD_D_OPTION_BIND_TYPE_SHARED = 1
|
||||
MHD_D_OPTION_BIND_TYPE_NOT_SHARED_STRICTER = 1
|
||||
,
|
||||
/**
|
||||
* The list socket bind to the networks address in explicit exclusive mode.
|
||||
* Ignored on platforms without support for the explicit exclusive socket use.
|
||||
* Works as #MHD_D_OPTION_BIND_TYPE_NOT_SHARED_STRICTER on platforms without
|
||||
* support for the explicit exclusive socket use.
|
||||
*/
|
||||
MHD_D_OPTION_BIND_TYPE_EXCLUSIVE = 2
|
||||
};
|
||||
@@ -2479,8 +2969,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_TCPFastOpenType
|
||||
,
|
||||
/**
|
||||
* Require TCP_FASTOPEN.
|
||||
* Also causes #MHD_daemon_start() to fail if setting
|
||||
* the option fails later.
|
||||
* Also causes #MHD_daemon_start() to fail if TCP_FASTOPEN cannot be enabled.
|
||||
*/
|
||||
MHD_FOM_REQUIRE = 1
|
||||
};
|
||||
@@ -2504,19 +2993,32 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_AddressFamily
|
||||
MHD_AF_AUTO = 1
|
||||
,
|
||||
/**
|
||||
* Use IPv4.
|
||||
* Use IPv4 only.
|
||||
*/
|
||||
MHD_AF_INET4 = 2
|
||||
,
|
||||
/**
|
||||
* Use IPv6.
|
||||
* Use IPv6 only.
|
||||
*/
|
||||
MHD_AF_INET6 = 3
|
||||
,
|
||||
/**
|
||||
* Use dual stack.
|
||||
* Use dual stack (IPv4 and IPv6 on the same socket).
|
||||
*/
|
||||
MHD_AF_DUAL = 4
|
||||
,
|
||||
/**
|
||||
* Use dual stack (IPv4 and IPv6 on the same socket),
|
||||
* fallback to pure IPv6 if dual stack is not possible.
|
||||
*/
|
||||
MHD_AF_DUAL_v4_OPTIONAL = 5
|
||||
,
|
||||
/**
|
||||
* Use dual stack (IPv4 and IPv6 on the same socket),
|
||||
* fallback to pure IPv4 if dual stack is not possible.
|
||||
*/
|
||||
MHD_AF_DUAL_v6_OPTIONAL = 6
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -2529,22 +3031,22 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_SockPollSyscall
|
||||
* Automatic selection of best-available method. This is also the
|
||||
* default.
|
||||
*/
|
||||
MHD_ELS_AUTO = 0
|
||||
MHD_SPS_AUTO = 0
|
||||
,
|
||||
/**
|
||||
* Use select().
|
||||
*/
|
||||
MHD_ELS_SELECT = 1
|
||||
MHD_SPS_SELECT = 1
|
||||
,
|
||||
/**
|
||||
* Use poll().
|
||||
*/
|
||||
MHD_ELS_POLL = 2
|
||||
MHD_SPS_POLL = 2
|
||||
,
|
||||
/**
|
||||
* Use epoll.
|
||||
*/
|
||||
MHD_ELS_EPOLL = 3
|
||||
MHD_SPS_EPOLL = 3
|
||||
};
|
||||
|
||||
|
||||
@@ -2788,8 +3290,8 @@ MHD_connection_set_psk (
|
||||
typedef void
|
||||
(*MHD_PskServerCredentialsCallback)(
|
||||
void *cls,
|
||||
const struct MHD_Connection *connection,
|
||||
const struct MHD_String *username,
|
||||
const struct MHD_Connection *MHD_RESTRICT connection,
|
||||
const struct MHD_String *MHD_RESTRICT username,
|
||||
struct MHD_ServerCredentialsContext *mscc);
|
||||
|
||||
|
||||
@@ -2823,22 +3325,46 @@ typedef enum MHD_Bool
|
||||
|
||||
|
||||
/**
|
||||
* Function called by MHD to allow the application to log
|
||||
* the @a full_uri of a @a request.
|
||||
* The data for the #MHD_EarlyUriLogCallback
|
||||
*/
|
||||
struct MHD_EarlyUriCbData
|
||||
{
|
||||
/**
|
||||
* The request handle.
|
||||
* Headers are not yet available.
|
||||
*/
|
||||
struct MHD_Request *request;
|
||||
|
||||
/**
|
||||
* Pointer to the application context for the request.
|
||||
* Modifiable. Initially to NULL.
|
||||
*/
|
||||
void *request_app_context;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function called by MHD to allow the application to log the @a full_uri
|
||||
* of the new request.
|
||||
* If this callback is set then it is the first application function called
|
||||
* for the new request.
|
||||
* This is the only moment when unmodified URI is provided.
|
||||
* After this callback MHD parses the URI and modifies it
|
||||
* by extracting GET parameters in-place.
|
||||
* After this callback MHD parses the URI and modifies it by extracting
|
||||
* GET parameters in-place.
|
||||
* If #MHD_RequestTerminationCallback is set then it is guaranteed that
|
||||
* #MHD_RequestTerminationCallback is called for the same request. Application
|
||||
* may allocate request specific data in this callback and de-allocate
|
||||
* the data in #MHD_RequestTerminationCallback.
|
||||
*
|
||||
* @param cls client-defined closure
|
||||
* @param[in,out] request the HTTP request handle (headers are
|
||||
* not yet available)
|
||||
* @param full_uri the full URI from the HTTP request including parameters (after '?')
|
||||
* @param full_uri the full URI ("request target") from the HTTP request
|
||||
* including parameters (the part after '?')
|
||||
* @param[in,out] req_data the request data
|
||||
*/
|
||||
typedef void
|
||||
(MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_NONNULL_ (3)
|
||||
(MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_INOUT_ (3)
|
||||
*MHD_EarlyUriLogCallback)(void *cls,
|
||||
struct MHD_Request *request,
|
||||
const struct MHD_String *full_uri);
|
||||
const struct MHD_String *full_uri,
|
||||
struct MHD_EarlyUriCbData *req_data);
|
||||
|
||||
|
||||
/**
|
||||
@@ -2925,17 +3451,16 @@ typedef void
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_StreamNotificationCode
|
||||
{
|
||||
/**
|
||||
* A new connection has been started.
|
||||
* A new stream has been started.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_STREAM_NOTIFY_STARTED = 0
|
||||
,
|
||||
/**
|
||||
* A connection is closed.
|
||||
* A stream is closed.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_STREAM_NOTIFY_CLOSED = 1
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3015,50 +3540,56 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_RequestTerminationCode
|
||||
MHD_REQUEST_TERMINATED_COMPLETED_OK = 0
|
||||
,
|
||||
/**
|
||||
* The application terminated request without response.
|
||||
* No activity on the connection for the number of seconds specified using
|
||||
* #MHD_C_OPTION_TIMEOUT().
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_BY_APP = 1
|
||||
MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 10
|
||||
,
|
||||
/**
|
||||
* The connection was broken or TLS protocol error.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CONNECTION_ERROR = 20
|
||||
,
|
||||
/**
|
||||
* The client terminated the connection by closing the socket either
|
||||
* completely or for writing (TCP half-closed) before sending complete
|
||||
* request.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CLIENT_ABORT = 30
|
||||
,
|
||||
/**
|
||||
* The request is not valid according to
|
||||
* HTTP specifications.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_HTTP_PROTOCOL_ERROR = 2
|
||||
MHD_REQUEST_TERMINATED_HTTP_PROTOCOL_ERROR = 31
|
||||
,
|
||||
/**
|
||||
* The client terminated the connection by closing the socket
|
||||
* for writing (TCP half-closed) before sending complete request;
|
||||
* MHD aborted sending the response according to RFC 2616, section 8.1.4.
|
||||
* The application aborted request without response.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CLIENT_ABORT = 3
|
||||
MHD_REQUEST_TERMINATED_BY_APP_ABORT = 40
|
||||
,
|
||||
/**
|
||||
* The application aborted request without response.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_BY_APP_ERROR = 41
|
||||
,
|
||||
/**
|
||||
* Error handling the connection due to resources exhausted.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_NO_RESOURCES = 4
|
||||
MHD_REQUEST_TERMINATED_NO_RESOURCES = 50
|
||||
,
|
||||
/**
|
||||
* We had to close the session since MHD was being shut down.
|
||||
* Closing the session since MHD is being shut down.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 5
|
||||
,
|
||||
/**
|
||||
* No activity on the connection for the number of seconds specified using
|
||||
* #MHD_C_OPTION_TIMEOUT().
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 6
|
||||
,
|
||||
/**
|
||||
* The connection was broken or TLS protocol error.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CONNECTION_ERROR = 7
|
||||
MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 60
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3086,6 +3617,11 @@ struct MHD_RequestTerminationData
|
||||
* Detailed information about termination event
|
||||
*/
|
||||
union MHD_RequestTerminationDetail details;
|
||||
/**
|
||||
* Pointer to the application context for the request.
|
||||
* NULL unless other value set by application when processing the request.
|
||||
*/
|
||||
void *request_app_context;
|
||||
};
|
||||
|
||||
|
||||
@@ -3102,8 +3638,7 @@ struct MHD_RequestTerminationData
|
||||
*/
|
||||
typedef void
|
||||
(*MHD_RequestTerminationCallback) (void *cls,
|
||||
struct MHD_RequestTerminationData *data,
|
||||
void *request_context);
|
||||
struct MHD_RequestTerminationData *data);
|
||||
|
||||
|
||||
#include "microhttpd2_generated_response_options.h"
|
||||
|
||||
@@ -1043,7 +1043,7 @@ TOP:
|
||||
&dump_option_set_switch);
|
||||
fprintf (f,
|
||||
" case MHD_%c_O_SENTINEL:\n"
|
||||
" default: /* for -WFIXME_EG */ \n"
|
||||
" default: /* for -Wswitch-default -Wswitch-enum */ \n"
|
||||
" break;\n",
|
||||
(char) toupper (*category));
|
||||
fprintf (f,
|
||||
|
||||
Reference in New Issue
Block a user