diff options
Diffstat (limited to 'src/include/microhttpd.h')
-rw-r--r-- | src/include/microhttpd.h | 94 |
1 files changed, 84 insertions, 10 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index ae918b4a..01f31ca2 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -26,21 +26,18 @@ | |||
26 | * | 26 | * |
27 | * All symbols defined in this header start with MHD. MHD is a | 27 | * All symbols defined in this header start with MHD. MHD is a |
28 | * micro-httpd library. As such, it does not have any API for logging | 28 | * micro-httpd library. As such, it does not have any API for logging |
29 | * errors.<p> | 29 | * errors. Also, it may not support all of the HTTP features directly, |
30 | * where applicable, portions of HTTP may have to be handled by | ||
31 | * clients of the library (the library is supposed to handle | ||
32 | * everything that it must handle, such as basic connection | ||
33 | * management; however, detailed interpretations of headers | ||
34 | * and methods are left to clients).<p> | ||
30 | * | 35 | * |
31 | * All functions are guaranteed to be completely reentrant and | 36 | * All functions are guaranteed to be completely reentrant and |
32 | * thread-safe.<p> | 37 | * thread-safe.<p> |
33 | * | 38 | * |
34 | * TODO: | 39 | * TODO: |
35 | * - proper API for file uploads via HTTP | 40 | * - Add option codes for buffer sizes and SSL support |
36 | * - We probably need a significantly more extensive API for | ||
37 | * proper SSL support (set local certificate, etc.) | ||
38 | * | ||
39 | * | ||
40 | * | ||
41 | * Students are encouraged to add additional HTTP status codes to this | ||
42 | * file, but should not change anything else. If you think something | ||
43 | * needs to be changed, talk to your instructor first. | ||
44 | */ | 41 | */ |
45 | 42 | ||
46 | #ifndef MHD_MICROHTTPD_H | 43 | #ifndef MHD_MICROHTTPD_H |
@@ -61,12 +58,21 @@ extern "C" { | |||
61 | #endif | 58 | #endif |
62 | #endif | 59 | #endif |
63 | 60 | ||
61 | /** | ||
62 | * Current version of the library. | ||
63 | */ | ||
64 | #define MHD_VERSION 0x00000000 | 64 | #define MHD_VERSION 0x00000000 |
65 | 65 | ||
66 | /** | ||
67 | * MHD-internal return codes. | ||
68 | */ | ||
66 | #define MHD_YES 1 | 69 | #define MHD_YES 1 |
67 | 70 | ||
68 | #define MHD_NO 0 | 71 | #define MHD_NO 0 |
69 | 72 | ||
73 | /** | ||
74 | * HTTP response codes. | ||
75 | */ | ||
70 | #define MHD_HTTP_CONTINUE 100 | 76 | #define MHD_HTTP_CONTINUE 100 |
71 | #define MHD_HTTP_SWITCHING_PROTOCOLS 101 | 77 | #define MHD_HTTP_SWITCHING_PROTOCOLS 101 |
72 | #define MHD_HTTP_PROCESSING 102 | 78 | #define MHD_HTTP_PROCESSING 102 |
@@ -125,6 +131,62 @@ extern "C" { | |||
125 | #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 | 131 | #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 |
126 | #define MHD_HTTP_NOT_EXTENDED 510 | 132 | #define MHD_HTTP_NOT_EXTENDED 510 |
127 | 133 | ||
134 | /* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ | ||
135 | #define MHD_HTTP_HEADER_ACCEPT "Accept" | ||
136 | #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset" | ||
137 | #define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding" | ||
138 | #define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language" | ||
139 | #define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges" | ||
140 | #define MHD_HTTP_HEADER_AGE "Age" | ||
141 | #define MHD_HTTP_HEADER_ALLOW "Allow" | ||
142 | #define MHD_HTTP_HEADER_AUTHORIZATION "Authorization" | ||
143 | #define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control" | ||
144 | #define MHD_HTTP_HEADER_CONNECTION "Connection" | ||
145 | #define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding" | ||
146 | #define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language" | ||
147 | #define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length" | ||
148 | #define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location" | ||
149 | #define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5" | ||
150 | #define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range" | ||
151 | #define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type" | ||
152 | #define MHD_HTTP_HEADER_DATE "Date" | ||
153 | #define MHD_HTTP_HEADER_ETAG "ETag" | ||
154 | #define MHD_HTTP_HEADER_EXPECT "Expect" | ||
155 | #define MHD_HTTP_HEADER_EXPIRES "Expires" | ||
156 | #define MHD_HTTP_HEADER_FROM "From" | ||
157 | #define MHD_HTTP_HEADER_HOST "Host" | ||
158 | #define MHD_HTTP_HEADER_IF_MATCH "If-Match" | ||
159 | #define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since" | ||
160 | #define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match" | ||
161 | #define MHD_HTTP_HEADER_IF_RANGE "If-Range" | ||
162 | #define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since" | ||
163 | #define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified" | ||
164 | #define MHD_HTTP_HEADER_LOCATION "Location" | ||
165 | #define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards" | ||
166 | #define MHD_HTTP_HEADER_PRAGMA "Pragma" | ||
167 | #define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate" | ||
168 | #define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization" | ||
169 | #define MHD_HTTP_HEADER_RANGE "Range" | ||
170 | #define MHD_HTTP_HEADER_REFERER "Referer" | ||
171 | #define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After" | ||
172 | #define MHD_HTTP_HEADER_SERVER "Server" | ||
173 | #define MHD_HTTP_HEADER_TE "TE" | ||
174 | #define MHD_HTTP_HEADER_TRAILER "Trailer" | ||
175 | #define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding" | ||
176 | #define MHD_HTTP_HEADER_UPGRADE "Upgrade" | ||
177 | #define MHD_HTTP_HEADER_USER_AGENT "User-Agent" | ||
178 | #define MHD_HTTP_HEADER_VARY "Vary" | ||
179 | #define MHD_HTTP_HEADER_VIA "Via" | ||
180 | #define MHD_HTTP_HEADER_WARNING "Warning" | ||
181 | #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate" | ||
182 | |||
183 | /** | ||
184 | * HTTP versions (used to match against the first line of the | ||
185 | * HTTP header as well as in the response code). | ||
186 | */ | ||
187 | #define MHD_HTTP_VERSION_1_0 "HTTP/1.0" | ||
188 | #define MHD_HTTP_VERSION_1_1 "HTTP/1.1" | ||
189 | |||
128 | 190 | ||
129 | 191 | ||
130 | /** | 192 | /** |
@@ -224,10 +286,22 @@ enum MHD_ValueKind { | |||
224 | 286 | ||
225 | }; | 287 | }; |
226 | 288 | ||
289 | /** | ||
290 | * Handle for the daemon (listening on a socket for HTTP traffic). | ||
291 | */ | ||
227 | struct MHD_Daemon; | 292 | struct MHD_Daemon; |
228 | 293 | ||
294 | /** | ||
295 | * Handle for a connection / HTTP request. With HTTP/1.1, multiple | ||
296 | * requests can be run over the same connection. However, MHD will | ||
297 | * only show one request per TCP connection to the client at any given | ||
298 | * time. | ||
299 | */ | ||
229 | struct MHD_Connection; | 300 | struct MHD_Connection; |
230 | 301 | ||
302 | /** | ||
303 | * Handle for a response. | ||
304 | */ | ||
231 | struct MHD_Response; | 305 | struct MHD_Response; |
232 | 306 | ||
233 | /** | 307 | /** |