Go to the documentation of this file.
79 #ifndef MHD_MICROHTTPD_H
80 #define MHD_MICROHTTPD_H
103 #ifndef MHD_PLATFORM_H
104 #if defined(_WIN32) && ! defined(__CYGWIN__) && \
105 ! defined(_CRT_DECLARE_NONSTDC_NAMES)
106 #define _CRT_DECLARE_NONSTDC_NAMES 1
110 #include <sys/types.h>
111 #if ! defined(_WIN32) || defined(__CYGWIN__)
113 #include <sys/time.h>
114 #include <sys/socket.h>
117 #define _CRT_DECLARE_NONSTDC_NAMES 1
118 #include <ws2tcpip.h>
119 #if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
120 #define _SSIZE_T_DEFINED
121 typedef intptr_t ssize_t;
126 #if defined(__CYGWIN__) && ! defined(_SYS_TYPES_FD_SET)
128 #error Cygwin with winsock fd_set is not supported
135 #define MHD_VERSION 0x00096900
150 #define MHD_INVALID_NONCE -1
157 #define MHD_SIZE_UNKNOWN UINT64_MAX
159 #define MHD_SIZE_UNKNOWN ((uint64_t) -1LL)
163 #define MHD_CONTENT_READER_END_OF_STREAM SIZE_MAX
164 #define MHD_CONTENT_READER_END_WITH_ERROR (SIZE_MAX - 1)
166 #define MHD_CONTENT_READER_END_OF_STREAM ((size_t) -1LL)
167 #define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1)
171 #if defined(_WIN32) && defined(MHD_W32LIB)
172 #define _MHD_EXTERN extern
173 #elif defined (_WIN32) && defined(MHD_W32DLL)
175 #define _MHD_EXTERN __declspec(dllimport)
177 #define _MHD_EXTERN extern
181 #ifndef MHD_SOCKET_DEFINED
185 #if ! defined(_WIN32) || defined(_SYS_TYPES_FD_SET)
186 #define MHD_POSIX_SOCKETS 1
188 #define MHD_INVALID_SOCKET (-1)
190 #define MHD_WINSOCK_SOCKETS 1
191 #include <winsock2.h>
193 #define MHD_INVALID_SOCKET (INVALID_SOCKET)
195 #define MHD_SOCKET_DEFINED 1
201 #ifdef MHD_NO_DEPRECATION
202 #define _MHD_DEPR_MACRO(msg)
203 #define _MHD_NO_DEPR_IN_MACRO 1
204 #define _MHD_DEPR_IN_MACRO(msg)
205 #define _MHD_NO_DEPR_FUNC 1
206 #define _MHD_DEPR_FUNC(msg)
209 #ifndef _MHD_DEPR_MACRO
210 #if defined(_MSC_FULL_VER) && _MSC_VER + 0 >= 1500
213 #define _MHD_INSTRMACRO(a) #a
214 #define _MHD_STRMACRO(a) _MHD_INSTRMACRO (a)
216 #define _MHD_DEPR_MACRO(msg) __pragma (message (__FILE__ "(" _MHD_STRMACRO ( \
217 __LINE__) "): warning: " msg))
218 #define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO (msg)
219 #elif defined(__clang__) || defined (__GNUC_PATCHLEVEL__)
221 #define _MHD_GCC_PRAG(x) _Pragma (#x)
222 #if (defined(__clang__) && (__clang_major__ + 0 >= 5 || \
223 (! defined(__apple_build_version__) && \
224 (__clang_major__ + 0 > 3 || (__clang_major__ + 0 == 3 && __clang_minor__ >= \
226 __GNUC__ + 0 > 4 || (__GNUC__ + 0 == 4 && __GNUC_MINOR__ + 0 >= 8)
229 #define _MHD_DEPR_MACRO(msg) _MHD_GCC_PRAG (GCC warning msg)
230 #define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO (msg)
233 #define _MHD_DEPR_MACRO(msg) _MHD_GCC_PRAG (message msg)
234 #if (defined(__clang__) && (__clang_major__ + 0 > 2 || (__clang_major__ + 0 == \
235 2 && __clang_minor__ >= \
238 #define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO (msg)
245 #ifndef _MHD_DEPR_MACRO
246 #define _MHD_DEPR_MACRO(msg)
249 #ifndef _MHD_DEPR_IN_MACRO
250 #define _MHD_NO_DEPR_IN_MACRO 1
251 #define _MHD_DEPR_IN_MACRO(msg)
254 #ifndef _MHD_DEPR_FUNC
255 #if defined(_MSC_FULL_VER) && _MSC_VER + 0 >= 1400
257 #define _MHD_DEPR_FUNC(msg) __declspec(deprecated (msg))
258 #elif defined(_MSC_FULL_VER) && _MSC_VER + 0 >= 1310
260 #define _MHD_DEPR_FUNC(msg) __declspec(deprecated)
261 #elif (__GNUC__ + 0 >= 5) || (defined (__clang__) && \
262 (__clang_major__ + 0 > 2 || (__clang_major__ + 0 == 2 && __clang_minor__ >= \
265 #define _MHD_DEPR_FUNC(msg) __attribute__((deprecated (msg)))
266 #elif defined (__clang__) || __GNUC__ + 0 > 3 || (__GNUC__ + 0 == 3 && \
267 __GNUC_MINOR__ + 0 >= 1)
270 #define _MHD_DEPR_FUNC(msg) __attribute__((__deprecated__))
275 #ifndef _MHD_DEPR_FUNC
276 #define _MHD_NO_DEPR_FUNC 1
277 #define _MHD_DEPR_FUNC(msg)
285 #ifndef MHD_LONG_LONG
289 #define MHD_LONG_LONG long long
290 #define MHD_UNSIGNED_LONG_LONG unsigned long long
293 "Macro MHD_LONG_LONG is deprecated, use MHD_UNSIGNED_LONG_LONG")
299 #ifndef MHD_LONG_LONG_PRINTF
303 #define MHD_LONG_LONG_PRINTF "ll"
304 #define MHD_UNSIGNED_LONG_LONG_PRINTF "%llu"
307 "Macro MHD_LONG_LONG_PRINTF is deprecated, use MHD_UNSIGNED_LONG_LONG_PRINTF")
314 #define MHD_MD5_DIGEST_SIZE 16
326 #define MHD_HTTP_CONTINUE 100
328 #define MHD_HTTP_SWITCHING_PROTOCOLS 101
330 #define MHD_HTTP_PROCESSING 102
332 #define MHD_HTTP_EARLY_HINTS 103
335 #define MHD_HTTP_OK 200
337 #define MHD_HTTP_CREATED 201
339 #define MHD_HTTP_ACCEPTED 202
341 #define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION 203
343 #define MHD_HTTP_NO_CONTENT 204
345 #define MHD_HTTP_RESET_CONTENT 205
347 #define MHD_HTTP_PARTIAL_CONTENT 206
349 #define MHD_HTTP_MULTI_STATUS 207
351 #define MHD_HTTP_ALREADY_REPORTED 208
354 #define MHD_HTTP_IM_USED 226
357 #define MHD_HTTP_MULTIPLE_CHOICES 300
359 #define MHD_HTTP_MOVED_PERMANENTLY 301
361 #define MHD_HTTP_FOUND 302
363 #define MHD_HTTP_SEE_OTHER 303
365 #define MHD_HTTP_NOT_MODIFIED 304
367 #define MHD_HTTP_USE_PROXY 305
369 #define MHD_HTTP_SWITCH_PROXY 306
371 #define MHD_HTTP_TEMPORARY_REDIRECT 307
373 #define MHD_HTTP_PERMANENT_REDIRECT 308
376 #define MHD_HTTP_BAD_REQUEST 400
378 #define MHD_HTTP_UNAUTHORIZED 401
380 #define MHD_HTTP_PAYMENT_REQUIRED 402
382 #define MHD_HTTP_FORBIDDEN 403
384 #define MHD_HTTP_NOT_FOUND 404
386 #define MHD_HTTP_METHOD_NOT_ALLOWED 405
388 #define MHD_HTTP_NOT_ACCEPTABLE 406
390 #define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407
392 #define MHD_HTTP_REQUEST_TIMEOUT 408
394 #define MHD_HTTP_CONFLICT 409
396 #define MHD_HTTP_GONE 410
398 #define MHD_HTTP_LENGTH_REQUIRED 411
400 #define MHD_HTTP_PRECONDITION_FAILED 412
402 #define MHD_HTTP_PAYLOAD_TOO_LARGE 413
404 #define MHD_HTTP_URI_TOO_LONG 414
406 #define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415
408 #define MHD_HTTP_RANGE_NOT_SATISFIABLE 416
410 #define MHD_HTTP_EXPECTATION_FAILED 417
413 #define MHD_HTTP_MISDIRECTED_REQUEST 421
415 #define MHD_HTTP_UNPROCESSABLE_ENTITY 422
417 #define MHD_HTTP_LOCKED 423
419 #define MHD_HTTP_FAILED_DEPENDENCY 424
421 #define MHD_HTTP_TOO_EARLY 425
423 #define MHD_HTTP_UPGRADE_REQUIRED 426
426 #define MHD_HTTP_PRECONDITION_REQUIRED 428
428 #define MHD_HTTP_TOO_MANY_REQUESTS 429
431 #define MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE 431
434 #define MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451
437 #define MHD_HTTP_INTERNAL_SERVER_ERROR 500
439 #define MHD_HTTP_NOT_IMPLEMENTED 501
441 #define MHD_HTTP_BAD_GATEWAY 502
443 #define MHD_HTTP_SERVICE_UNAVAILABLE 503
445 #define MHD_HTTP_GATEWAY_TIMEOUT 504
447 #define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505
449 #define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506
451 #define MHD_HTTP_INSUFFICIENT_STORAGE 507
453 #define MHD_HTTP_LOOP_DETECTED 508
456 #define MHD_HTTP_NOT_EXTENDED 510
458 #define MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED 511
463 #define MHD_HTTP_RETRY_WITH 449
466 #define MHD_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450
469 #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509
474 #define MHD_HTTP_METHOD_NOT_ACCEPTABLE \
475 _MHD_DEPR_IN_MACRO ( \
476 "Value MHD_HTTP_METHOD_NOT_ACCEPTABLE is deprecated, use MHD_HTTP_NOT_ACCEPTABLE") \
480 #define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE \
481 _MHD_DEPR_IN_MACRO ( \
482 "Value MHD_HTTP_REQUEST_ENTITY_TOO_LARGE is deprecated, use MHD_HTTP_PAYLOAD_TOO_LARGE") \
486 #define MHD_HTTP_REQUEST_URI_TOO_LONG \
487 _MHD_DEPR_IN_MACRO ( \
488 "Value MHD_HTTP_REQUEST_URI_TOO_LONG is deprecated, use MHD_HTTP_URI_TOO_LONG") \
492 #define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE \
493 _MHD_DEPR_IN_MACRO ( \
494 "Value MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE is deprecated, use MHD_HTTP_RANGE_NOT_SATISFIABLE") \
498 #define MHD_HTTP_UNORDERED_COLLECTION \
499 _MHD_DEPR_IN_MACRO ( \
500 "Value MHD_HTTP_UNORDERED_COLLECTION is deprecated as it was removed from RFC") \
504 #define MHD_HTTP_NO_RESPONSE \
505 _MHD_DEPR_IN_MACRO ( \
506 "Value MHD_HTTP_NO_RESPONSE is deprecated as it is nginx internal code for logs only") \
528 #define MHD_ICY_FLAG ((uint32_t) (((uint32_t) 1) << 31))
540 #define MHD_HTTP_HEADER_ACCEPT "Accept"
542 #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset"
544 #define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding"
546 #define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language"
548 #define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges"
550 #define MHD_HTTP_HEADER_AGE "Age"
552 #define MHD_HTTP_HEADER_ALLOW "Allow"
554 #define MHD_HTTP_HEADER_AUTHORIZATION "Authorization"
556 #define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control"
558 #define MHD_HTTP_HEADER_CLOSE "Close"
560 #define MHD_HTTP_HEADER_CONNECTION "Connection"
562 #define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding"
564 #define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language"
566 #define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length"
568 #define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location"
570 #define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range"
572 #define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type"
574 #define MHD_HTTP_HEADER_DATE "Date"
576 #define MHD_HTTP_HEADER_ETAG "ETag"
578 #define MHD_HTTP_HEADER_EXPECT "Expect"
580 #define MHD_HTTP_HEADER_EXPIRES "Expires"
582 #define MHD_HTTP_HEADER_FROM "From"
584 #define MHD_HTTP_HEADER_HOST "Host"
586 #define MHD_HTTP_HEADER_IF_MATCH "If-Match"
588 #define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since"
590 #define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match"
592 #define MHD_HTTP_HEADER_IF_RANGE "If-Range"
594 #define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since"
596 #define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified"
598 #define MHD_HTTP_HEADER_LOCATION "Location"
600 #define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards"
602 #define MHD_HTTP_HEADER_MIME_VERSION "MIME-Version"
604 #define MHD_HTTP_HEADER_PRAGMA "Pragma"
606 #define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate"
608 #define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization"
610 #define MHD_HTTP_HEADER_RANGE "Range"
612 #define MHD_HTTP_HEADER_REFERER "Referer"
614 #define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After"
616 #define MHD_HTTP_HEADER_SERVER "Server"
618 #define MHD_HTTP_HEADER_TE "TE"
620 #define MHD_HTTP_HEADER_TRAILER "Trailer"
622 #define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
624 #define MHD_HTTP_HEADER_UPGRADE "Upgrade"
626 #define MHD_HTTP_HEADER_USER_AGENT "User-Agent"
628 #define MHD_HTTP_HEADER_VARY "Vary"
630 #define MHD_HTTP_HEADER_VIA "Via"
632 #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate"
634 #define MHD_HTTP_HEADER_WARNING "Warning"
638 #define MHD_HTTP_HEADER_A_IM "A-IM"
640 #define MHD_HTTP_HEADER_ACCEPT_ADDITIONS "Accept-Additions"
642 #define MHD_HTTP_HEADER_ACCEPT_DATETIME "Accept-Datetime"
644 #define MHD_HTTP_HEADER_ACCEPT_FEATURES "Accept-Features"
646 #define MHD_HTTP_HEADER_ACCEPT_PATCH "Accept-Patch"
648 #define MHD_HTTP_HEADER_ACCEPT_POST "Accept-Post"
650 #define MHD_HTTP_HEADER_ALPN "ALPN"
652 #define MHD_HTTP_HEADER_ALT_SVC "Alt-Svc"
654 #define MHD_HTTP_HEADER_ALT_USED "Alt-Used"
656 #define MHD_HTTP_HEADER_ALTERNATES "Alternates"
658 #define MHD_HTTP_HEADER_APPLY_TO_REDIRECT_REF "Apply-To-Redirect-Ref"
660 #define MHD_HTTP_HEADER_AUTHENTICATION_CONTROL "Authentication-Control"
662 #define MHD_HTTP_HEADER_AUTHENTICATION_INFO "Authentication-Info"
664 #define MHD_HTTP_HEADER_C_EXT "C-Ext"
666 #define MHD_HTTP_HEADER_C_MAN "C-Man"
668 #define MHD_HTTP_HEADER_C_OPT "C-Opt"
670 #define MHD_HTTP_HEADER_C_PEP "C-PEP"
672 #define MHD_HTTP_HEADER_C_PEP_INFO "C-PEP-Info"
674 #define MHD_HTTP_HEADER_CAL_MANAGED_ID "Cal-Managed-ID"
676 #define MHD_HTTP_HEADER_CALDAV_TIMEZONES "CalDAV-Timezones"
678 #define MHD_HTTP_HEADER_CDN_LOOP "CDN-Loop"
680 #define MHD_HTTP_HEADER_CONTENT_BASE "Content-Base"
682 #define MHD_HTTP_HEADER_CONTENT_DISPOSITION "Content-Disposition"
684 #define MHD_HTTP_HEADER_CONTENT_ID "Content-ID"
686 #define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5"
688 #define MHD_HTTP_HEADER_CONTENT_SCRIPT_TYPE "Content-Script-Type"
690 #define MHD_HTTP_HEADER_CONTENT_STYLE_TYPE "Content-Style-Type"
692 #define MHD_HTTP_HEADER_CONTENT_VERSION "Content-Version"
694 #define MHD_HTTP_HEADER_COOKIE "Cookie"
696 #define MHD_HTTP_HEADER_COOKIE2 "Cookie2"
698 #define MHD_HTTP_HEADER_DASL "DASL"
700 #define MHD_HTTP_HEADER_DAV "DAV"
702 #define MHD_HTTP_HEADER_DEFAULT_STYLE "Default-Style"
704 #define MHD_HTTP_HEADER_DELTA_BASE "Delta-Base"
706 #define MHD_HTTP_HEADER_DEPTH "Depth"
708 #define MHD_HTTP_HEADER_DERIVED_FROM "Derived-From"
710 #define MHD_HTTP_HEADER_DESTINATION "Destination"
712 #define MHD_HTTP_HEADER_DIFFERENTIAL_ID "Differential-ID"
714 #define MHD_HTTP_HEADER_DIGEST "Digest"
716 #define MHD_HTTP_HEADER_EARLY_DATA "Early-Data"
718 #define MHD_HTTP_HEADER_EXPECT_CT "Expect-CT"
720 #define MHD_HTTP_HEADER_EXT "Ext"
722 #define MHD_HTTP_HEADER_FORWARDED "Forwarded"
724 #define MHD_HTTP_HEADER_GETPROFILE "GetProfile"
726 #define MHD_HTTP_HEADER_HOBAREG "Hobareg"
728 #define MHD_HTTP_HEADER_HTTP2_SETTINGS "HTTP2-Settings"
730 #define MHD_HTTP_HEADER_IM "IM"
732 #define MHD_HTTP_HEADER_IF "If"
734 #define MHD_HTTP_HEADER_IF_SCHEDULE_TAG_MATCH "If-Schedule-Tag-Match"
736 #define MHD_HTTP_HEADER_INCLUDE_REFERRED_TOKEN_BINDING_ID \
737 "Include-Referred-Token-Binding-ID"
739 #define MHD_HTTP_HEADER_KEEP_ALIVE "Keep-Alive"
741 #define MHD_HTTP_HEADER_LABEL "Label"
743 #define MHD_HTTP_HEADER_LINK "Link"
745 #define MHD_HTTP_HEADER_LOCK_TOKEN "Lock-Token"
747 #define MHD_HTTP_HEADER_MAN "Man"
749 #define MHD_HTTP_HEADER_MEMENTO_DATETIME "Memento-Datetime"
751 #define MHD_HTTP_HEADER_METER "Meter"
753 #define MHD_HTTP_HEADER_NEGOTIATE "Negotiate"
755 #define MHD_HTTP_HEADER_OPT "Opt"
757 #define MHD_HTTP_HEADER_OPTIONAL_WWW_AUTHENTICATE "Optional-WWW-Authenticate"
759 #define MHD_HTTP_HEADER_ORDERING_TYPE "Ordering-Type"
761 #define MHD_HTTP_HEADER_ORIGIN "Origin"
763 #define MHD_HTTP_HEADER_OSCORE "OSCORE"
765 #define MHD_HTTP_HEADER_OVERWRITE "Overwrite"
767 #define MHD_HTTP_HEADER_P3P "P3P"
769 #define MHD_HTTP_HEADER_PEP "PEP"
771 #define MHD_HTTP_HEADER_PICS_LABEL "PICS-Label"
773 #define MHD_HTTP_HEADER_PEP_INFO "Pep-Info"
775 #define MHD_HTTP_HEADER_POSITION "Position"
777 #define MHD_HTTP_HEADER_PREFER "Prefer"
779 #define MHD_HTTP_HEADER_PREFERENCE_APPLIED "Preference-Applied"
781 #define MHD_HTTP_HEADER_PROFILEOBJECT "ProfileObject"
783 #define MHD_HTTP_HEADER_PROTOCOL "Protocol"
785 #define MHD_HTTP_HEADER_PROTOCOL_INFO "Protocol-Info"
787 #define MHD_HTTP_HEADER_PROTOCOL_QUERY "Protocol-Query"
789 #define MHD_HTTP_HEADER_PROTOCOL_REQUEST "Protocol-Request"
791 #define MHD_HTTP_HEADER_PROXY_AUTHENTICATION_INFO "Proxy-Authentication-Info"
793 #define MHD_HTTP_HEADER_PROXY_FEATURES "Proxy-Features"
795 #define MHD_HTTP_HEADER_PROXY_INSTRUCTION "Proxy-Instruction"
797 #define MHD_HTTP_HEADER_PUBLIC "Public"
799 #define MHD_HTTP_HEADER_PUBLIC_KEY_PINS "Public-Key-Pins"
801 #define MHD_HTTP_HEADER_PUBLIC_KEY_PINS_REPORT_ONLY \
802 "Public-Key-Pins-Report-Only"
804 #define MHD_HTTP_HEADER_REDIRECT_REF "Redirect-Ref"
806 #define MHD_HTTP_HEADER_REPLAY_NONCE "Replay-Nonce"
808 #define MHD_HTTP_HEADER_SAFE "Safe"
810 #define MHD_HTTP_HEADER_SCHEDULE_REPLY "Schedule-Reply"
812 #define MHD_HTTP_HEADER_SCHEDULE_TAG "Schedule-Tag"
814 #define MHD_HTTP_HEADER_SEC_TOKEN_BINDING "Sec-Token-Binding"
816 #define MHD_HTTP_HEADER_SEC_WEBSOCKET_ACCEPT "Sec-WebSocket-Accept"
818 #define MHD_HTTP_HEADER_SEC_WEBSOCKET_EXTENSIONS "Sec-WebSocket-Extensions"
820 #define MHD_HTTP_HEADER_SEC_WEBSOCKET_KEY "Sec-WebSocket-Key"
822 #define MHD_HTTP_HEADER_SEC_WEBSOCKET_PROTOCOL "Sec-WebSocket-Protocol"
824 #define MHD_HTTP_HEADER_SEC_WEBSOCKET_VERSION "Sec-WebSocket-Version"
826 #define MHD_HTTP_HEADER_SECURITY_SCHEME "Security-Scheme"
828 #define MHD_HTTP_HEADER_SET_COOKIE "Set-Cookie"
830 #define MHD_HTTP_HEADER_SET_COOKIE2 "Set-Cookie2"
832 #define MHD_HTTP_HEADER_SETPROFILE "SetProfile"
834 #define MHD_HTTP_HEADER_SLUG "SLUG"
836 #define MHD_HTTP_HEADER_SOAPACTION "SoapAction"
838 #define MHD_HTTP_HEADER_STATUS_URI "Status-URI"
840 #define MHD_HTTP_HEADER_STRICT_TRANSPORT_SECURITY "Strict-Transport-Security"
842 #define MHD_HTTP_HEADER_SUNSET "Sunset"
844 #define MHD_HTTP_HEADER_SURROGATE_CAPABILITY "Surrogate-Capability"
846 #define MHD_HTTP_HEADER_SURROGATE_CONTROL "Surrogate-Control"
848 #define MHD_HTTP_HEADER_TCN "TCN"
850 #define MHD_HTTP_HEADER_TIMEOUT "Timeout"
852 #define MHD_HTTP_HEADER_TOPIC "Topic"
854 #define MHD_HTTP_HEADER_TTL "TTL"
856 #define MHD_HTTP_HEADER_URGENCY "Urgency"
858 #define MHD_HTTP_HEADER_URI "URI"
860 #define MHD_HTTP_HEADER_VARIANT_VARY "Variant-Vary"
862 #define MHD_HTTP_HEADER_WANT_DIGEST "Want-Digest"
864 #define MHD_HTTP_HEADER_X_CONTENT_TYPE_OPTIONS "X-Content-Type-Options"
866 #define MHD_HTTP_HEADER_X_FRAME_OPTIONS "X-Frame-Options"
869 #define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN \
870 "Access-Control-Allow-Origin"
879 #define MHD_HTTP_VERSION_1_0 "HTTP/1.0"
880 #define MHD_HTTP_VERSION_1_1 "HTTP/1.1"
894 #define MHD_HTTP_METHOD_CONNECT "CONNECT"
896 #define MHD_HTTP_METHOD_DELETE "DELETE"
898 #define MHD_HTTP_METHOD_GET "GET"
900 #define MHD_HTTP_METHOD_HEAD "HEAD"
902 #define MHD_HTTP_METHOD_OPTIONS "OPTIONS"
904 #define MHD_HTTP_METHOD_POST "POST"
906 #define MHD_HTTP_METHOD_PUT "PUT"
908 #define MHD_HTTP_METHOD_TRACE "TRACE"
912 #define MHD_HTTP_METHOD_ACL "ACL"
914 #define MHD_HTTP_METHOD_BASELINE_CONTROL "BASELINE-CONTROL"
916 #define MHD_HTTP_METHOD_BIND "BIND"
918 #define MHD_HTTP_METHOD_CHECKIN "CHECKIN"
920 #define MHD_HTTP_METHOD_CHECKOUT "CHECKOUT"
922 #define MHD_HTTP_METHOD_COPY "COPY"
924 #define MHD_HTTP_METHOD_LABEL "LABEL"
926 #define MHD_HTTP_METHOD_LINK "LINK"
928 #define MHD_HTTP_METHOD_LOCK "LOCK"
930 #define MHD_HTTP_METHOD_MERGE "MERGE"
932 #define MHD_HTTP_METHOD_MKACTIVITY "MKACTIVITY"
934 #define MHD_HTTP_METHOD_MKCALENDAR "MKCALENDAR"
936 #define MHD_HTTP_METHOD_MKCOL "MKCOL"
938 #define MHD_HTTP_METHOD_MKREDIRECTREF "MKREDIRECTREF"
940 #define MHD_HTTP_METHOD_MKWORKSPACE "MKWORKSPACE"
942 #define MHD_HTTP_METHOD_MOVE "MOVE"
944 #define MHD_HTTP_METHOD_ORDERPATCH "ORDERPATCH"
946 #define MHD_HTTP_METHOD_PATCH "PATCH"
948 #define MHD_HTTP_METHOD_PRI "PRI"
950 #define MHD_HTTP_METHOD_PROPFIND "PROPFIND"
952 #define MHD_HTTP_METHOD_PROPPATCH "PROPPATCH"
954 #define MHD_HTTP_METHOD_REBIND "REBIND"
956 #define MHD_HTTP_METHOD_REPORT "REPORT"
958 #define MHD_HTTP_METHOD_SEARCH "SEARCH"
960 #define MHD_HTTP_METHOD_UNBIND "UNBIND"
962 #define MHD_HTTP_METHOD_UNCHECKOUT "UNCHECKOUT"
964 #define MHD_HTTP_METHOD_UNLINK "UNLINK"
966 #define MHD_HTTP_METHOD_UNLOCK "UNLOCK"
968 #define MHD_HTTP_METHOD_UPDATE "UPDATE"
970 #define MHD_HTTP_METHOD_UPDATEREDIRECTREF "UPDATEREDIRECTREF"
972 #define MHD_HTTP_METHOD_VERSION_CONTROL "VERSION-CONTROL"
981 #define MHD_HTTP_POST_ENCODING_FORM_URLENCODED \
982 "application/x-www-form-urlencoded"
983 #define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data"
1014 struct MHD_PostProcessor;
1058 #define MHD_USE_SSL \
1059 _MHD_DEPR_IN_MACRO ("Value MHD_USE_SSL is deprecated, use MHD_USE_TLS") \
1083 #define MHD_USE_SELECT_INTERNALLY \
1084 _MHD_DEPR_IN_MACRO ( \
1085 "Value MHD_USE_SELECT_INTERNALLY is deprecated, use MHD_USE_INTERNAL_POLLING_THREAD instead") \
1086 MHD_USE_INTERNAL_POLLING_THREAD
1109 #define MHD_USE_PEDANTIC_CHECKS \
1110 _MHD_DEPR_IN_MACRO ( \
1111 "Flag MHD_USE_PEDANTIC_CHECKS is deprecated, use option MHD_OPTION_STRICT_FOR_CLIENT instead") \
1134 #define MHD_USE_POLL_INTERNALLY \
1135 _MHD_DEPR_IN_MACRO ( \
1136 "Value MHD_USE_POLL_INTERNALLY is deprecated, use MHD_USE_POLL_INTERNAL_THREAD instead") \
1137 MHD_USE_POLL_INTERNAL_THREAD
1151 #define MHD_SUPPRESS_DATE_NO_CLOCK \
1152 _MHD_DEPR_IN_MACRO ( \
1153 "Value MHD_SUPPRESS_DATE_NO_CLOCK is deprecated, use MHD_USE_SUPPRESS_DATE_NO_CLOCK instead") \
1154 MHD_USE_SUPPRESS_DATE_NO_CLOCK
1178 #define MHD_USE_EPOLL_LINUX_ONLY \
1179 _MHD_DEPR_IN_MACRO ( \
1180 "Value MHD_USE_EPOLL_LINUX_ONLY is deprecated, use MHD_USE_EPOLL") \
1199 #define MHD_USE_EPOLL_INTERNALLY \
1200 _MHD_DEPR_IN_MACRO ( \
1201 "Value MHD_USE_EPOLL_INTERNALLY is deprecated, use MHD_USE_EPOLL_INTERNAL_THREAD") \
1202 MHD_USE_EPOLL_INTERNAL_THREAD
1204 #define MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY \
1205 _MHD_DEPR_IN_MACRO ( \
1206 "Value MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY is deprecated, use MHD_USE_EPOLL_INTERNAL_THREAD") \
1207 MHD_USE_EPOLL_INTERNAL_THREAD
1227 #define MHD_USE_PIPE_FOR_SHUTDOWN \
1228 _MHD_DEPR_IN_MACRO ( \
1229 "Value MHD_USE_PIPE_FOR_SHUTDOWN is deprecated, use MHD_USE_ITC") \
1249 #define MHD_USE_EPOLL_TURBO \
1250 _MHD_DEPR_IN_MACRO ( \
1251 "Value MHD_USE_EPOLL_TURBO is deprecated, use MHD_USE_TURBO") \
1264 #define MHD_USE_SUSPEND_RESUME \
1265 _MHD_DEPR_IN_MACRO ( \
1266 "Value MHD_USE_SUSPEND_RESUME is deprecated, use MHD_ALLOW_SUSPEND_RESUME instead") \
1267 MHD_ALLOW_SUSPEND_RESUME
1349 const char *username,
1765 #define MHD_RESPONSE_HEADER_KIND \
1766 _MHD_DEPR_IN_MACRO ( \
1767 "Value MHD_RESPONSE_HEADER_KIND is deprecated and not used") \
1768 MHD_RESPONSE_HEADER_KIND
2110 const char *reason);
2122 const struct sockaddr *addr,
2171 const char *upload_data,
2172 size_t *upload_data_size,
2357 const char *filename,
2358 const char *content_type,
2359 const char *transfer_encoding,
2486 const struct sockaddr *addr,
2521 fd_set *read_fd_set,
2522 fd_set *write_fd_set,
2523 fd_set *except_fd_set,
2561 fd_set *read_fd_set,
2562 fd_set *write_fd_set,
2563 fd_set *except_fd_set,
2565 unsigned int fd_setsize);
2592 #define MHD_get_fdset(daemon,read_fd_set,write_fd_set,except_fd_set,max_fd) \
2593 MHD_get_fdset2 ((daemon),(read_fd_set),(write_fd_set),(except_fd_set), \
2594 (max_fd),FD_SETSIZE)
2668 const fd_set *read_fd_set,
2669 const fd_set *write_fd_set,
2670 const fd_set *except_fd_set);
2691 void *iterator_cls);
2710 void *iterator_cls);
2853 const char **value_ptr,
2854 size_t *value_size_ptr);
2870 unsigned int status_code,
3026 "MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer()") \
3154 "Function MHD_create_response_from_fd_at_offset() is deprecated, use MHD_create_response_from_fd_at_offset64()") \
3160 #if ! defined(_MHD_NO_DEPR_IN_MACRO) || defined(_MHD_NO_DEPR_FUNC)
3163 #define MHD_create_response_from_fd_at_offset(size,fd,offset) \
3164 _MHD_DEPR_IN_MACRO ( \
3165 "Usage of MHD_create_response_from_fd_at_offset() is deprecated, use MHD_create_response_from_fd_at_offset64()") \
3166 MHD_create_response_from_fd_at_offset64 ((size),(fd),(offset))
3226 struct MHD_UpgradeResponseHandle;
3298 const char *extra_in,
3299 size_t extra_in_size,
3301 struct MHD_UpgradeResponseHandle *urh);
3335 void *upgrade_handler_cls);
3364 const char *content);
3379 const char *content);
3394 const char *content);
3410 void *iterator_cls);
3474 const char *post_data,
size_t post_data_len);
3499 #define MHD_INVALID_NONCE -1
3567 const char *username,
3568 const char *password,
3569 unsigned int nonce_timeout,
3594 const char *username,
3595 const char *password,
3596 unsigned int nonce_timeout);
3619 const char *username,
3620 const uint8_t *digest,
3622 unsigned int nonce_timeout,
3647 const char *username,
3649 unsigned int nonce_timeout);
_MHD_EXTERN const union MHD_DaemonInfo * MHD_get_daemon_info(struct MHD_Daemon *daemon, enum MHD_DaemonInfoType info_type,...)
_MHD_EXTERN int MHD_get_response_headers(struct MHD_Response *response, MHD_KeyValueIterator iterator, void *iterator_cls)
_MHD_EXTERN struct MHD_Daemon * MHD_start_daemon(unsigned int flags, uint16_t port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls,...)
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_callback(uint64_t size, size_t block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc)
void(* MHD_ContentReaderFreeCallback)(void *cls)
MHD_AcceptPolicyCallback apc
_MHD_EXTERN int MHD_get_fdset2(struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, MHD_socket *max_fd, unsigned int fd_setsize)
MHD_ContentReaderFreeCallback crfc
_MHD_EXTERN int MHD_add_response_header(struct MHD_Response *response, const char *header, const char *content)
#define MHD_UNSIGNED_LONG_LONG
_MHD_EXTERN int MHD_post_process(struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len)
_MHD_EXTERN int MHD_set_connection_option(struct MHD_Connection *connection, enum MHD_CONNECTION_OPTION option,...)
_MHD_EXTERN int MHD_queue_basic_auth_fail_response(struct MHD_Connection *connection, const char *realm, struct MHD_Response *response)
int(* MHD_PostDataIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size)
unsigned int num_connections
MHD_FLAG
Flags for the struct MHD_Daemon.
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_fd64(uint64_t size, int fd)
_MHD_EXTERN int MHD_get_connection_values(struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls)
_MHD_EXTERN int MHD_digest_auth_check(struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout)
_MHD_EXTERN void MHD_set_panic_func(MHD_PanicCallback cb, void *cls)
struct MHD_Daemon * daemon
MHD_ContentReaderCallback crc
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
_MHD_EXTERN MHD_socket MHD_quiesce_daemon(struct MHD_Daemon *daemon)
_MHD_EXTERN int MHD_digest_auth_check_digest(struct MHD_Connection *connection, const char *realm, const char *username, const uint8_t digest[MHD_MD5_DIGEST_SIZE], unsigned int nonce_timeout)
_MHD_EXTERN int MHD_queue_auth_fail_response2(struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale, enum MHD_DigestAuthAlgorithm algo)
unsigned int connection_timeout
_MHD_EXTERN void MHD_suspend_connection(struct MHD_Connection *connection)
_MHD_EXTERN int MHD_lookup_connection_value_n(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, size_t key_size, const char **value_ptr, size_t *value_size_ptr)
#define MHD_MD5_DIGEST_SIZE
_MHD_EXTERN char * MHD_digest_auth_get_username(struct MHD_Connection *connection)
_MHD_EXTERN const union MHD_ConnectionInfo * MHD_get_connection_info(struct MHD_Connection *connection, enum MHD_ConnectionInfoType info_type,...)
_MHD_EXTERN int MHD_queue_auth_fail_response(struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale)
_MHD_EXTERN void MHD_destroy_response(struct MHD_Response *response)
#define MHD_create_response_from_fd_at_offset(size, fd, offset)
const _MHD_EXTERN char * MHD_get_version(void)
_MHD_EXTERN int MHD_digest_auth_check_digest2(struct MHD_Connection *connection, const char *realm, const char *username, const uint8_t *digest, size_t digest_size, unsigned int nonce_timeout, enum MHD_DigestAuthAlgorithm algo)
_MHD_EXTERN int MHD_upgrade_action(struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action,...)
_MHD_EXTERN int MHD_get_connection_values_n(struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIteratorN iterator, void *iterator_cls)
_MHD_EXTERN int MHD_digest_auth_check2(struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout, enum MHD_DigestAuthAlgorithm algo)
int(* MHD_KeyValueIteratorN)(void *cls, enum MHD_ValueKind kind, const char *key, size_t key_size, const char *value, size_t value_size)
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
void(* MHD_NotifyConnectionCallback)(void *cls, struct MHD_Connection *connection, void **socket_context, enum MHD_ConnectionNotificationCode toe)
int(* MHD_KeyValueIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
_MHD_EXTERN char * MHD_basic_auth_get_username_password(struct MHD_Connection *connection, char **password)
_MHD_EXTERN int MHD_add_response_footer(struct MHD_Response *response, const char *footer, const char *content)
struct MHD_Response * MHD_create_response_from_data(size_t size, void *data, int must_free, int must_copy)
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_fd_at_offset64(uint64_t size, int fd, uint64_t offset)
_MHD_EXTERN int MHD_set_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value)
#define MHD_get_fdset(daemon, read_fd_set, write_fd_set, except_fd_set, max_fd)
const _MHD_EXTERN char * MHD_lookup_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
_MHD_EXTERN int MHD_is_feature_supported(enum MHD_FEATURE feature)
_MHD_EXTERN int MHD_run_from_select(struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set)
int(* MHD_AccessHandlerCallback)(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
_MHD_EXTERN int MHD_queue_response(struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
_MHD_EXTERN void MHD_stop_daemon(struct MHD_Daemon *daemon)
_MHD_EXTERN void MHD_free(void *ptr)
_MHD_EXTERN struct MHD_Response * MHD_create_response_for_upgrade(MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls)
int MHD_set_connection_value_n(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, size_t key_size, const char *value, size_t value_size)
_MHD_EXTERN int MHD_run(struct MHD_Daemon *daemon)
void(* MHD_UpgradeHandler)(void *cls, struct MHD_Connection *connection, void *con_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, struct MHD_UpgradeResponseHandle *urh)
#define _MHD_DEPR_MACRO(msg)
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_fd(size_t size, int fd)
_MHD_EXTERN size_t MHD_http_unescape(char *val)
MHD_ConnectionNotificationCode
const _MHD_EXTERN char * MHD_get_reason_phrase_for(unsigned int code)
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_buffer(size_t size, void *buffer, enum MHD_ResponseMemoryMode mode)
_MHD_EXTERN void MHD_resume_connection(struct MHD_Connection *connection)
_MHD_EXTERN struct MHD_PostProcessor * MHD_create_post_processor(struct MHD_Connection *connection, size_t buffer_size, MHD_PostDataIterator iter, void *iter_cls)
struct sockaddr * client_addr
_MHD_EXTERN int MHD_set_response_options(struct MHD_Response *response, enum MHD_ResponseFlags flags,...)
_MHD_EXTERN int MHD_destroy_post_processor(struct MHD_PostProcessor *pp)
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
int(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
MHD_RequestTerminationCode
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_buffer_with_free_callback(size_t size, void *buffer, MHD_ContentReaderFreeCallback crfc)
_MHD_EXTERN struct MHD_Daemon * MHD_start_daemon_va(unsigned int flags, uint16_t port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls, va_list ap)
_MHD_EXTERN int MHD_get_timeout(struct MHD_Daemon *daemon, MHD_UNSIGNED_LONG_LONG *timeout)
_MHD_EXTERN int MHD_del_response_header(struct MHD_Response *response, const char *header, const char *content)
#define MHD_RESPONSE_HEADER_KIND
const _MHD_EXTERN char * MHD_get_response_header(struct MHD_Response *response, const char *key)
_MHD_EXTERN int MHD_add_connection(struct MHD_Daemon *daemon, MHD_socket client_socket, const struct sockaddr *addr, socklen_t addrlen)
#define _MHD_DEPR_FUNC(msg)
int(* MHD_PskServerCredentialsCallback)(void *cls, const struct MHD_Connection *connection, const char *username, void **psk, size_t *psk_size)