diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-09-24 23:11:59 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-09-24 23:11:59 +0200 |
commit | 697b4af5fc205ffa6ed517756f5806ad56c2734f (patch) | |
tree | 5f6386a9c4e9a5f29fd70b6fcab32f3512545dff | |
parent | 7f502256a226f6a2a2bc79c85ba51ea6eca829ec (diff) | |
download | libmicrohttpd-697b4af5fc205ffa6ed517756f5806ad56c2734f.tar.gz libmicrohttpd-697b4af5fc205ffa6ed517756f5806ad56c2734f.zip |
more fixes from discussion with EG
-rw-r--r-- | src/include/microhttpd2.h | 168 |
1 files changed, 114 insertions, 54 deletions
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h index 49b866e1..8255e8e1 100644 --- a/src/include/microhttpd2.h +++ b/src/include/microhttpd2.h | |||
@@ -28,7 +28,7 @@ | |||
28 | * | 28 | * |
29 | * Main goals: | 29 | * Main goals: |
30 | * - simplify application callbacks by splitting header/upload/post | 30 | * - simplify application callbacks by splitting header/upload/post |
31 | * functionality currently provided by calling the same | 31 | * functionality currently provided by calling the same |
32 | * MHD_AccessHandlerCallback 3+ times into separate callbacks. | 32 | * MHD_AccessHandlerCallback 3+ times into separate callbacks. |
33 | * - keep the API very simple for simple requests, but allow | 33 | * - keep the API very simple for simple requests, but allow |
34 | * more complex logic to be incrementally introduced | 34 | * more complex logic to be incrementally introduced |
@@ -55,12 +55,12 @@ | |||
55 | * - use more consistent prefixes for related functions | 55 | * - use more consistent prefixes for related functions |
56 | * by using MHD_subject_verb_object naming convention, also | 56 | * by using MHD_subject_verb_object naming convention, also |
57 | * at the same time avoid symbol conflict with legacy names | 57 | * at the same time avoid symbol conflict with legacy names |
58 | * (so we can have one binary implementing old and new | 58 | * (so we can have one binary implementing old and new |
59 | * library API at the same time via compatibility layer). | 59 | * library API at the same time via compatibility layer). |
60 | * - make it impossible to queue a response at the wrong time | 60 | * - make it impossible to queue a response at the wrong time |
61 | * - make it impossible to suspend a connection/request at the | 61 | * - make it impossible to suspend a connection/request at the |
62 | * wrong time (improves thread-safety) | 62 | * wrong time (improves thread-safety) |
63 | * - make it clear which response status codes are "properly" | 63 | * - make it clear which response status codes are "properly" |
64 | * supported (include the descriptive string) by using an enum; | 64 | * supported (include the descriptive string) by using an enum; |
65 | * - simplify API for common-case of one-shot responses by | 65 | * - simplify API for common-case of one-shot responses by |
66 | * eliminating need for destroy response in most cases; | 66 | * eliminating need for destroy response in most cases; |
@@ -106,7 +106,7 @@ struct MHD_Request; | |||
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Return values for reporting errors, also used | 108 | * Return values for reporting errors, also used |
109 | * for logging. | 109 | * for logging. |
110 | * | 110 | * |
111 | * A value of 0 indicates success (as a return value). | 111 | * A value of 0 indicates success (as a return value). |
112 | * Values between 1 and 10000 must not be used. | 112 | * Values between 1 and 10000 must not be used. |
@@ -123,7 +123,7 @@ enum MHD_StatusCode | |||
123 | * Successful operation (not used for logging). | 123 | * Successful operation (not used for logging). |
124 | */ | 124 | */ |
125 | MHD_SC_OK = 0, | 125 | MHD_SC_OK = 0, |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Informational event, MHD started. | 128 | * Informational event, MHD started. |
129 | */ | 129 | */ |
@@ -141,11 +141,11 @@ enum MHD_StatusCode | |||
141 | MHD_TLS_BACKEND_UNSUPPORTED = 50001, | 141 | MHD_TLS_BACKEND_UNSUPPORTED = 50001, |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * The application requested a TLS cipher suite which is not | 144 | * The application requested a TLS cipher suite which is not |
145 | * supported by the selected backend. | 145 | * supported by the selected backend. |
146 | */ | 146 | */ |
147 | MHD_TLS_CIPHERS_INVALID = 50002 | 147 | MHD_TLS_CIPHERS_INVALID = 50002 |
148 | 148 | ||
149 | }; | 149 | }; |
150 | 150 | ||
151 | 151 | ||
@@ -157,6 +157,55 @@ struct MHD_Action; | |||
157 | 157 | ||
158 | 158 | ||
159 | /** | 159 | /** |
160 | * HTTP methods explicitly supported by MHD. Note that for | ||
161 | * non-canonical methods, MHD will return #MHD_METHOD_UNKNOWN | ||
162 | * and you can use #MHD_REQUEST_INFORMATION_HTTP_METHOD to get | ||
163 | * the original string. | ||
164 | */ | ||
165 | enum MHD_Method | ||
166 | { | ||
167 | |||
168 | /** | ||
169 | * Method did not match any of the methods given below. | ||
170 | */ | ||
171 | MHD_METHOD_UNKNOWN = 0, | ||
172 | |||
173 | /** | ||
174 | * "GET" method. | ||
175 | */ | ||
176 | MHD_METHOD_GET = 1, | ||
177 | |||
178 | /** | ||
179 | * "HEAD" method. | ||
180 | */ | ||
181 | MHD_METHOD_HEAD = 2, | ||
182 | |||
183 | /** | ||
184 | * "PUT" method. | ||
185 | */ | ||
186 | MHD_METHOD_PUT = 3, | ||
187 | |||
188 | /** | ||
189 | * "POST" method. | ||
190 | */ | ||
191 | MHD_METHOD_POST = 4, | ||
192 | |||
193 | /** | ||
194 | * "OPTIONS" method. | ||
195 | */ | ||
196 | MHD_METHOD_OPTIONS = 5, | ||
197 | |||
198 | /** | ||
199 | * "TRACE" method. | ||
200 | */ | ||
201 | MHD_METHOD_TRACE = 6, | ||
202 | |||
203 | // more? | ||
204 | |||
205 | }; | ||
206 | |||
207 | |||
208 | /** | ||
160 | * A client has requested the given url using the given method | 209 | * A client has requested the given url using the given method |
161 | * (#MHD_HTTP_METHOD_GET, #MHD_HTTP_METHOD_PUT, | 210 | * (#MHD_HTTP_METHOD_GET, #MHD_HTTP_METHOD_PUT, |
162 | * #MHD_HTTP_METHOD_DELETE, #MHD_HTTP_METHOD_POST, etc). The callback | 211 | * #MHD_HTTP_METHOD_DELETE, #MHD_HTTP_METHOD_POST, etc). The callback |
@@ -177,7 +226,7 @@ typedef struct MHD_Action * | |||
177 | (*MHD_RequestCallback) (void *cls, | 226 | (*MHD_RequestCallback) (void *cls, |
178 | struct MHD_Request *request, | 227 | struct MHD_Request *request, |
179 | const char *url, | 228 | const char *url, |
180 | const char *method); | 229 | enum MHD_Method method); |
181 | 230 | ||
182 | 231 | ||
183 | /** | 232 | /** |
@@ -304,7 +353,7 @@ MHD_daemon_suppress_date_no_clock (struct MHD_Daemon *daemon); | |||
304 | * You should only use this function if you are sure you do | 353 | * You should only use this function if you are sure you do |
305 | * satisfy all of its requirements and need a generally minor | 354 | * satisfy all of its requirements and need a generally minor |
306 | * boost in performance. | 355 | * boost in performance. |
307 | * | 356 | * |
308 | * @param daemon which instance to disable itc for | 357 | * @param daemon which instance to disable itc for |
309 | */ | 358 | */ |
310 | _MHD_EXTERN void | 359 | _MHD_EXTERN void |
@@ -356,11 +405,11 @@ MHD_daemon_disallow_upgrade (struct MHD_Daemon *daemon); | |||
356 | */ | 405 | */ |
357 | enum MHD_FastOpenMethod | 406 | enum MHD_FastOpenMethod |
358 | { | 407 | { |
359 | /** | 408 | /** |
360 | * Disable use of TCP_FASTOPEN. | 409 | * Disable use of TCP_FASTOPEN. |
361 | */ | 410 | */ |
362 | MHD_FOM_DISABLE = -1, | 411 | MHD_FOM_DISABLE = -1, |
363 | 412 | ||
364 | /** | 413 | /** |
365 | * Enable TCP_FASTOPEN where supported (Linux with a kernel >= 3.6). | 414 | * Enable TCP_FASTOPEN where supported (Linux with a kernel >= 3.6). |
366 | * This is the default. | 415 | * This is the default. |
@@ -377,12 +426,12 @@ enum MHD_FastOpenMethod | |||
377 | 426 | ||
378 | 427 | ||
379 | /** | 428 | /** |
380 | * Configure TCP_FASTOPEN option, including setting a | 429 | * Configure TCP_FASTOPEN option, including setting a |
381 | * custom @a queue_length. | 430 | * custom @a queue_length. |
382 | * | 431 | * |
383 | * Note that having a larger queue size can cause resource exhaustion | 432 | * Note that having a larger queue size can cause resource exhaustion |
384 | * attack as the TCP stack has to now allocate resources for the SYN | 433 | * attack as the TCP stack has to now allocate resources for the SYN |
385 | * packet along with its DATA. | 434 | * packet along with its DATA. |
386 | * | 435 | * |
387 | * @param daemon which instance to configure TCP_FASTOPEN for | 436 | * @param daemon which instance to configure TCP_FASTOPEN for |
388 | * @param fom under which conditions should we use TCP_FASTOPEN? | 437 | * @param fom under which conditions should we use TCP_FASTOPEN? |
@@ -414,7 +463,7 @@ enum MHD_AddressFamily | |||
414 | 463 | ||
415 | /** | 464 | /** |
416 | * Use IPv6. | 465 | * Use IPv6. |
417 | */ | 466 | */ |
418 | MHD_AF_INET6, | 467 | MHD_AF_INET6, |
419 | 468 | ||
420 | /** | 469 | /** |
@@ -425,7 +474,7 @@ enum MHD_AddressFamily | |||
425 | 474 | ||
426 | 475 | ||
427 | /** | 476 | /** |
428 | * Bind to the given TCP port and address family. | 477 | * Bind to the given TCP port and address family. |
429 | * | 478 | * |
430 | * Ineffective in conjunction with #MHD_daemon_listen_socket(). | 479 | * Ineffective in conjunction with #MHD_daemon_listen_socket(). |
431 | * Ineffective in conjunction with #MHD_daemon_bind_sa(). | 480 | * Ineffective in conjunction with #MHD_daemon_bind_sa(). |
@@ -488,7 +537,7 @@ MHD_daemon_listen_allow_address_reuse (struct MHD_Daemon *daemon); | |||
488 | /** | 537 | /** |
489 | * Accept connections from the given socket. Socket | 538 | * Accept connections from the given socket. Socket |
490 | * must be a TCP or UNIX domain (stream) socket. | 539 | * must be a TCP or UNIX domain (stream) socket. |
491 | * | 540 | * |
492 | * Unless -1 is given, this disables other listen options, including | 541 | * Unless -1 is given, this disables other listen options, including |
493 | * #MHD_daemon_bind_sa(), #MHD_daemon_bind_port(), | 542 | * #MHD_daemon_bind_sa(), #MHD_daemon_bind_port(), |
494 | * #MHD_daemon_listen_queue() and | 543 | * #MHD_daemon_listen_queue() and |
@@ -512,19 +561,19 @@ enum MHD_EventLoopSyscall | |||
512 | /** | 561 | /** |
513 | * Automatic selection of best-available method. This is also the | 562 | * Automatic selection of best-available method. This is also the |
514 | * default. | 563 | * default. |
515 | */ | 564 | */ |
516 | MHD_ELS_AUTO = 0, | 565 | MHD_ELS_AUTO = 0, |
517 | 566 | ||
518 | /** | 567 | /** |
519 | * Use select(). | 568 | * Use select(). |
520 | */ | 569 | */ |
521 | MHD_ELS_SELECT = 1, | 570 | MHD_ELS_SELECT = 1, |
522 | 571 | ||
523 | /** | 572 | /** |
524 | * Use poll(). | 573 | * Use poll(). |
525 | */ | 574 | */ |
526 | MHD_ELS_POLL = 2, | 575 | MHD_ELS_POLL = 2, |
527 | 576 | ||
528 | /** | 577 | /** |
529 | * Use epoll(). | 578 | * Use epoll(). |
530 | */ | 579 | */ |
@@ -534,7 +583,7 @@ enum MHD_EventLoopSyscall | |||
534 | 583 | ||
535 | /** | 584 | /** |
536 | * Force use of a particular event loop system call. | 585 | * Force use of a particular event loop system call. |
537 | * | 586 | * |
538 | * @param daemon daemon to set event loop style for | 587 | * @param daemon daemon to set event loop style for |
539 | * @param els event loop syscall to use | 588 | * @param els event loop syscall to use |
540 | * @return #MHD_NO on failure, #MHD_YES on success | 589 | * @return #MHD_NO on failure, #MHD_YES on success |
@@ -579,7 +628,7 @@ enum MHD_ProtocolStrictLevel | |||
579 | 628 | ||
580 | /** | 629 | /** |
581 | * Set how strictly MHD will enforce the HTTP protocol. | 630 | * Set how strictly MHD will enforce the HTTP protocol. |
582 | * | 631 | * |
583 | * @param daemon daemon to configure strictness for | 632 | * @param daemon daemon to configure strictness for |
584 | * @param sl how strict should we be | 633 | * @param sl how strict should we be |
585 | */ | 634 | */ |
@@ -601,7 +650,7 @@ MHD_daemon_protocol_strict_level (struct MHD_Daemon *daemon, | |||
601 | * #MHD_TLS_BACKEND_UNSUPPORTED if the @a backend is unknown | 650 | * #MHD_TLS_BACKEND_UNSUPPORTED if the @a backend is unknown |
602 | * #MHD_TLS_DISABLED if this build of MHD does not support TLS | 651 | * #MHD_TLS_DISABLED if this build of MHD does not support TLS |
603 | * #MHD_TLS_CIPHERS_INVALID if the given @a ciphers are not supported | 652 | * #MHD_TLS_CIPHERS_INVALID if the given @a ciphers are not supported |
604 | * by this backend | 653 | * by this backend |
605 | */ | 654 | */ |
606 | _MHD_EXTERN enum MHD_StatusCode | 655 | _MHD_EXTERN enum MHD_StatusCode |
607 | MHD_daemon_set_tls_backend (struct MHD_Daemon *daemon, | 656 | MHD_daemon_set_tls_backend (struct MHD_Daemon *daemon, |
@@ -630,7 +679,7 @@ MHD_daemon_tls_key_and_cert_from_memory (struct MHD_Daemon *daemon, | |||
630 | 679 | ||
631 | /** | 680 | /** |
632 | * Configure DH parameters (dh.pem) to use for the TLS key | 681 | * Configure DH parameters (dh.pem) to use for the TLS key |
633 | * exchange. | 682 | * exchange. |
634 | * | 683 | * |
635 | * @param daemon daemon to configure tls for | 684 | * @param daemon daemon to configure tls for |
636 | * @param dh parameters to use | 685 | * @param dh parameters to use |
@@ -643,7 +692,7 @@ _MHD_EXTERN enum MHD_StatusCode | |||
643 | 692 | ||
644 | /** | 693 | /** |
645 | * Memory pointer for the certificate (ca.pem) to be used by the | 694 | * Memory pointer for the certificate (ca.pem) to be used by the |
646 | * HTTPS daemon for client authentification. | 695 | * HTTPS daemon for client authentification. |
647 | * | 696 | * |
648 | * @param daemon daemon to configure tls for | 697 | * @param daemon daemon to configure tls for |
649 | * @param mem_trust memory pointer to the certificate | 698 | * @param mem_trust memory pointer to the certificate |
@@ -652,7 +701,7 @@ _MHD_EXTERN enum MHD_StatusCode | |||
652 | _MHD_EXTERN enum MHD_StatusCode | 701 | _MHD_EXTERN enum MHD_StatusCode |
653 | MHD_daemon_tls_mem_trust (struct MHD_Daemon *daemon, | 702 | MHD_daemon_tls_mem_trust (struct MHD_Daemon *daemon, |
654 | const char *mem_trust); | 703 | const char *mem_trust); |
655 | 704 | ||
656 | 705 | ||
657 | /** | 706 | /** |
658 | * Configure daemon credentials type for GnuTLS. | 707 | * Configure daemon credentials type for GnuTLS. |
@@ -703,8 +752,8 @@ enum MHD_ThreadingModel | |||
703 | MHD_TM_THREAD_PER_CONNECTION = -1, | 752 | MHD_TM_THREAD_PER_CONNECTION = -1, |
704 | 753 | ||
705 | /** | 754 | /** |
706 | * Use an external event loop. This is the default. | 755 | * Use an external event loop. This is the default. |
707 | */ | 756 | */ |
708 | MHD_TM_EXTERNAL_EVENT_LOOP = 0, | 757 | MHD_TM_EXTERNAL_EVENT_LOOP = 0, |
709 | 758 | ||
710 | /** | 759 | /** |
@@ -721,7 +770,7 @@ enum MHD_ThreadingModel | |||
721 | * #MHD_daemon_run_from_select() cannot be used. | 770 | * #MHD_daemon_run_from_select() cannot be used. |
722 | */ | 771 | */ |
723 | MHD_TM_WORKER_THREADS = 1 | 772 | MHD_TM_WORKER_THREADS = 1 |
724 | 773 | ||
725 | }; | 774 | }; |
726 | 775 | ||
727 | 776 | ||
@@ -730,7 +779,7 @@ enum MHD_ThreadingModel | |||
730 | * | 779 | * |
731 | * @return an `enum MHD_ThreadingModel` for a thread pool of size @a n | 780 | * @return an `enum MHD_ThreadingModel` for a thread pool of size @a n |
732 | */ | 781 | */ |
733 | #define MHD_TM_THREAD_POOL(n) ((enum MHD_ThreadingModel)(n)) | 782 | #define MHD_TM_THREAD_POOL(n) ((enum MHD_ThreadingModel)(n)) |
734 | 783 | ||
735 | 784 | ||
736 | /** | 785 | /** |
@@ -776,7 +825,7 @@ MHD_daemon_accept_policy (struct MHD_Daemon *daemon, | |||
776 | 825 | ||
777 | 826 | ||
778 | typedef void * | 827 | typedef void * |
779 | (MHD_EarlyUriLogCallback)(void *cls, | 828 | (MHD_EarlyUriLogCallback)(void *cls, |
780 | const char *uri, | 829 | const char *uri, |
781 | struct MHD_Request *request); | 830 | struct MHD_Request *request); |
782 | 831 | ||
@@ -866,7 +915,7 @@ MHD_daemon_thread_stack_size (struct MHD_Daemon *daemon, | |||
866 | * @param daemon daemon to configure | 915 | * @param daemon daemon to configure |
867 | * @param global_connection_limit maximum number of (concurrent) | 916 | * @param global_connection_limit maximum number of (concurrent) |
868 | connections | 917 | connections |
869 | * @param ip_connection_limit limit on the number of (concurrent) | 918 | * @param ip_connection_limit limit on the number of (concurrent) |
870 | * connections made to the server from the same IP address. | 919 | * connections made to the server from the same IP address. |
871 | * Can be used to prevent one IP from taking over all of | 920 | * Can be used to prevent one IP from taking over all of |
872 | * the allowed connections. If the same IP tries to | 921 | * the allowed connections. If the same IP tries to |
@@ -881,7 +930,7 @@ MHD_daemon_connection_limits (struct MHD_Daemon *daemon, | |||
881 | 930 | ||
882 | /** | 931 | /** |
883 | * After how many seconds of inactivity should a | 932 | * After how many seconds of inactivity should a |
884 | * connection automatically be timed out? | 933 | * connection automatically be timed out? |
885 | * Use zero for no timeout, which is also the (unsafe!) default. | 934 | * Use zero for no timeout, which is also the (unsafe!) default. |
886 | * | 935 | * |
887 | * @param daemon daemon to configure | 936 | * @param daemon daemon to configure |
@@ -897,7 +946,7 @@ MHD_daemon_connection_default_timeout (struct MHD_Daemon *daemon, | |||
897 | * The return value must be "strlen(s)" and @a s should be | 946 | * The return value must be "strlen(s)" and @a s should be |
898 | * updated. Note that the unescape function must not lengthen @a s | 947 | * updated. Note that the unescape function must not lengthen @a s |
899 | * (the result must be shorter than the input and still be | 948 | * (the result must be shorter than the input and still be |
900 | * 0-terminated). | 949 | * 0-terminated). |
901 | * | 950 | * |
902 | * @param cls closure | 951 | * @param cls closure |
903 | * @param req the request for which unescaping is performed | 952 | * @param req the request for which unescaping is performed |
@@ -915,7 +964,7 @@ MHD_UnescapeCallback (void *cls, | |||
915 | * sequences in URIs and URI arguments. Note that this function | 964 | * sequences in URIs and URI arguments. Note that this function |
916 | * will NOT be used by the `struct MHD_PostProcessor`. If this | 965 | * will NOT be used by the `struct MHD_PostProcessor`. If this |
917 | * option is not specified, the default method will be used which | 966 | * option is not specified, the default method will be used which |
918 | * decodes escape sequences of the form "%HH". | 967 | * decodes escape sequences of the form "%HH". |
919 | * | 968 | * |
920 | * @param daemon daemon to configure | 969 | * @param daemon daemon to configure |
921 | * @param unescape_cb function to use, NULL for default | 970 | * @param unescape_cb function to use, NULL for default |
@@ -944,7 +993,7 @@ MHD_daemon_digest_auth_random (struct MHD_Daemon *daemon, | |||
944 | 993 | ||
945 | /** | 994 | /** |
946 | * Size of the internal array holding the map of the nonce and | 995 | * Size of the internal array holding the map of the nonce and |
947 | * the nonce counter. | 996 | * the nonce counter. |
948 | * | 997 | * |
949 | * @param daemon daemon to configure | 998 | * @param daemon daemon to configure |
950 | * @param nc_length desired array length | 999 | * @param nc_length desired array length |
@@ -962,7 +1011,7 @@ MHD_daemon_digest_auth_nc_size (struct MHD_Daemon *daemon, | |||
962 | * Specified as the number of seconds. Use zero for no timeout. If | 1011 | * Specified as the number of seconds. Use zero for no timeout. If |
963 | * timeout was set to zero (or unset) before, setting of a new value | 1012 | * timeout was set to zero (or unset) before, setting of a new value |
964 | * by MHD_connection_set_option() will reset timeout timer. | 1013 | * by MHD_connection_set_option() will reset timeout timer. |
965 | * | 1014 | * |
966 | * @param connection connection to configure timeout for | 1015 | * @param connection connection to configure timeout for |
967 | * @param timeout_s new timeout in seconds | 1016 | * @param timeout_s new timeout in seconds |
968 | */ | 1017 | */ |
@@ -1082,7 +1131,7 @@ enum MHD_HTTP_StatusCode { | |||
1082 | MHD_HTTP_NOT_ACCEPTABLE = 406, | 1131 | MHD_HTTP_NOT_ACCEPTABLE = 406, |
1083 | /** @deprecated */ | 1132 | /** @deprecated */ |
1084 | #define MHD_HTTP_METHOD_NOT_ACCEPTABLE \ | 1133 | #define MHD_HTTP_METHOD_NOT_ACCEPTABLE \ |
1085 | _MHD_DEPR_IN_MACRO("Value MHD_HTTP_METHOD_NOT_ACCEPTABLE is deprecated, use MHD_HTTP_NOT_ACCEPTABLE") MHD_HTTP_NOT_ACCEPTABLE | 1134 | _MHD_DEPR_IN_MACRO("Value MHD_HTTP_METHOD_NOT_ACCEPTABLE is deprecated, use MHD_HTTP_NOT_ACCEPTABLE") MHD_HTTP_NOT_ACCEPTABLE |
1086 | MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, | 1135 | MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, |
1087 | MHD_HTTP_REQUEST_TIMEOUT = 408, | 1136 | MHD_HTTP_REQUEST_TIMEOUT = 408, |
1088 | MHD_HTTP_CONFLICT = 409, | 1137 | MHD_HTTP_CONFLICT = 409, |
@@ -1200,17 +1249,17 @@ MHD_request_resume (struct MHD_Request *request); | |||
1200 | * must no longer be modified (i.e. by setting headers). | 1249 | * must no longer be modified (i.e. by setting headers). |
1201 | * | 1250 | * |
1202 | * @param response response to convert, not NULL | 1251 | * @param response response to convert, not NULL |
1203 | * @param consume should the response object be consumed? | 1252 | * @param destroy_after_use should the response object be consumed? |
1204 | * @return corresponding action, never returns NULL | 1253 | * @return corresponding action, never returns NULL |
1205 | * | 1254 | * |
1206 | * Implementation note: internally, this is largely just | 1255 | * Implementation note: internally, this is largely just |
1207 | * a cast (and possibly an RC increment operation), | 1256 | * a cast (and possibly an RC increment operation), |
1208 | * as a response *is* an action. As no memory is | 1257 | * as a response *is* an action. As no memory is |
1209 | * allocated, this operation cannot fail. | 1258 | * allocated, this operation cannot fail. |
1210 | */ | 1259 | */ |
1211 | struct MHD_Action * | 1260 | struct MHD_Action * |
1212 | MHD_action_from_response (struct MHD_Response *response, | 1261 | MHD_action_from_response (struct MHD_Response *response, |
1213 | enum MHD_bool consume); | 1262 | enum MHD_bool destroy_after_use); |
1214 | 1263 | ||
1215 | 1264 | ||
1216 | /** | 1265 | /** |
@@ -1224,8 +1273,7 @@ _MHD_EXTERN void | |||
1224 | MHD_response_option_v10_only (struct MHD_Response *response); | 1273 | MHD_response_option_v10_only (struct MHD_Response *response); |
1225 | 1274 | ||
1226 | 1275 | ||
1227 | /** | 1276 | /** * Signature of the callback used by MHD to notify the |
1228 | * Signature of the callback used by MHD to notify the | ||
1229 | * application about completed requests. | 1277 | * application about completed requests. |
1230 | * | 1278 | * |
1231 | * @param cls client-defined closure | 1279 | * @param cls client-defined closure |
@@ -1505,7 +1553,7 @@ MHD_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, | |||
1505 | * @ingroup response | 1553 | * @ingroup response |
1506 | */ | 1554 | */ |
1507 | _MHD_EXTERN void | 1555 | _MHD_EXTERN void |
1508 | MHD_response_decref (struct MHD_Response *response); | 1556 | MHD_response_queue_for_destroy (struct MHD_Response *response); |
1509 | 1557 | ||
1510 | 1558 | ||
1511 | /** | 1559 | /** |
@@ -1525,7 +1573,7 @@ MHD_response_add_header (struct MHD_Response *response, | |||
1525 | 1573 | ||
1526 | 1574 | ||
1527 | /** | 1575 | /** |
1528 | * Add a footer line to the response. | 1576 | * Add a tailer line to the response. |
1529 | * | 1577 | * |
1530 | * @param response response to add a footer to | 1578 | * @param response response to add a footer to |
1531 | * @param footer the footer to add | 1579 | * @param footer the footer to add |
@@ -1535,9 +1583,9 @@ MHD_response_add_header (struct MHD_Response *response, | |||
1535 | * @ingroup response | 1583 | * @ingroup response |
1536 | */ | 1584 | */ |
1537 | _MHD_EXTERN enum MHD_Bool | 1585 | _MHD_EXTERN enum MHD_Bool |
1538 | MHD_response_add_footer (struct MHD_Response *response, | 1586 | MHD_response_add_trailer (struct MHD_Response *response, |
1539 | const char *footer, | 1587 | const char *footer, |
1540 | const char *content); | 1588 | const char *content); |
1541 | 1589 | ||
1542 | 1590 | ||
1543 | /** | 1591 | /** |
@@ -1608,7 +1656,7 @@ MHD_action_continue (void); | |||
1608 | * value to the number of bytes NOT processed; | 1656 | * value to the number of bytes NOT processed; |
1609 | * @return action specifying how to proceed, often | 1657 | * @return action specifying how to proceed, often |
1610 | * #MHD_action_continue() if all is well, | 1658 | * #MHD_action_continue() if all is well, |
1611 | * #MHD_action_suspend() to stop reading the upload until | 1659 | * #MHD_action_suspend() to stop reading the upload until |
1612 | * the request is resumed, | 1660 | * the request is resumed, |
1613 | * NULL to close the socket, or a response | 1661 | * NULL to close the socket, or a response |
1614 | * to discard the rest of the upload and return the data given | 1662 | * to discard the rest of the upload and return the data given |
@@ -1650,7 +1698,7 @@ MHD_action_process_upload (MHD_UploadCallback uc, | |||
1650 | * @param size number of bytes in @a data available | 1698 | * @param size number of bytes in @a data available |
1651 | * @return action specifying how to proceed, often | 1699 | * @return action specifying how to proceed, often |
1652 | * #MHD_action_continue() if all is well, | 1700 | * #MHD_action_continue() if all is well, |
1653 | * #MHD_action_suspend() to stop reading the upload until | 1701 | * #MHD_action_suspend() to stop reading the upload until |
1654 | * the request is resumed, | 1702 | * the request is resumed, |
1655 | * NULL to close the socket, or a response | 1703 | * NULL to close the socket, or a response |
1656 | * to discard the rest of the upload and return the data given | 1704 | * to discard the rest of the upload and return the data given |
@@ -1892,7 +1940,13 @@ union MHD_RequestInformation | |||
1892 | * HTTP version requested by the client. | 1940 | * HTTP version requested by the client. |
1893 | */ | 1941 | */ |
1894 | const char *http_version; | 1942 | const char *http_version; |
1895 | 1943 | ||
1944 | /** | ||
1945 | * HTTP method of the request, as a string. Particularly useful if | ||
1946 | * #MHD_HTTP_METHOD_UNKNOWN was given. | ||
1947 | */ | ||
1948 | const char *http_method; | ||
1949 | |||
1896 | /** | 1950 | /** |
1897 | * Size of the client's HTTP header. | 1951 | * Size of the client's HTTP header. |
1898 | */ | 1952 | */ |
@@ -1911,19 +1965,25 @@ enum MHD_RequestInformationType | |||
1911 | * Return which connection the request is associated with. | 1965 | * Return which connection the request is associated with. |
1912 | */ | 1966 | */ |
1913 | MHD_REQUEST_INFORMATION_CONNECTION, | 1967 | MHD_REQUEST_INFORMATION_CONNECTION, |
1914 | 1968 | ||
1915 | /** | 1969 | /** |
1916 | * Check whether the connection is suspended. | 1970 | * Check whether the connection is suspended. |
1917 | * @ingroup request | 1971 | * @ingroup request |
1918 | */ | 1972 | */ |
1919 | MHD_REQUEST_INFORMATION_SUSPENDED, | 1973 | MHD_REQUEST_INFORMATION_SUSPENDED, |
1920 | 1974 | ||
1921 | /** | 1975 | /** |
1922 | * Return the HTTP version string given by the client. | 1976 | * Return the HTTP version string given by the client. |
1923 | * @ingroup request | 1977 | * @ingroup request |
1924 | */ | 1978 | */ |
1925 | MHD_REQUEST_INFORMATION_HTTP_VERSION, | 1979 | MHD_REQUEST_INFORMATION_HTTP_VERSION, |
1926 | 1980 | ||
1981 | /** | ||
1982 | * Return the HTTP method used by the request. | ||
1983 | * @ingroup request | ||
1984 | */ | ||
1985 | MHD_REQUEST_INFORMATION_HTTP_METHOD, | ||
1986 | |||
1927 | /** | 1987 | /** |
1928 | * Return length of the client's HTTP request header. | 1988 | * Return length of the client's HTTP request header. |
1929 | * @ingroup request | 1989 | * @ingroup request |