#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>


Go to the source code of this file.
All symbols defined in this header start with MHD. MHD is a small HTTP daemon library. As such, it does not have any API for logging errors (you can only enable or disable logging to stderr). Also, it may not support all of the HTTP features directly, where applicable, portions of HTTP may have to be handled by clients of the library.
The library is supposed to handle everything that it must handle (because the API would not allow clients to do this), such as basic connection management; however, detailed interpretations of headers -- such as range requests -- and HTTP methods are left to clients. The library does understand HEAD and will only send the headers of the response and not the body, even if the client supplied a body. The library also understands headers that control connection management (specifically, "Connection: close" and "Expect: 100 continue" are understood and handled automatically).
MHD understands POST data and is able to decode certain formats (at the moment only "application/x-www-form-urlencoded") if the entire data fits into the allowed amount of memory for the connection. Unsupported encodings and large POST submissions are provided as a stream to the main application (and thus can be processed, just not conveniently by MHD).
The header file defines various constants used by the HTTP protocol. This does not mean that MHD actually interprets all of these values. The provided constants are exported as a convenience for users of the library. MHD does not verify that transmitted HTTP headers are part of the standard specification; users of the library are free to define their own extensions of the HTTP standard and use those with MHD.
All functions are guaranteed to be completely reentrant and thread-safe.
TODO:
Definition in file microhttpd.h.
| #define MHD_HTTP_ACCEPTED 202 |
Definition at line 105 of file microhttpd.h.
| #define MHD_HTTP_BAD_GATEWAY 502 |
Definition at line 148 of file microhttpd.h.
| #define MHD_HTTP_BAD_REQUEST 400 |
Definition at line 121 of file microhttpd.h.
Referenced by MHD_connection_handle_idle(), parse_connection_headers(), and process_broken_line().
| #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 |
Definition at line 154 of file microhttpd.h.
| #define MHD_HTTP_CONFLICT 409 |
Definition at line 130 of file microhttpd.h.
| #define MHD_HTTP_CONTINUE 100 |
HTTP response codes.
Definition at line 99 of file microhttpd.h.
| #define MHD_HTTP_CREATED 201 |
Definition at line 104 of file microhttpd.h.
| #define MHD_HTTP_EXPECTATION_FAILED 417 |
Definition at line 138 of file microhttpd.h.
| #define MHD_HTTP_FAILED_DEPENDENCY 424 |
Definition at line 141 of file microhttpd.h.
| #define MHD_HTTP_FORBIDDEN 403 |
Definition at line 124 of file microhttpd.h.
| #define MHD_HTTP_FOUND 302 |
Definition at line 114 of file microhttpd.h.
| #define MHD_HTTP_GATEWAY_TIMEOUT 504 |
Definition at line 150 of file microhttpd.h.
| #define MHD_HTTP_GONE 410 |
Definition at line 131 of file microhttpd.h.
| #define MHD_HTTP_HEADER_ACCEPT "Accept" |
Definition at line 158 of file microhttpd.h.
| #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset" |
Definition at line 159 of file microhttpd.h.
| #define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding" |
Definition at line 160 of file microhttpd.h.
| #define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language" |
Definition at line 161 of file microhttpd.h.
| #define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges" |
Definition at line 162 of file microhttpd.h.
| #define MHD_HTTP_HEADER_AGE "Age" |
Definition at line 163 of file microhttpd.h.
| #define MHD_HTTP_HEADER_ALLOW "Allow" |
Definition at line 164 of file microhttpd.h.
| #define MHD_HTTP_HEADER_AUTHORIZATION "Authorization" |
Definition at line 165 of file microhttpd.h.
| #define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control" |
Definition at line 166 of file microhttpd.h.
| #define MHD_HTTP_HEADER_CONNECTION "Connection" |
Definition at line 167 of file microhttpd.h.
Referenced by add_extra_headers(), and MHD_connection_handle_idle().
| #define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding" |
Definition at line 168 of file microhttpd.h.
| #define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language" |
Definition at line 169 of file microhttpd.h.
| #define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length" |
Definition at line 170 of file microhttpd.h.
Referenced by add_extra_headers(), and parse_connection_headers().
| #define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location" |
Definition at line 171 of file microhttpd.h.
| #define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5" |
Definition at line 172 of file microhttpd.h.
| #define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range" |
Definition at line 173 of file microhttpd.h.
| #define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type" |
| #define MHD_HTTP_HEADER_DATE "Date" |
| #define MHD_HTTP_HEADER_ETAG "ETag" |
Definition at line 176 of file microhttpd.h.
| #define MHD_HTTP_HEADER_EXPECT "Expect" |
| #define MHD_HTTP_HEADER_EXPIRES "Expires" |
Definition at line 178 of file microhttpd.h.
| #define MHD_HTTP_HEADER_FROM "From" |
Definition at line 179 of file microhttpd.h.
| #define MHD_HTTP_HEADER_HOST "Host" |
| #define MHD_HTTP_HEADER_IF_MATCH "If-Match" |
Definition at line 181 of file microhttpd.h.
| #define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since" |
Definition at line 182 of file microhttpd.h.
| #define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match" |
Definition at line 183 of file microhttpd.h.
| #define MHD_HTTP_HEADER_IF_RANGE "If-Range" |
Definition at line 184 of file microhttpd.h.
| #define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since" |
Definition at line 185 of file microhttpd.h.
| #define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified" |
Definition at line 186 of file microhttpd.h.
| #define MHD_HTTP_HEADER_LOCATION "Location" |
Definition at line 187 of file microhttpd.h.
| #define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards" |
Definition at line 188 of file microhttpd.h.
| #define MHD_HTTP_HEADER_PRAGMA "Pragma" |
Definition at line 189 of file microhttpd.h.
| #define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate" |
Definition at line 190 of file microhttpd.h.
| #define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization" |
Definition at line 191 of file microhttpd.h.
| #define MHD_HTTP_HEADER_RANGE "Range" |
Definition at line 192 of file microhttpd.h.
| #define MHD_HTTP_HEADER_REFERER "Referer" |
Definition at line 193 of file microhttpd.h.
| #define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After" |
Definition at line 194 of file microhttpd.h.
| #define MHD_HTTP_HEADER_SERVER "Server" |
Definition at line 195 of file microhttpd.h.
| #define MHD_HTTP_HEADER_TE "TE" |
Definition at line 196 of file microhttpd.h.
| #define MHD_HTTP_HEADER_TRAILER "Trailer" |
Definition at line 197 of file microhttpd.h.
| #define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding" |
Definition at line 198 of file microhttpd.h.
Referenced by add_extra_headers(), and parse_connection_headers().
| #define MHD_HTTP_HEADER_UPGRADE "Upgrade" |
Definition at line 199 of file microhttpd.h.
| #define MHD_HTTP_HEADER_USER_AGENT "User-Agent" |
Definition at line 200 of file microhttpd.h.
| #define MHD_HTTP_HEADER_VARY "Vary" |
Definition at line 201 of file microhttpd.h.
| #define MHD_HTTP_HEADER_VIA "Via" |
Definition at line 202 of file microhttpd.h.
| #define MHD_HTTP_HEADER_WARNING "Warning" |
Definition at line 203 of file microhttpd.h.
| #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate" |
Definition at line 204 of file microhttpd.h.
| #define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505 |
Definition at line 151 of file microhttpd.h.
| #define MHD_HTTP_INSUFFICIENT_STORAGE 507 |
Definition at line 153 of file microhttpd.h.
| #define MHD_HTTP_INTERNAL_SERVER_ERROR 500 |
| #define MHD_HTTP_LENGTH_REQUIRED 411 |
Definition at line 132 of file microhttpd.h.
| #define MHD_HTTP_LOCKED 423 |
Definition at line 140 of file microhttpd.h.
| #define MHD_HTTP_METHOD_CONNECT "CONNECT" |
HTTP methods
Definition at line 216 of file microhttpd.h.
| #define MHD_HTTP_METHOD_DELETE "DELETE" |
Definition at line 217 of file microhttpd.h.
| #define MHD_HTTP_METHOD_GET "GET" |
Definition at line 218 of file microhttpd.h.
| #define MHD_HTTP_METHOD_HEAD "HEAD" |
| #define MHD_HTTP_METHOD_NOT_ACCEPTABLE 406 |
Definition at line 127 of file microhttpd.h.
| #define MHD_HTTP_METHOD_NOT_ALLOWED 405 |
Definition at line 126 of file microhttpd.h.
| #define MHD_HTTP_METHOD_OPTIONS "OPTIONS" |
Definition at line 220 of file microhttpd.h.
| #define MHD_HTTP_METHOD_POST "POST" |
Definition at line 221 of file microhttpd.h.
| #define MHD_HTTP_METHOD_PUT "PUT" |
Definition at line 222 of file microhttpd.h.
| #define MHD_HTTP_METHOD_TRACE "TRACE" |
Definition at line 223 of file microhttpd.h.
| #define MHD_HTTP_MOVED_PERMANENTLY 301 |
Definition at line 113 of file microhttpd.h.
| #define MHD_HTTP_MULTI_STATUS 207 |
Definition at line 110 of file microhttpd.h.
| #define MHD_HTTP_MULTIPLE_CHOICES 300 |
Definition at line 112 of file microhttpd.h.
| #define MHD_HTTP_NO_CONTENT 204 |
Definition at line 107 of file microhttpd.h.
| #define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION 203 |
Definition at line 106 of file microhttpd.h.
| #define MHD_HTTP_NOT_EXTENDED 510 |
Definition at line 155 of file microhttpd.h.
| #define MHD_HTTP_NOT_FOUND 404 |
Definition at line 125 of file microhttpd.h.
| #define MHD_HTTP_NOT_IMPLEMENTED 501 |
Definition at line 147 of file microhttpd.h.
| #define MHD_HTTP_NOT_MODIFIED 304 |
Definition at line 116 of file microhttpd.h.
| #define MHD_HTTP_OK 200 |
Definition at line 103 of file microhttpd.h.
| #define MHD_HTTP_PARTIAL_CONTENT 206 |
Definition at line 109 of file microhttpd.h.
| #define MHD_HTTP_PAYMENT_REQUIRED 402 |
Definition at line 123 of file microhttpd.h.
| #define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded" |
HTTP POST encodings, see also http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4
Definition at line 229 of file microhttpd.h.
Referenced by MHD_create_post_processor(), and MHD_post_process().
| #define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data" |
Definition at line 230 of file microhttpd.h.
Referenced by MHD_create_post_processor(), and MHD_post_process().
| #define MHD_HTTP_PRECONDITION_FAILED 412 |
Definition at line 133 of file microhttpd.h.
| #define MHD_HTTP_PROCESSING 102 |
Definition at line 101 of file microhttpd.h.
| #define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407 |
Definition at line 128 of file microhttpd.h.
| #define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE 413 |
Definition at line 134 of file microhttpd.h.
Referenced by connection_add_header(), get_next_header_line(), MHD_connection_get_fdset(), parse_cookie_header(), and process_broken_line().
| #define MHD_HTTP_REQUEST_TIMEOUT 408 |
Definition at line 129 of file microhttpd.h.
| #define MHD_HTTP_REQUEST_URI_TOO_LONG 414 |
Definition at line 135 of file microhttpd.h.
Referenced by get_next_header_line(), and MHD_connection_get_fdset().
| #define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416 |
Definition at line 137 of file microhttpd.h.
| #define MHD_HTTP_RESET_CONTENT 205 |
Definition at line 108 of file microhttpd.h.
| #define MHD_HTTP_RETRY_WITH 449 |
Definition at line 144 of file microhttpd.h.
| #define MHD_HTTP_SEE_OTHER 303 |
Definition at line 115 of file microhttpd.h.
| #define MHD_HTTP_SERVICE_UNAVAILABLE 503 |
Definition at line 149 of file microhttpd.h.
| #define MHD_HTTP_SWITCH_PROXY 306 |
Definition at line 118 of file microhttpd.h.
| #define MHD_HTTP_SWITCHING_PROTOCOLS 101 |
Definition at line 100 of file microhttpd.h.
| #define MHD_HTTP_TEMPORARY_REDIRECT 307 |
Definition at line 119 of file microhttpd.h.
| #define MHD_HTTP_UNAUTHORIZED 401 |
Definition at line 122 of file microhttpd.h.
| #define MHD_HTTP_UNORDERED_COLLECTION 425 |
Definition at line 142 of file microhttpd.h.
| #define MHD_HTTP_UNPROCESSABLE_ENTITY 422 |
Definition at line 139 of file microhttpd.h.
| #define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415 |
Definition at line 136 of file microhttpd.h.
| #define MHD_HTTP_UPGRADE_REQUIRED 426 |
Definition at line 143 of file microhttpd.h.
| #define MHD_HTTP_USE_PROXY 305 |
Definition at line 117 of file microhttpd.h.
| #define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506 |
Definition at line 152 of file microhttpd.h.
| #define MHD_HTTP_VERSION_1_0 "HTTP/1.0" |
HTTP versions (used to match against the first line of the HTTP header as well as in the response code).
Definition at line 210 of file microhttpd.h.
| #define MHD_HTTP_VERSION_1_1 "HTTP/1.1" |
Definition at line 211 of file microhttpd.h.
Referenced by add_extra_headers(), build_header_response(), MHD_connection_handle_idle(), MHD_queue_response(), need_100_continue(), and parse_connection_headers().
| #define MHD_NO 0 |
Definition at line 94 of file microhttpd.h.
Referenced by add_extra_headers(), build_header_response(), call_connection_handler(), check_write_done(), connection_add_header(), do_read(), do_write(), find_boundary(), MHD_accept_connection(), MHD_add_response_header(), MHD_connection_get_fdset(), MHD_connection_handle_idle(), MHD_connection_handle_read(), MHD_connection_handle_write(), MHD_del_response_header(), MHD_get_fdset(), MHD_get_timeout(), MHD_pool_create(), MHD_pool_destroy(), MHD_post_process(), MHD_queue_response(), MHD_run(), MHD_select(), MHD_select_thread(), parse_arguments(), parse_connection_headers(), parse_cookie_header(), parse_initial_message_line(), post_process_multipart(), post_process_urlencoded(), process_broken_line(),