GNU libmicrohttpd  0.9.29
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
microhttpd.h
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  (C) 2006-2014 Christian Grothoff (and other contributing authors)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
86 #ifndef MHD_MICROHTTPD_H
87 #define MHD_MICROHTTPD_H
88 
89 #ifdef __cplusplus
90 extern "C"
91 {
92 #if 0 /* keep Emacsens' auto-indent happy */
93 }
94 #endif
95 #endif
96 
97 /* While we generally would like users to use a configure-driven
98  build process which detects which headers are present and
99  hence works on any platform, we use "standard" includes here
100  to build out-of-the-box for beginning users on common systems.
101 
102  Once you have a proper build system and go for more exotic
103  platforms, you should define MHD_PLATFORM_H in some header that
104  you always include *before* "microhttpd.h". Then the following
105  "standard" includes won't be used (which might be a good
106  idea, especially on platforms where they do not exist). */
107 #ifndef MHD_PLATFORM_H
108 #include <stdarg.h>
109 #include <stdint.h>
110 #include <sys/types.h>
111 #if defined(_WIN32) && !defined(__CYGWIN__)
112 #include <ws2tcpip.h>
113 #if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED)
114 #define _SSIZE_T_DEFINED
115 typedef intptr_t ssize_t;
116 #endif // !_SSIZE_T_DEFINED */
117 #else
118 #include <unistd.h>
119 #include <sys/time.h>
120 #include <sys/socket.h>
121 #endif
122 #endif
123 
124 #if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET)
125 /* Do not define __USE_W32_SOCKETS under Cygwin! */
126 #error Cygwin with winsock fd_set is not supported
127 #endif
128 
133 #define MHD_VERSION 0x00093900
134 
138 #define MHD_YES 1
139 
143 #define MHD_NO 0
144 
148 #define MHD_INVALID_NONCE -1
149 
154 #ifdef UINT64_MAX
155 #define MHD_SIZE_UNKNOWN UINT64_MAX
156 #else
157 #define MHD_SIZE_UNKNOWN ((uint64_t) -1LL)
158 #endif
159 
160 #ifdef SIZE_MAX
161 #define MHD_CONTENT_READER_END_OF_STREAM SIZE_MAX
162 #define MHD_CONTENT_READER_END_WITH_ERROR (SIZE_MAX - 1)
163 #else
164 #define MHD_CONTENT_READER_END_OF_STREAM ((size_t) -1LL)
165 #define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1)
166 #endif
167 
168 #ifndef _MHD_EXTERN
169 #if defined(_WIN32) && defined(MHD_W32LIB)
170 #define _MHD_EXTERN extern
171 #elif defined (_WIN32) && defined(MHD_W32DLL)
172 /* Define MHD_W32DLL when using MHD as W32 .DLL to speed up linker a little */
173 #define _MHD_EXTERN __declspec(dllimport)
174 #else
175 #define _MHD_EXTERN extern
176 #endif
177 #endif
178 
179 #ifndef MHD_SOCKET_DEFINED
180 
183 #if !defined(_WIN32) || defined(_SYS_TYPES_FD_SET)
184 #define MHD_POSIX_SOCKETS 1
185 typedef int MHD_socket;
186 #define MHD_INVALID_SOCKET (-1)
187 #else /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
188 #define MHD_WINSOCK_SOCKETS 1
189 #include <winsock2.h>
190 typedef SOCKET MHD_socket;
191 #define MHD_INVALID_SOCKET (INVALID_SOCKET)
192 #endif /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
193 #define MHD_SOCKET_DEFINED 1
194 #endif /* MHD_SOCKET_DEFINED */
195 
201 #ifndef MHD_LONG_LONG
202 
205 #define MHD_LONG_LONG long long
206 #define MHD_UNSIGNED_LONG_LONG unsigned long long
207 #endif
208 
212 #ifndef MHD_LONG_LONG_PRINTF
213 
216 #define MHD_LONG_LONG_PRINTF "ll"
217 #define MHD_UNSIGNED_LONG_LONG_PRINTF "%llu"
218 #endif
219 
220 
226 #define MHD_HTTP_CONTINUE 100
227 #define MHD_HTTP_SWITCHING_PROTOCOLS 101
228 #define MHD_HTTP_PROCESSING 102
229 
230 #define MHD_HTTP_OK 200
231 #define MHD_HTTP_CREATED 201
232 #define MHD_HTTP_ACCEPTED 202
233 #define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION 203
234 #define MHD_HTTP_NO_CONTENT 204
235 #define MHD_HTTP_RESET_CONTENT 205
236 #define MHD_HTTP_PARTIAL_CONTENT 206
237 #define MHD_HTTP_MULTI_STATUS 207
238 
239 #define MHD_HTTP_MULTIPLE_CHOICES 300
240 #define MHD_HTTP_MOVED_PERMANENTLY 301
241 #define MHD_HTTP_FOUND 302
242 #define MHD_HTTP_SEE_OTHER 303
243 #define MHD_HTTP_NOT_MODIFIED 304
244 #define MHD_HTTP_USE_PROXY 305
245 #define MHD_HTTP_SWITCH_PROXY 306
246 #define MHD_HTTP_TEMPORARY_REDIRECT 307
247 
248 #define MHD_HTTP_BAD_REQUEST 400
249 #define MHD_HTTP_UNAUTHORIZED 401
250 #define MHD_HTTP_PAYMENT_REQUIRED 402
251 #define MHD_HTTP_FORBIDDEN 403
252 #define MHD_HTTP_NOT_FOUND 404
253 #define MHD_HTTP_METHOD_NOT_ALLOWED 405
254 #define MHD_HTTP_NOT_ACCEPTABLE 406
255 
256 #define MHD_HTTP_METHOD_NOT_ACCEPTABLE 406
257 #define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407
258 #define MHD_HTTP_REQUEST_TIMEOUT 408
259 #define MHD_HTTP_CONFLICT 409
260 #define MHD_HTTP_GONE 410
261 #define MHD_HTTP_LENGTH_REQUIRED 411
262 #define MHD_HTTP_PRECONDITION_FAILED 412
263 #define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE 413
264 #define MHD_HTTP_REQUEST_URI_TOO_LONG 414
265 #define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415
266 #define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416
267 #define MHD_HTTP_EXPECTATION_FAILED 417
268 #define MHD_HTTP_UNPROCESSABLE_ENTITY 422
269 #define MHD_HTTP_LOCKED 423
270 #define MHD_HTTP_FAILED_DEPENDENCY 424
271 #define MHD_HTTP_UNORDERED_COLLECTION 425
272 #define MHD_HTTP_UPGRADE_REQUIRED 426
273 #define MHD_HTTP_NO_RESPONSE 444
274 #define MHD_HTTP_RETRY_WITH 449
275 #define MHD_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450
276 #define MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451
277 
278 #define MHD_HTTP_INTERNAL_SERVER_ERROR 500
279 #define MHD_HTTP_NOT_IMPLEMENTED 501
280 #define MHD_HTTP_BAD_GATEWAY 502
281 #define MHD_HTTP_SERVICE_UNAVAILABLE 503
282 #define MHD_HTTP_GATEWAY_TIMEOUT 504
283 #define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505
284 #define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506
285 #define MHD_HTTP_INSUFFICIENT_STORAGE 507
286 #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509
287 #define MHD_HTTP_NOT_EXTENDED 510
288  /* end of group httpcode */
290 
297 #define MHD_ICY_FLAG ((uint32_t)(1 << 31))
298 
304 /* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */
305 #define MHD_HTTP_HEADER_ACCEPT "Accept"
306 #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset"
307 #define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding"
308 #define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language"
309 #define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges"
310 #define MHD_HTTP_HEADER_AGE "Age"
311 #define MHD_HTTP_HEADER_ALLOW "Allow"
312 #define MHD_HTTP_HEADER_AUTHORIZATION "Authorization"
313 #define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control"
314 #define MHD_HTTP_HEADER_CONNECTION "Connection"
315 #define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding"
316 #define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language"
317 #define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length"
318 #define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location"
319 #define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5"
320 #define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range"
321 #define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type"
322 #define MHD_HTTP_HEADER_COOKIE "Cookie"
323 #define MHD_HTTP_HEADER_DATE "Date"
324 #define MHD_HTTP_HEADER_ETAG "ETag"
325 #define MHD_HTTP_HEADER_EXPECT "Expect"
326 #define MHD_HTTP_HEADER_EXPIRES "Expires"
327 #define MHD_HTTP_HEADER_FROM "From"
328 #define MHD_HTTP_HEADER_HOST "Host"
329 #define MHD_HTTP_HEADER_IF_MATCH "If-Match"
330 #define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since"
331 #define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match"
332 #define MHD_HTTP_HEADER_IF_RANGE "If-Range"
333 #define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since"
334 #define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified"
335 #define MHD_HTTP_HEADER_LOCATION "Location"
336 #define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards"
337 #define MHD_HTTP_HEADER_PRAGMA "Pragma"
338 #define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate"
339 #define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization"
340 #define MHD_HTTP_HEADER_RANGE "Range"
341 /* This is not a typo, see HTTP spec */
342 #define MHD_HTTP_HEADER_REFERER "Referer"
343 #define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After"
344 #define MHD_HTTP_HEADER_SERVER "Server"
345 #define MHD_HTTP_HEADER_SET_COOKIE "Set-Cookie"
346 #define MHD_HTTP_HEADER_SET_COOKIE2 "Set-Cookie2"
347 #define MHD_HTTP_HEADER_TE "TE"
348 #define MHD_HTTP_HEADER_TRAILER "Trailer"
349 #define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
350 #define MHD_HTTP_HEADER_UPGRADE "Upgrade"
351 #define MHD_HTTP_HEADER_USER_AGENT "User-Agent"
352 #define MHD_HTTP_HEADER_VARY "Vary"
353 #define MHD_HTTP_HEADER_VIA "Via"
354 #define MHD_HTTP_HEADER_WARNING "Warning"
355 #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate"
356 #define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN "Access-Control-Allow-Origin"
357  /* end of group headers */
359 
366 #define MHD_HTTP_VERSION_1_0 "HTTP/1.0"
367 #define MHD_HTTP_VERSION_1_1 "HTTP/1.1"
368  /* end of group versions */
370 
376 #define MHD_HTTP_METHOD_CONNECT "CONNECT"
377 #define MHD_HTTP_METHOD_DELETE "DELETE"
378 #define MHD_HTTP_METHOD_GET "GET"
379 #define MHD_HTTP_METHOD_HEAD "HEAD"
380 #define MHD_HTTP_METHOD_OPTIONS "OPTIONS"
381 #define MHD_HTTP_METHOD_POST "POST"
382 #define MHD_HTTP_METHOD_PUT "PUT"
383 #define MHD_HTTP_METHOD_TRACE "TRACE"
384  /* end of group methods */
386 
392 #define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded"
393 #define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data"
394  /* end of group postenc */
396 
397 
402 struct MHD_Daemon;
403 
412 struct MHD_Connection;
413 
418 struct MHD_Response;
419 
424 struct MHD_PostProcessor;
425 
426 
439 {
444 
450 
455 
460 
465 
474 
485 
494 
499 
507 
516 
523 
530 
548 
553 
562 
568 
575 
576 };
577 
578 
587 typedef void (*MHD_LogCallback)(void *cls, const char *fm, va_list ap);
588 
589 
596 {
597 
603 
612 
618 
625 
639 
651 
659 
687 
695 
703 
710 
716 
724 
737 
747 
768 
788 
799 
806 
812 
819 
825 
841 
850 
857 
866 };
867 
868 
873 {
879 
885  intptr_t value;
886 
891  void *ptr_value;
892 
893 };
894 
895 
901 {
902 
907 
912 
918 
928 
933 
938 };
939 
940 
947 {
948 
954 
962 
970 
977 
987 
995 
996 };
997 
998 
1003 {
1004 
1008  int /* enum gnutls_cipher_algorithm */ cipher_algorithm;
1009 
1013  int /* enum gnutls_protocol */ protocol;
1014 
1019 
1023  void * /* gnutls_session_t */ tls_session;
1024 
1028  void * /* gnutls_x509_crt_t */ client_cert;
1029 
1033  struct sockaddr *client_addr;
1034 
1040 };
1041 
1042 
1049 {
1056 
1063 
1072 
1078 
1086 
1092 
1099 
1100 };
1101 
1102 
1108 {
1113 
1118 
1124 
1130 
1136 };
1137 
1138 
1149 typedef void
1150 (*MHD_PanicCallback) (void *cls,
1151  const char *file,
1152  unsigned int line,
1153  const char *reason);
1154 
1163 typedef int
1165  const struct sockaddr *addr,
1166  socklen_t addrlen);
1167 
1168 
1208 typedef int
1210  struct MHD_Connection *connection,
1211  const char *url,
1212  const char *method,
1213  const char *version,
1214  const char *upload_data,
1215  size_t *upload_data_size,
1216  void **con_cls);
1217 
1218 
1231 typedef void
1233  struct MHD_Connection *connection,
1234  void **con_cls,
1235  enum MHD_RequestTerminationCode toe);
1236 
1237 
1253 typedef int
1254 (*MHD_KeyValueIterator) (void *cls,
1255  enum MHD_ValueKind kind,
1256  const char *key,
1257  const char *value);
1258 
1259 
1304 typedef ssize_t
1306  uint64_t pos,
1307  char *buf,
1308  size_t max);
1309 
1310 
1320 typedef void
1322 
1323 
1343 typedef int
1344 (*MHD_PostDataIterator) (void *cls,
1345  enum MHD_ValueKind kind,
1346  const char *key,
1347  const char *filename,
1348  const char *content_type,
1349  const char *transfer_encoding,
1350  const char *data,
1351  uint64_t off,
1352  size_t size);
1353 
1354 /* **************** Daemon handling functions ***************** */
1355 
1373 _MHD_EXTERN struct MHD_Daemon *
1374 MHD_start_daemon_va (unsigned int flags,
1375  uint16_t port,
1377  MHD_AccessHandlerCallback dh, void *dh_cls,
1378  va_list ap);
1379 
1380 
1397 _MHD_EXTERN struct MHD_Daemon *
1398 MHD_start_daemon (unsigned int flags,
1399  uint16_t port,
1401  MHD_AccessHandlerCallback dh, void *dh_cls,
1402  ...);
1403 
1404 
1425 MHD_quiesce_daemon (struct MHD_Daemon *daemon);
1426 
1427 
1434 _MHD_EXTERN void
1435 MHD_stop_daemon (struct MHD_Daemon *daemon);
1436 
1437 
1467 _MHD_EXTERN int
1468 MHD_add_connection (struct MHD_Daemon *daemon,
1469  MHD_socket client_socket,
1470  const struct sockaddr *addr,
1471  socklen_t addrlen);
1472 
1473 
1493 _MHD_EXTERN int
1494 MHD_get_fdset (struct MHD_Daemon *daemon,
1495  fd_set *read_fd_set,
1496  fd_set *write_fd_set,
1497  fd_set *except_fd_set,
1498  MHD_socket *max_fd);
1499 
1500 
1522 _MHD_EXTERN int
1523 MHD_get_fdset2 (struct MHD_Daemon *daemon,
1524  fd_set *read_fd_set,
1525  fd_set *write_fd_set,
1526  fd_set *except_fd_set,
1527  MHD_socket *max_fd,
1528  unsigned int fd_setsize);
1529 
1530 
1550 #define MHD_get_fdset(daemon,read_fd_set,write_fd_set,except_fd_set,max_fd) \
1551  MHD_get_fdset2((daemon),(read_fd_set),(write_fd_set),(except_fd_set),(max_fd),FD_SETSIZE)
1552 
1553 
1568 _MHD_EXTERN int
1569 MHD_get_timeout (struct MHD_Daemon *daemon,
1570  MHD_UNSIGNED_LONG_LONG *timeout);
1571 
1572 
1592 _MHD_EXTERN int
1593 MHD_run (struct MHD_Daemon *daemon);
1594 
1595 
1615 _MHD_EXTERN int
1616 MHD_run_from_select (struct MHD_Daemon *daemon,
1617  const fd_set *read_fd_set,
1618  const fd_set *write_fd_set,
1619  const fd_set *except_fd_set);
1620 
1621 
1622 
1623 
1624 /* **************** Connection handling functions ***************** */
1625 
1637 _MHD_EXTERN int
1638 MHD_get_connection_values (struct MHD_Connection *connection,
1639  enum MHD_ValueKind kind,
1640  MHD_KeyValueIterator iterator, void *iterator_cls);
1641 
1642 
1668 _MHD_EXTERN int
1669 MHD_set_connection_value (struct MHD_Connection *connection,
1670  enum MHD_ValueKind kind,
1671  const char *key,
1672  const char *value);
1673 
1674 
1691 _MHD_EXTERN void
1692 MHD_set_panic_func (MHD_PanicCallback cb, void *cls);
1693 
1694 
1704 _MHD_EXTERN size_t
1705 MHD_http_unescape (char *val);
1706 
1707 
1718 _MHD_EXTERN const char *
1719 MHD_lookup_connection_value (struct MHD_Connection *connection,
1720  enum MHD_ValueKind kind,
1721  const char *key);
1722 
1723 
1735 _MHD_EXTERN int
1736 MHD_queue_response (struct MHD_Connection *connection,
1737  unsigned int status_code,
1738  struct MHD_Response *response);
1739 
1740 
1768 _MHD_EXTERN void
1769 MHD_suspend_connection (struct MHD_Connection *connection);
1770 
1771 
1780 _MHD_EXTERN void
1781 MHD_resume_connection (struct MHD_Connection *connection);
1782 
1783 
1784 /* **************** Response manipulation functions ***************** */
1785 
1786 
1791 {
1796 
1803 
1804 };
1805 
1806 
1811 {
1816 };
1817 
1818 
1827 _MHD_EXTERN int
1828 MHD_set_response_options (struct MHD_Response *response,
1829  enum MHD_ResponseFlags flags,
1830  ...);
1831 
1832 
1849 _MHD_EXTERN struct MHD_Response *
1850 MHD_create_response_from_callback (uint64_t size,
1851  size_t block_size,
1854 
1855 
1870 _MHD_EXTERN struct MHD_Response *
1871 MHD_create_response_from_data (size_t size,
1872  void *data,
1873  int must_free,
1874  int must_copy);
1875 
1876 
1883 {
1884 
1892 
1900 
1909 
1910 };
1911 
1912 
1923 _MHD_EXTERN struct MHD_Response *
1924 MHD_create_response_from_buffer (size_t size,
1925  void *buffer,
1926  enum MHD_ResponseMemoryMode mode);
1927 
1928 
1940 _MHD_EXTERN struct MHD_Response *
1941 MHD_create_response_from_fd (size_t size,
1942  int fd);
1943 
1944 
1961 _MHD_EXTERN struct MHD_Response *
1963  int fd,
1964  off_t offset);
1965 
1966 
1967 #if 0
1968 
1974 enum MHD_UpgradeAction
1975 {
1976 
1985  MHD_UPGRADE_ACTION_CLOSE = 0,
1986 
1996  MHD_UPGRADE_ACTION_CORK
1997 
1998 };
1999 
2000 
2012 typedef int
2013 (*MHD_UpgradeActionCallback)(void *cls,
2014  enum MHD_UpgradeAction action,
2015  ...);
2016 
2062 typedef void
2063 (*MHD_UpgradeHandler)(void *cls,
2064  struct MHD_Connection *connection,
2065  MHD_SOCKET sock,
2066  MHD_UpgradeActionCallback upgrade_action,
2067  void *upgrade_action_cls);
2068 
2069 
2099 struct MHD_Response *
2100 MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
2101  void *upgrade_handler_cls);
2102 #endif
2103 
2113 _MHD_EXTERN void
2114 MHD_destroy_response (struct MHD_Response *response);
2115 
2116 
2127 _MHD_EXTERN int
2128 MHD_add_response_header (struct MHD_Response *response,
2129  const char *header,
2130  const char *content);
2131 
2132 
2142 _MHD_EXTERN int
2143 MHD_add_response_footer (struct MHD_Response *response,
2144  const char *footer,
2145  const char *content);
2146 
2147 
2157 _MHD_EXTERN int
2158 MHD_del_response_header (struct MHD_Response *response,
2159  const char *header,
2160  const char *content);
2161 
2162 
2173 _MHD_EXTERN int
2174 MHD_get_response_headers (struct MHD_Response *response,
2175  MHD_KeyValueIterator iterator, void *iterator_cls);
2176 
2177 
2186 _MHD_EXTERN const char *
2187 MHD_get_response_header (struct MHD_Response *response,
2188  const char *key);
2189 
2190 
2191 /* ********************** PostProcessor functions ********************** */
2192 
2218 _MHD_EXTERN struct MHD_PostProcessor *
2219 MHD_create_post_processor (struct MHD_Connection *connection,
2220  size_t buffer_size,
2221  MHD_PostDataIterator iter, void *iter_cls);
2222 
2223 
2237 _MHD_EXTERN int
2238 MHD_post_process (struct MHD_PostProcessor *pp,
2239  const char *post_data, size_t post_data_len);
2240 
2241 
2252 _MHD_EXTERN int
2253 MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
2254 
2255 
2256 /* ********************* Digest Authentication functions *************** */
2257 
2258 
2264 #define MHD_INVALID_NONCE -1
2265 
2266 
2275 _MHD_EXTERN char *
2276 MHD_digest_auth_get_username (struct MHD_Connection *connection);
2277 
2278 
2292 _MHD_EXTERN int
2293 MHD_digest_auth_check (struct MHD_Connection *connection,
2294  const char *realm,
2295  const char *username,
2296  const char *password,
2297  unsigned int nonce_timeout);
2298 
2299 
2314 _MHD_EXTERN int
2315 MHD_queue_auth_fail_response (struct MHD_Connection *connection,
2316  const char *realm,
2317  const char *opaque,
2318  struct MHD_Response *response,
2319  int signal_stale);
2320 
2321 
2331 _MHD_EXTERN char *
2333  char** password);
2334 
2335 
2348 _MHD_EXTERN int
2350  const char *realm,
2351  struct MHD_Response *response);
2352 
2353 /* ********************** generic query functions ********************** */
2354 
2355 
2366 _MHD_EXTERN const union MHD_ConnectionInfo *
2367 MHD_get_connection_info (struct MHD_Connection *connection,
2368  enum MHD_ConnectionInfoType info_type,
2369  ...);
2370 
2371 
2377 {
2378 
2385 
2386 };
2387 
2388 
2398 _MHD_EXTERN int
2399 MHD_set_connection_option (struct MHD_Connection *connection,
2400  enum MHD_CONNECTION_OPTION option,
2401  ...);
2402 
2403 
2408 {
2413  size_t key_size;
2414 
2420 
2426 
2430  unsigned int num_connections;
2431 };
2432 
2433 
2445 _MHD_EXTERN const union MHD_DaemonInfo *
2446 MHD_get_daemon_info (struct MHD_Daemon *daemon,
2447  enum MHD_DaemonInfoType info_type,
2448  ...);
2449 
2450 
2457 _MHD_EXTERN const char*
2458 MHD_get_version (void);
2459 
2460 
2466 {
2472 
2481 
2487 
2493 
2501 
2507 
2514 
2521 
2527 
2534 
2541 
2549 
2557 };
2558 
2559 
2571 _MHD_EXTERN int
2573 
2574 
2575 #if 0 /* keep Emacsens' auto-indent happy */
2576 {
2577 #endif
2578 #ifdef __cplusplus
2579 }
2580 #endif
2581 
2582 #endif
int(* MHD_KeyValueIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
Definition: microhttpd.h:1254
_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)
Definition: daemon.c:3364
_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)
Definition: response.c:241
_MHD_EXTERN const char * MHD_get_version(void)
Definition: daemon.c:4423
size_t mac_key_size
Definition: microhttpd.h:2419
_MHD_EXTERN const char * MHD_lookup_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
Definition: connection.c:217
_MHD_EXTERN union MHD_DaemonInfo * MHD_get_daemon_info(struct MHD_Daemon *daemon, enum MHD_DaemonInfoType info_type,...)
Definition: daemon.c:4355
MHD_socket listen_fd
Definition: microhttpd.h:2425
_MHD_EXTERN int MHD_add_response_header(struct MHD_Response *response, const char *header, const char *content)
Definition: response.c:100
MHD_ContentReaderFreeCallback crfc
Definition: internal.h:276
_MHD_EXTERN int MHD_get_timeout(struct MHD_Daemon *daemon, MHD_UNSIGNED_LONG_LONG *timeout)
Definition: daemon.c:1963
char * version
Definition: internal.h:604
void(* MHD_ContentReaderFreeCallback)(void *cls)
Definition: microhttpd.h:1321
_MHD_EXTERN int MHD_add_connection(struct MHD_Daemon *daemon, MHD_socket client_socket, const struct sockaddr *addr, socklen_t addrlen)
Definition: daemon.c:1769
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_fd_at_offset(size_t size, int fd, off_t offset)
Definition: response.c:364
_MHD_EXTERN int MHD_queue_basic_auth_fail_response(struct MHD_Connection *connection, const char *realm, struct MHD_Response *response)
Definition: basicauth.c:116
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
Definition: microhttpd.h:1232
MHD_RequestTerminationCode
Definition: microhttpd.h:946
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)
Definition: microhttpd.h:1344
_MHD_EXTERN int MHD_destroy_post_processor(struct MHD_PostProcessor *pp)
MHD_socket connect_fd
Definition: microhttpd.h:1018
_MHD_EXTERN int MHD_digest_auth_check(struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout)
Definition: digestauth.c:562
int MHD_socket
Definition: microhttpd.h:185
_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,...)
Definition: daemon.c:2783
intptr_t value
Definition: microhttpd.h:885
_MHD_EXTERN void MHD_set_panic_func(MHD_PanicCallback cb, void *cls)
Definition: daemon.c:4409
#define MHD_UNSIGNED_LONG_LONG
Definition: microhttpd.h:206
_MHD_EXTERN struct MHD_PostProcessor * MHD_create_post_processor(struct MHD_Connection *connection, size_t buffer_size, MHD_PostDataIterator iter, void *iter_cls)
MHD_ResponseOptions
Definition: microhttpd.h:1810
MHD_CONNECTION_OPTION
Definition: microhttpd.h:2376
_MHD_EXTERN char * MHD_basic_auth_get_username_password(struct MHD_Connection *connection, char **password)
Definition: basicauth.c:46
_MHD_EXTERN union MHD_ConnectionInfo * MHD_get_connection_info(struct MHD_Connection *connection, enum MHD_ConnectionInfoType info_type,...)
Definition: connection.c:2805
_MHD_EXTERN void MHD_stop_daemon(struct MHD_Daemon *daemon)
Definition: daemon.c:4199
_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)
Definition: digestauth.c:800
_MHD_EXTERN int MHD_add_response_footer(struct MHD_Response *response, const char *footer, const char *content)
Definition: response.c:120
char * method
Definition: internal.h:592
#define _MHD_EXTERN
Definition: microhttpd.h:175
_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)
Definition: daemon.c:2054
_MHD_EXTERN char * MHD_digest_auth_get_username(struct MHD_Connection *connection)
Definition: digestauth.c:361
_MHD_EXTERN void MHD_destroy_response(struct MHD_Response *response)
Definition: response.c:488
_MHD_EXTERN void MHD_suspend_connection(struct MHD_Connection *connection)
Definition: daemon.c:1532
int(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
Definition: microhttpd.h:1164
_MHD_EXTERN int MHD_set_connection_option(struct MHD_Connection *connection, enum MHD_CONNECTION_OPTION option,...)
Definition: connection.c:2848
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
Definition: microhttpd.h:1305
uint16_t port
Definition: internal.h:1165
MHD_ValueKind
Definition: microhttpd.h:900
char * url
Definition: internal.h:598
struct MHD_Daemon * daemon
Definition: microhttpd.h:1039
_MHD_EXTERN int MHD_post_process(struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len)
MHD_FEATURE
Definition: microhttpd.h:2465
MHD_ConnectionInfoType
Definition: microhttpd.h:1048
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_fd(size_t size, int fd)
Definition: response.c:394
_MHD_EXTERN int MHD_queue_response(struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
Definition: connection.c:2907
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_buffer(size_t size, void *buffer, enum MHD_ResponseMemoryMode mode)
Definition: response.c:467
MHD_AcceptPolicyCallback apc
Definition: internal.h:984
void * ptr_value
Definition: microhttpd.h:891
_MHD_EXTERN int MHD_set_response_options(struct MHD_Response *response, enum MHD_ResponseFlags flags,...)
Definition: response.c:280
_MHD_EXTERN int MHD_get_connection_values(struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls)
Definition: connection.c:128
_MHD_EXTERN int MHD_run(struct MHD_Daemon *daemon)
Definition: daemon.c:2691
MHD_OPTION
MHD options.
Definition: microhttpd.h:595
void * apc_cls
Definition: internal.h:989
#define MHD_get_fdset(daemon, read_fd_set, write_fd_set, except_fd_set, max_fd)
Definition: microhttpd.h:1550
MHD_ContentReaderCallback crc
Definition: internal.h:270
void * crc_cls
Definition: internal.h:264
MHD_DaemonInfoType
Definition: microhttpd.h:1107
_MHD_EXTERN int MHD_is_feature_supported(enum MHD_FEATURE feature)
Definition: daemon.c:4455
struct sockaddr * client_addr
Definition: microhttpd.h:1033
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)
Definition: microhttpd.h:1209
_MHD_EXTERN int MHD_del_response_header(struct MHD_Response *response, const char *header, const char *content)
Definition: response.c:140
_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)
Definition: daemon.c:684
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_data(size_t size, void *data, int must_free, int must_copy)
Definition: response.c:416
MHD_ResponseFlags
Definition: microhttpd.h:1790
_MHD_EXTERN const char * MHD_get_response_header(struct MHD_Response *response, const char *key)
Definition: response.c:210
_MHD_EXTERN MHD_socket MHD_quiesce_daemon(struct MHD_Daemon *daemon)
Definition: daemon.c:2819
unsigned int num_connections
Definition: microhttpd.h:2430
_MHD_EXTERN size_t MHD_http_unescape(char *val)
Definition: internal.c:132
enum MHD_OPTION option
Definition: microhttpd.h:878
_MHD_EXTERN int MHD_set_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value)
Definition: connection.c:177
MHD_FLAG
Flags for the struct MHD_Daemon.
Definition: microhttpd.h:438
_MHD_EXTERN int MHD_get_response_headers(struct MHD_Response *response, MHD_KeyValueIterator iterator, void *iterator_cls)
Definition: response.c:183
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
Definition: microhttpd.h:587
MHD_ResponseMemoryMode
Definition: microhttpd.h:1882
_MHD_EXTERN void MHD_resume_connection(struct MHD_Connection *connection)
Definition: daemon.c:1594
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)
Definition: microhttpd.h:1150