aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd')
-rw-r--r--src/microhttpd/basicauth.c8
-rw-r--r--src/microhttpd/connection.c42
-rw-r--r--src/microhttpd/daemon.c143
-rw-r--r--src/microhttpd/digestauth.c11
-rw-r--r--src/microhttpd/postprocessor.c45
-rw-r--r--src/microhttpd/response.c66
6 files changed, 193 insertions, 122 deletions
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index e8a69e7d..587595b9 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -40,10 +40,11 @@
40 * @param password a pointer for the password 40 * @param password a pointer for the password
41 * @return NULL if no username could be found, a pointer 41 * @return NULL if no username could be found, a pointer
42 * to the username if found 42 * to the username if found
43 * @ingroup authentication
43 */ 44 */
44char * 45char *
45MHD_basic_auth_get_username_password(struct MHD_Connection *connection, 46MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
46 char** password) 47 char** password)
47{ 48{
48 const char *header; 49 const char *header;
49 char *decode; 50 char *decode;
@@ -108,7 +109,8 @@ MHD_basic_auth_get_username_password(struct MHD_Connection *connection,
108 * @param connection The MHD connection structure 109 * @param connection The MHD connection structure
109 * @param realm the realm presented to the client 110 * @param realm the realm presented to the client
110 * @param response response object to modify and queue 111 * @param response response object to modify and queue
111 * @return MHD_YES on success, MHD_NO otherwise 112 * @return #MHD_YES on success, #MHD_NO otherwise
113 * @ingroup authentication
112 */ 114 */
113int 115int
114MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, 116MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index c16ee571..4b30a4c0 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -113,8 +113,9 @@
113 * @param kind types of values to iterate over 113 * @param kind types of values to iterate over
114 * @param iterator callback to call on each header; 114 * @param iterator callback to call on each header;
115 * maybe NULL (then just count headers) 115 * maybe NULL (then just count headers)
116 * @param iterator_cls extra argument to iterator 116 * @param iterator_cls extra argument to @a iterator
117 * @return number of entries iterated over 117 * @return number of entries iterated over
118 * @ingroup request
118 */ 119 */
119int 120int
120MHD_get_connection_values (struct MHD_Connection *connection, 121MHD_get_connection_values (struct MHD_Connection *connection,
@@ -141,15 +142,15 @@ MHD_get_connection_values (struct MHD_Connection *connection,
141 142
142 143
143/** 144/**
144 * This function can be used to append an entry to the list of HTTP 145 * This function can be used to add an entry to the HTTP headers of a
145 * headers of a connection (so that the MHD_get_connection_values 146 * connection (so that the #MHD_get_connection_values function will
146 * function will return them -- and the MHD PostProcessor will also 147 * return them -- and the `struct MHD_PostProcessor` will also see
147 * see them). This maybe required in certain situations (see Mantis 148 * them). This maybe required in certain situations (see Mantis
148 * #1399) where (broken) HTTP implementations fail to supply values 149 * #1399) where (broken) HTTP implementations fail to supply values
149 * needed by the post processor (or other parts of the application). 150 * needed by the post processor (or other parts of the application).
150 * 151 *
151 * This function MUST only be called from within the 152 * This function MUST only be called from within the
152 * MHD_AccessHandlerCallback (otherwise, access maybe improperly 153 * #MHD_AccessHandlerCallback (otherwise, access maybe improperly
153 * synchronized). Furthermore, the client must guarantee that the key 154 * synchronized). Furthermore, the client must guarantee that the key
154 * and value arguments are 0-terminated strings that are NOT freed 155 * and value arguments are 0-terminated strings that are NOT freed
155 * until the connection is closed. (The easiest way to do this is by 156 * until the connection is closed. (The easiest way to do this is by
@@ -160,9 +161,10 @@ MHD_get_connection_values (struct MHD_Connection *connection,
160 * @param kind kind of the value 161 * @param kind kind of the value
161 * @param key key for the value 162 * @param key key for the value
162 * @param value the value itself 163 * @param value the value itself
163 * @return MHD_NO if the operation could not be 164 * @return #MHD_NO if the operation could not be
164 * performed due to insufficient memory; 165 * performed due to insufficient memory;
165 * MHD_YES on success 166 * #MHD_YES on success
167 * @ingroup request
166 */ 168 */
167int 169int
168MHD_set_connection_value (struct MHD_Connection *connection, 170MHD_set_connection_value (struct MHD_Connection *connection,
@@ -202,6 +204,7 @@ MHD_set_connection_value (struct MHD_Connection *connection,
202 * @param kind what kind of value are we looking for 204 * @param kind what kind of value are we looking for
203 * @param key the header to look for, NULL to lookup 'trailing' value without a key 205 * @param key the header to look for, NULL to lookup 'trailing' value without a key
204 * @return NULL if no such item was found 206 * @return NULL if no such item was found
207 * @ingroup request
205 */ 208 */
206const char * 209const char *
207MHD_lookup_connection_value (struct MHD_Connection *connection, 210MHD_lookup_connection_value (struct MHD_Connection *connection,
@@ -2561,15 +2564,16 @@ MHD_set_http_callbacks_ (struct MHD_Connection *connection)
2561 * 2564 *
2562 * @param connection what connection to get information about 2565 * @param connection what connection to get information about
2563 * @param infoType what information is desired? 2566 * @param infoType what information is desired?
2564 * @param ... depends on infoType 2567 * @param ... depends on @a info_type
2565 * @return NULL if this information is not available 2568 * @return NULL if this information is not available
2566 * (or if the infoType is unknown) 2569 * (or if the @a info_type is unknown)
2570 * @ingroup specialized
2567 */ 2571 */
2568const union MHD_ConnectionInfo * 2572const union MHD_ConnectionInfo *
2569MHD_get_connection_info (struct MHD_Connection *connection, 2573MHD_get_connection_info (struct MHD_Connection *connection,
2570 enum MHD_ConnectionInfoType infoType, ...) 2574 enum MHD_ConnectionInfoType info_type, ...)
2571{ 2575{
2572 switch (infoType) 2576 switch (info_type)
2573 { 2577 {
2574#if HTTPS_SUPPORT 2578#if HTTPS_SUPPORT
2575 case MHD_CONNECTION_INFO_CIPHER_ALGO: 2579 case MHD_CONNECTION_INFO_CIPHER_ALGO:
@@ -2605,7 +2609,8 @@ MHD_get_connection_info (struct MHD_Connection *connection,
2605 * @param connection connection to modify 2609 * @param connection connection to modify
2606 * @param option option to set 2610 * @param option option to set
2607 * @param ... arguments to the option, depending on the option type 2611 * @param ... arguments to the option, depending on the option type
2608 * @return MHD_YES on success, MHD_NO if setting the option failed 2612 * @return #MHD_YES on success, #MHD_NO if setting the option failed
2613 * @ingroup specialized
2609 */ 2614 */
2610int 2615int
2611MHD_set_connection_option (struct MHD_Connection *connection, 2616MHD_set_connection_option (struct MHD_Connection *connection,
@@ -2653,13 +2658,14 @@ MHD_set_connection_option (struct MHD_Connection *connection,
2653 2658
2654/** 2659/**
2655 * Queue a response to be transmitted to the client (as soon as 2660 * Queue a response to be transmitted to the client (as soon as
2656 * possible but after MHD_AccessHandlerCallback returns). 2661 * possible but after #MHD_AccessHandlerCallback returns).
2657 * 2662 *
2658 * @param connection the connection identifying the client 2663 * @param connection the connection identifying the client
2659 * @param status_code HTTP status code (i.e. 200 for OK) 2664 * @param status_code HTTP status code (i.e. #MHD_HTTP_OK)
2660 * @param response response to transmit 2665 * @param response response to transmit
2661 * @return MHD_NO on error (i.e. reply already sent), 2666 * @return #MHD_NO on error (i.e. reply already sent),
2662 * MHD_YES on success or if message has been queued 2667 * #MHD_YES on success or if message has been queued
2668 * @ingroup response
2663 */ 2669 */
2664int 2670int
2665MHD_queue_response (struct MHD_Connection *connection, 2671MHD_queue_response (struct MHD_Connection *connection,
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 8f85c49a..7f366966 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -548,7 +548,7 @@ add_to_fd_set (int fd,
548 548
549 549
550/** 550/**
551 * Obtain the select sets for this daemon. 551 * Obtain the `select()` sets for this daemon.
552 * 552 *
553 * @param daemon daemon to get sets from 553 * @param daemon daemon to get sets from
554 * @param read_fd_set read set 554 * @param read_fd_set read set
@@ -556,9 +556,10 @@ add_to_fd_set (int fd,
556 * @param except_fd_set except set 556 * @param except_fd_set except set
557 * @param max_fd increased to largest FD added (if larger 557 * @param max_fd increased to largest FD added (if larger
558 * than existing value); can be NULL 558 * than existing value); can be NULL
559 * @return MHD_YES on success, MHD_NO if this 559 * @return #MHD_YES on success, #MHD_NO if this
560 * daemon was not started with the right 560 * daemon was not started with the right
561 * options for this call. 561 * options for this call.
562 * @ingroup event
562 */ 563 */
563int 564int
564MHD_get_fdset (struct MHD_Daemon *daemon, 565MHD_get_fdset (struct MHD_Daemon *daemon,
@@ -1406,12 +1407,16 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1406 1407
1407 1408
1408/** 1409/**
1409 * Add another client connection to the set of connections 1410 * Add another client connection to the set of connections managed by
1410 * managed by MHD. This API is usually not needed (since 1411 * MHD. This API is usually not needed (since MHD will accept inbound
1411 * MHD will accept inbound connections on the server socket). 1412 * connections on the server socket). Use this API in special cases,
1412 * Use this API in special cases, for example if your HTTP 1413 * for example if your HTTP server is behind NAT and needs to connect
1413 * server is behind NAT and needs to connect out to the 1414 * out to the HTTP client, or if you are building a proxy.
1414 * HTTP client. 1415 *
1416 * If you use this API in conjunction with a internal select or a
1417 * thread pool, you must set the option
1418 * #MHD_USE_PIPE_FOR_SHUTDOWN to ensure that the freshly added
1419 * connection is immediately processed by MHD.
1415 * 1420 *
1416 * The given client socket will be managed (and closed!) by MHD after 1421 * The given client socket will be managed (and closed!) by MHD after
1417 * this call and must no longer be used directly by the application 1422 * this call and must no longer be used directly by the application
@@ -1423,11 +1428,12 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1423 * @param client_socket socket to manage (MHD will expect 1428 * @param client_socket socket to manage (MHD will expect
1424 * to receive an HTTP request from this socket next). 1429 * to receive an HTTP request from this socket next).
1425 * @param addr IP address of the client 1430 * @param addr IP address of the client
1426 * @param addrlen number of bytes in addr 1431 * @param addrlen number of bytes in @a addr
1427 * @return MHD_YES on success, MHD_NO if this daemon could 1432 * @return #MHD_YES on success, #MHD_NO if this daemon could
1428 * not handle the connection (i.e. malloc failed, etc). 1433 * not handle the connection (i.e. `malloc()` failed, etc).
1429 * The socket will be closed in any case; 'errno' is 1434 * The socket will be closed in any case; `errno` is
1430 * set to indicate further details about the error. 1435 * set to indicate further details about the error.
1436 * @ingroup specialized
1431 */ 1437 */
1432int 1438int
1433MHD_add_connection (struct MHD_Daemon *daemon, 1439MHD_add_connection (struct MHD_Daemon *daemon,
@@ -1602,16 +1608,18 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
1602 1608
1603 1609
1604/** 1610/**
1605 * Obtain timeout value for select for this daemon 1611 * Obtain timeout value for `select()` for this daemon (only needed if
1606 * (only needed if connection timeout is used). The 1612 * connection timeout is used). The returned value is how long
1607 * returned value is how long select should at most 1613 * `select()` or `poll()` should at most block, not the timeout value set
1608 * block, not the timeout value set for connections. 1614 * for connections. This function MUST NOT be called if MHD is
1615 * running with #MHD_USE_THREAD_PER_CONNECTION.
1609 * 1616 *
1610 * @param daemon daemon to query for timeout 1617 * @param daemon daemon to query for timeout
1611 * @param timeout set to the timeout (in milliseconds) 1618 * @param timeout set to the timeout (in milliseconds)
1612 * @return MHD_YES on success, MHD_NO if timeouts are 1619 * @return #MHD_YES on success, #MHD_NO if timeouts are
1613 * not used (or no connections exist that would 1620 * not used (or no connections exist that would
1614 * necessiate the use of a timeout right now). 1621 * necessiate the use of a timeout right now).
1622 * @ingroup event
1615 */ 1623 */
1616int 1624int
1617MHD_get_timeout (struct MHD_Daemon *daemon, 1625MHD_get_timeout (struct MHD_Daemon *daemon,
@@ -1685,21 +1693,22 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
1685 1693
1686/** 1694/**
1687 * Run webserver operations. This method should be called by clients 1695 * Run webserver operations. This method should be called by clients
1688 * in combination with MHD_get_fdset if the client-controlled select 1696 * in combination with #MHD_get_fdset if the client-controlled select
1689 * method is used. 1697 * method is used.
1690 * 1698 *
1691 * You can use this function instead of "MHD_run" if you called 1699 * You can use this function instead of #MHD_run if you called
1692 * 'select' on the result from "MHD_get_fdset". File descriptors in 1700 * `select()` on the result from #MHD_get_fdset. File descriptors in
1693 * the sets that are not controlled by MHD will be ignored. Calling 1701 * the sets that are not controlled by MHD will be ignored. Calling
1694 * this function instead of "MHD_run" is more efficient as MHD will 1702 * this function instead of #MHD_run is more efficient as MHD will
1695 * not have to call 'select' again to determine which operations are 1703 * not have to call `select()` again to determine which operations are
1696 * ready. 1704 * ready.
1697 * 1705 *
1698 * @param daemon daemon to run select loop for 1706 * @param daemon daemon to run select loop for
1699 * @param read_fd_set read set 1707 * @param read_fd_set read set
1700 * @param write_fd_set write set 1708 * @param write_fd_set write set
1701 * @param except_fd_set except set (not used, can be NULL) 1709 * @param except_fd_set except set (not used, can be NULL)
1702 * @return MHD_NO on serious errors, MHD_YES on success 1710 * @return #MHD_NO on serious errors, #MHD_YES on success
1711 * @ingroup event
1703 */ 1712 */
1704int 1713int
1705MHD_run_from_select (struct MHD_Daemon *daemon, 1714MHD_run_from_select (struct MHD_Daemon *daemon,
@@ -2295,18 +2304,23 @@ MHD_epoll (struct MHD_Daemon *daemon,
2295 2304
2296 2305
2297/** 2306/**
2298 * Run webserver operations (without blocking unless 2307 * Run webserver operations (without blocking unless in client
2299 * in client callbacks). This method should be called 2308 * callbacks). This method should be called by clients in combination
2300 * by clients in combination with MHD_get_fdset 2309 * with #MHD_get_fdset if the client-controlled select method is used.
2301 * if the client-controlled select method is used.
2302 * 2310 *
2303 * This function will work for external 'poll' and 'select' mode. 2311 * This function is a convenience method, which is useful if the
2304 * However, if using external 'select' mode, you may want to 2312 * fd_sets from #MHD_get_fdset were not directly passed to `select()`;
2305 * instead use 'MHD_run_from_select', as it is more efficient. 2313 * with this function, MHD will internally do the appropriate `select()`
2314 * call itself again. While it is always safe to call #MHD_run (in
2315 * external select mode), you should call #MHD_run_from_select if
2316 * performance is important (as it saves an expensive call to
2317 * `select()`).
2306 * 2318 *
2307 * @return MHD_YES on success, MHD_NO if this 2319 * @param daemon daemon to run
2320 * @return #MHD_YES on success, #MHD_NO if this
2308 * daemon was not started with the right 2321 * daemon was not started with the right
2309 * options for this call. 2322 * options for this call.
2323 * @ingroup event
2310 */ 2324 */
2311int 2325int
2312MHD_run (struct MHD_Daemon *daemon) 2326MHD_run (struct MHD_Daemon *daemon)
@@ -2365,16 +2379,20 @@ MHD_select_thread (void *cls)
2365 2379
2366 2380
2367/** 2381/**
2368 * Start a webserver on the given port. 2382 * Start a webserver on the given port. Variadic version of
2383 * #MHD_start_daemon_va.
2369 * 2384 *
2370 * @param flags combination of MHD_FLAG values 2385 * @param flags combination of `enum MHD_FLAG` values
2371 * @param port port to bind to 2386 * @param port port to bind to
2372 * @param apc callback to call to check which clients 2387 * @param apc callback to call to check which clients
2373 * will be allowed to connect 2388 * will be allowed to connect; you can pass NULL
2389 * in which case connections from any IP will be
2390 * accepted
2374 * @param apc_cls extra argument to apc 2391 * @param apc_cls extra argument to apc
2375 * @param dh default handler for all URIs 2392 * @param dh handler called for all requests (repeatedly)
2376 * @param dh_cls extra argument to dh 2393 * @param dh_cls extra argument to @a dh
2377 * @return NULL on error, handle to daemon on success 2394 * @return NULL on error, handle to daemon on success
2395 * @ingroup event
2378 */ 2396 */
2379struct MHD_Daemon * 2397struct MHD_Daemon *
2380MHD_start_daemon (unsigned int flags, 2398MHD_start_daemon (unsigned int flags,
@@ -2399,12 +2417,18 @@ MHD_start_daemon (unsigned int flags,
2399 * connections. Note that the caller is responsible for closing the 2417 * connections. Note that the caller is responsible for closing the
2400 * returned socket; however, if MHD is run using threads (anything but 2418 * returned socket; however, if MHD is run using threads (anything but
2401 * external select mode), it must not be closed until AFTER 2419 * external select mode), it must not be closed until AFTER
2402 * "MHD_stop_daemon" has been called (as it is theoretically possible 2420 * #MHD_stop_daemon has been called (as it is theoretically possible
2403 * that an existing thread is still using it). 2421 * that an existing thread is still using it).
2404 * 2422 *
2423 * Note that some thread modes require the caller to have passed
2424 * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is
2425 * in one of those modes and this option was not given to
2426 * #MHD_start_daemon, this function will return -1.
2427 *
2405 * @param daemon daemon to stop accepting new connections for 2428 * @param daemon daemon to stop accepting new connections for
2406 * @return old listen socket on success, -1 if the daemon was 2429 * @return old listen socket on success, -1 if the daemon was
2407 * already not listening anymore 2430 * already not listening anymore
2431 * @ingroup specialized
2408 */ 2432 */
2409int 2433int
2410MHD_quiesce_daemon (struct MHD_Daemon *daemon) 2434MHD_quiesce_daemon (struct MHD_Daemon *daemon)
@@ -2877,20 +2901,22 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
2877#endif 2901#endif
2878 2902
2879 2903
2880
2881/** 2904/**
2882 * Start a webserver on the given port. 2905 * Start a webserver on the given port.
2883 * 2906 *
2884 * @param flags combination of MHD_FLAG values 2907 * @param flags combination of `enum MHD_FLAG` values
2885 * @param port port to bind to 2908 * @param port port to bind to (in host byte order)
2886 * @param apc callback to call to check which clients 2909 * @param apc callback to call to check which clients
2887 * will be allowed to connect 2910 * will be allowed to connect; you can pass NULL
2911 * in which case connections from any IP will be
2912 * accepted
2888 * @param apc_cls extra argument to apc 2913 * @param apc_cls extra argument to apc
2889 * @param dh default handler for all URIs 2914 * @param dh handler called for all requests (repeatedly)
2890 * @param dh_cls extra argument to dh 2915 * @param dh_cls extra argument to @a dh
2891 * @param ap list of options (type-value pairs, 2916 * @param ap list of options (type-value pairs,
2892 * terminated with MHD_OPTION_END). 2917 * terminated with #MHD_OPTION_END).
2893 * @return NULL on error, handle to daemon on success 2918 * @return NULL on error, handle to daemon on success
2919 * @ingroup event
2894 */ 2920 */
2895struct MHD_Daemon * 2921struct MHD_Daemon *
2896MHD_start_daemon_va (unsigned int flags, 2922MHD_start_daemon_va (unsigned int flags,
@@ -3587,9 +3613,10 @@ epoll_shutdown (struct MHD_Daemon *daemon)
3587 3613
3588 3614
3589/** 3615/**
3590 * Shutdown an http daemon 3616 * Shutdown an HTTP daemon.
3591 * 3617 *
3592 * @param daemon daemon to stop 3618 * @param daemon daemon to stop
3619 * @ingroup event
3593 */ 3620 */
3594void 3621void
3595MHD_stop_daemon (struct MHD_Daemon *daemon) 3622MHD_stop_daemon (struct MHD_Daemon *daemon)
@@ -3722,16 +3749,18 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
3722 * (not fully implemented!). 3749 * (not fully implemented!).
3723 * 3750 *
3724 * @param daemon what daemon to get information about 3751 * @param daemon what daemon to get information about
3725 * @param infoType what information is desired? 3752 * @param info_type what information is desired?
3726 * @param ... depends on infoType 3753 * @param ... depends on @a info_type
3727 * @return NULL if this information is not available 3754 * @return NULL if this information is not available
3728 * (or if the infoType is unknown) 3755 * (or if the @a info_type is unknown)
3756 * @ingroup specialized
3729 */ 3757 */
3730const union MHD_DaemonInfo * 3758const union MHD_DaemonInfo *
3731MHD_get_daemon_info (struct MHD_Daemon *daemon, 3759MHD_get_daemon_info (struct MHD_Daemon *daemon,
3732 enum MHD_DaemonInfoType infoType, ...) 3760 enum MHD_DaemonInfoType info_type,
3761 ...)
3733{ 3762{
3734 switch (infoType) 3763 switch (info_type)
3735 { 3764 {
3736 case MHD_DAEMON_INFO_KEY_SIZE: 3765 case MHD_DAEMON_INFO_KEY_SIZE:
3737 return NULL; /* no longer supported */ 3766 return NULL; /* no longer supported */
@@ -3750,19 +3779,20 @@ MHD_get_daemon_info (struct MHD_Daemon *daemon,
3750 3779
3751 3780
3752/** 3781/**
3753 * Sets the global error handler to a different implementation. "cb" 3782 * Sets the global error handler to a different implementation. @a cb
3754 * will only be called in the case of typically fatal, serious 3783 * will only be called in the case of typically fatal, serious
3755 * internal consistency issues. These issues should only arise in the 3784 * internal consistency issues. These issues should only arise in the
3756 * case of serious memory corruption or similar problems with the 3785 * case of serious memory corruption or similar problems with the
3757 * architecture. While "cb" is allowed to return and MHD will then 3786 * architecture. While @a cb is allowed to return and MHD will then
3758 * try to continue, this is never safe. 3787 * try to continue, this is never safe.
3759 * 3788 *
3760 * The default implementation that is used if no panic function is set 3789 * The default implementation that is used if no panic function is set
3761 * simply prints an error message and calls "abort". Alternative 3790 * simply prints an error message and calls `abort()`. Alternative
3762 * implementations might call "exit" or other similar functions. 3791 * implementations might call `exit()` or other similar functions.
3763 * 3792 *
3764 * @param cb new error handler 3793 * @param cb new error handler
3765 * @param cls passed to error handler 3794 * @param cls passed to @a cb
3795 * @ingroup logging
3766 */ 3796 */
3767void 3797void
3768MHD_set_panic_func (MHD_PanicCallback cb, void *cls) 3798MHD_set_panic_func (MHD_PanicCallback cb, void *cls)
@@ -3775,7 +3805,8 @@ MHD_set_panic_func (MHD_PanicCallback cb, void *cls)
3775/** 3805/**
3776 * Obtain the version of this library 3806 * Obtain the version of this library
3777 * 3807 *
3778 * @return static version string, e.g. "0.4.1" 3808 * @return static version string, e.g. "0.9.9"
3809 * @ingroup specialized
3779 */ 3810 */
3780const char * 3811const char *
3781MHD_get_version (void) 3812MHD_get_version (void)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 2c0e9526..77f6e3b1 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -348,6 +348,7 @@ check_nonce_nc (struct MHD_Connection *connection,
348 * @param connection The MHD connection structure 348 * @param connection The MHD connection structure
349 * @return NULL if no username could be found, a pointer 349 * @return NULL if no username could be found, a pointer
350 * to the username if found 350 * to the username if found
351 * @ingroup authentication
351 */ 352 */
352char * 353char *
353MHD_digest_auth_get_username(struct MHD_Connection *connection) 354MHD_digest_auth_get_username(struct MHD_Connection *connection)
@@ -539,8 +540,9 @@ check_argument_match (struct MHD_Connection *connection,
539 * @param password The password used in the authentication 540 * @param password The password used in the authentication
540 * @param nonce_timeout The amount of time for a nonce to be 541 * @param nonce_timeout The amount of time for a nonce to be
541 * invalid in seconds 542 * invalid in seconds
542 * @return MHD_YES if authenticated, MHD_NO if not, 543 * @return #MHD_YES if authenticated, #MHD_NO if not,
543 * MHD_INVALID_NONCE if nonce is invalid 544 * #MHD_INVALID_NONCE if nonce is invalid
545 * @ingroup authentication
544 */ 546 */
545int 547int
546MHD_digest_auth_check (struct MHD_Connection *connection, 548MHD_digest_auth_check (struct MHD_Connection *connection,
@@ -739,9 +741,10 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
739 * @param response reply to send; should contain the "access denied" 741 * @param response reply to send; should contain the "access denied"
740 * body; note that this function will set the "WWW Authenticate" 742 * body; note that this function will set the "WWW Authenticate"
741 * header and that the caller should not do this 743 * header and that the caller should not do this
742 * @param signal_stale MHD_YES if the nonce is invalid to add 744 * @param signal_stale #MHD_YES if the nonce is invalid to add
743 * 'stale=true' to the authentication header 745 * 'stale=true' to the authentication header
744 * @return MHD_YES on success, MHD_NO otherwise 746 * @return #MHD_YES on success, #MHD_NO otherwise
747 * @ingroup authentication
745 */ 748 */
746int 749int
747MHD_queue_auth_fail_response (struct MHD_Connection *connection, 750MHD_queue_auth_fail_response (struct MHD_Connection *connection,
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 6cd6d82d..dfdf2a50 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -244,10 +244,14 @@ struct MHD_PostProcessor
244 244
245 245
246/** 246/**
247 * Create a PostProcessor. 247 * Create a `struct MHD_PostProcessor`.
248 * 248 *
249 * A PostProcessor can be used to (incrementally) 249 * A `struct MHD_PostProcessor` can be used to (incrementally) parse
250 * parse the data portion of a POST request. 250 * the data portion of a POST request. Note that some buggy browsers
251 * fail to set the encoding type. If you want to support those, you
252 * may have to call #MHD_set_connection_value with the proper encoding
253 * type before creating a post processor (if no supported encoding
254 * type is set, this function will fail).
251 * 255 *
252 * @param connection the connection on which the POST is 256 * @param connection the connection on which the POST is
253 * happening (used to determine the POST format) 257 * happening (used to determine the POST format)
@@ -255,11 +259,14 @@ struct MHD_PostProcessor
255 * internal buffering (used only for the parsing, 259 * internal buffering (used only for the parsing,
256 * specifically the parsing of the keys). A 260 * specifically the parsing of the keys). A
257 * tiny value (256-1024) should be sufficient. 261 * tiny value (256-1024) should be sufficient.
258 * Do NOT use 0. 262 * Do NOT use a value smaller than 256. For good
259 * @param iter iterator to be called with the parsed data 263 * performance, use 32 or 64k (i.e. 65536).
260 * @param iter_cls first argument to iter 264 * @param iter iterator to be called with the parsed data,
265 * Must NOT be NULL.
266 * @param iter_cls first argument to @a iter
261 * @return NULL on error (out of memory, unsupported encoding), 267 * @return NULL on error (out of memory, unsupported encoding),
262 * otherwise a PP handle 268 * otherwise a PP handle
269 * @ingroup request
263 */ 270 */
264struct MHD_PostProcessor * 271struct MHD_PostProcessor *
265MHD_create_post_processor (struct MHD_Connection *connection, 272MHD_create_post_processor (struct MHD_Connection *connection,
@@ -1082,26 +1089,25 @@ END:
1082 1089
1083 1090
1084/** 1091/**
1085 * Parse and process POST data. 1092 * Parse and process POST data. Call this function when POST data is
1086 * Call this function when POST data is available 1093 * available (usually during an #MHD_AccessHandlerCallback) with the
1087 * (usually during an MHD_AccessHandlerCallback) 1094 * "upload_data" and "upload_data_size". Whenever possible, this will
1088 * with the upload_data and upload_data_size. 1095 * then cause calls to the #MHD_IncrementalKeyValueIterator.
1089 * Whenever possible, this will then cause calls
1090 * to the MHD_IncrementalKeyValueIterator.
1091 * 1096 *
1092 * @param pp the post processor 1097 * @param pp the post processor
1093 * @param post_data post_data_len bytes of POST data 1098 * @param post_data @a post_data_len bytes of POST data
1094 * @param post_data_len length of post_data 1099 * @param post_data_len length of @a post_data
1095 * @return MHD_YES on success, MHD_NO on error 1100 * @return #MHD_YES on success, #MHD_NO on error
1096 * (out-of-memory, iterator aborted, parse error) 1101 * (out-of-memory, iterator aborted, parse error)
1102 * @ingroup request
1097 */ 1103 */
1098int 1104int
1099MHD_post_process (struct MHD_PostProcessor *pp, 1105MHD_post_process (struct MHD_PostProcessor *pp,
1100 const char *post_data, size_t post_data_len) 1106 const char *post_data, size_t post_data_len)
1101{ 1107{
1102 if (post_data_len == 0) 1108 if (0 == post_data_len)
1103 return MHD_YES; 1109 return MHD_YES;
1104 if (pp == NULL) 1110 if (NULL == pp)
1105 return MHD_NO; 1111 return MHD_NO;
1106 if (0 == strncasecmp (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, pp->encoding, 1112 if (0 == strncasecmp (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, pp->encoding,
1107 strlen(MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) 1113 strlen(MHD_HTTP_POST_ENCODING_FORM_URLENCODED)))
@@ -1119,10 +1125,11 @@ MHD_post_process (struct MHD_PostProcessor *pp,
1119 * Release PostProcessor resources. 1125 * Release PostProcessor resources.
1120 * 1126 *
1121 * @param pp post processor context to destroy 1127 * @param pp post processor context to destroy
1122 * @return MHD_YES if processing completed nicely, 1128 * @return #MHD_YES if processing completed nicely,
1123 * MHD_NO if there were spurious characters / formatting 1129 * #MHD_NO if there were spurious characters / formatting
1124 * problems; it is common to ignore the return 1130 * problems; it is common to ignore the return
1125 * value of this function 1131 * value of this function
1132 * @ingroup request
1126 */ 1133 */
1127int 1134int
1128MHD_destroy_post_processor (struct MHD_PostProcessor *pp) 1135MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 5db03824..f6db5326 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -83,7 +83,8 @@ add_response_entry (struct MHD_Response *response,
83 * @param response response to add a header to 83 * @param response response to add a header to
84 * @param header the header to add 84 * @param header the header to add
85 * @param content value to add 85 * @param content value to add
86 * @return MHD_NO on error (i.e. invalid header or content format). 86 * @return #MHD_NO on error (i.e. invalid header or content format).
87 * @ingroup response
87 */ 88 */
88int 89int
89MHD_add_response_header (struct MHD_Response *response, 90MHD_add_response_header (struct MHD_Response *response,
@@ -102,7 +103,8 @@ MHD_add_response_header (struct MHD_Response *response,
102 * @param response response to remove a header from 103 * @param response response to remove a header from
103 * @param footer the footer to delete 104 * @param footer the footer to delete
104 * @param content value to delete 105 * @param content value to delete
105 * @return MHD_NO on error (i.e. invalid footer or content format). 106 * @return #MHD_NO on error (i.e. invalid footer or content format).
107 * @ingroup response
106 */ 108 */
107int 109int
108MHD_add_response_footer (struct MHD_Response *response, 110MHD_add_response_footer (struct MHD_Response *response,
@@ -116,16 +118,18 @@ MHD_add_response_footer (struct MHD_Response *response,
116 118
117 119
118/** 120/**
119 * Delete a header line from the response. 121 * Delete a header (or footer) line from the response.
120 * 122 *
121 * @param response response to remove a header from 123 * @param response response to remove a header from
122 * @param header the header to delete 124 * @param header the header to delete
123 * @param content value to delete 125 * @param content value to delete
124 * @return MHD_NO on error (no such header known) 126 * @return #MHD_NO on error (no such header known)
127 * @ingroup response
125 */ 128 */
126int 129int
127MHD_del_response_header (struct MHD_Response *response, 130MHD_del_response_header (struct MHD_Response *response,
128 const char *header, const char *content) 131 const char *header,
132 const char *content)
129{ 133{
130 struct MHD_HTTP_Header *pos; 134 struct MHD_HTTP_Header *pos;
131 struct MHD_HTTP_Header *prev; 135 struct MHD_HTTP_Header *prev;
@@ -156,13 +160,14 @@ MHD_del_response_header (struct MHD_Response *response,
156 160
157 161
158/** 162/**
159 * Get all of the headers added to a response. 163 * Get all of the headers (and footers) added to a response.
160 * 164 *
161 * @param response response to query 165 * @param response response to query
162 * @param iterator callback to call on each header; 166 * @param iterator callback to call on each header;
163 * maybe NULL (then just count headers) 167 * maybe NULL (then just count headers)
164 * @param iterator_cls extra argument to iterator 168 * @param iterator_cls extra argument to @a iterator
165 * @return number of entries iterated over 169 * @return number of entries iterated over
170 * @ingroup response
166 */ 171 */
167int 172int
168MHD_get_response_headers (struct MHD_Response *response, 173MHD_get_response_headers (struct MHD_Response *response,
@@ -184,11 +189,12 @@ MHD_get_response_headers (struct MHD_Response *response,
184 189
185 190
186/** 191/**
187 * Get a particular header from the response. 192 * Get a particular header (or footer) from the response.
188 * 193 *
189 * @param response response to query 194 * @param response response to query
190 * @param key which header to get 195 * @param key which header to get
191 * @return NULL if header does not exist 196 * @return NULL if header does not exist
197 * @ingroup response
192 */ 198 */
193const char * 199const char *
194MHD_get_response_header (struct MHD_Response *response, 200MHD_get_response_header (struct MHD_Response *response,
@@ -209,16 +215,17 @@ MHD_get_response_header (struct MHD_Response *response,
209 * Create a response object. The response object can be extended with 215 * Create a response object. The response object can be extended with
210 * header information and then be used any number of times. 216 * header information and then be used any number of times.
211 * 217 *
212 * @param size size of the data portion of the response, MHD_SIZE_UNKNOWN for unknown 218 * @param size size of the data portion of the response, #MHD_SIZE_UNKNOWN for unknown
213 * @param block_size preferred block size for querying crc (advisory only, 219 * @param block_size preferred block size for querying crc (advisory only,
214 * MHD may still call crc using smaller chunks); this 220 * MHD may still call @a crc using smaller chunks); this
215 * is essentially the buffer size used for IO, clients 221 * is essentially the buffer size used for IO, clients
216 * should pick a value that is appropriate for IO and 222 * should pick a value that is appropriate for IO and
217 * memory performance requirements 223 * memory performance requirements
218 * @param crc callback to use to obtain response data 224 * @param crc callback to use to obtain response data
219 * @param crc_cls extra argument to crc 225 * @param crc_cls extra argument to @a crc
220 * @param crfc callback to call to free crc_cls resources 226 * @param crfc callback to call to free @a crc_cls resources
221 * @return NULL on error (i.e. invalid arguments, out of memory) 227 * @return NULL on error (i.e. invalid arguments, out of memory)
228 * @ingroup response
222 */ 229 */
223struct MHD_Response * 230struct MHD_Response *
224MHD_create_response_from_callback (uint64_t size, 231MHD_create_response_from_callback (uint64_t size,
@@ -298,13 +305,21 @@ free_callback (void *cls)
298 * header information and then be used any number of times. 305 * header information and then be used any number of times.
299 * 306 *
300 * @param size size of the data portion of the response 307 * @param size size of the data portion of the response
301 * @param fd file descriptor referring to a file on disk with the data 308 * @param fd file descriptor referring to a file on disk with the
302 * @param offset offset to start reading from in the file 309 * data; will be closed when response is destroyed;
310 * fd should be in 'blocking' mode
311 * @param offset offset to start reading from in the file;
312 * Be careful! `off_t` may have been compiled to be a
313 * 64-bit variable for MHD, in which case your application
314 * also has to be compiled using the same options! Read
315 * the MHD manual for more details.
303 * @return NULL on error (i.e. invalid arguments, out of memory) 316 * @return NULL on error (i.e. invalid arguments, out of memory)
317 * @ingroup response
304 */ 318 */
305struct MHD_Response *MHD_create_response_from_fd_at_offset (size_t size, 319struct MHD_Response *
306 int fd, 320MHD_create_response_from_fd_at_offset (size_t size,
307 off_t offset) 321 int fd,
322 off_t offset)
308{ 323{
309 struct MHD_Response *response; 324 struct MHD_Response *response;
310 325
@@ -329,9 +344,11 @@ struct MHD_Response *MHD_create_response_from_fd_at_offset (size_t size,
329 * @param size size of the data portion of the response 344 * @param size size of the data portion of the response
330 * @param fd file descriptor referring to a file on disk with the data 345 * @param fd file descriptor referring to a file on disk with the data
331 * @return NULL on error (i.e. invalid arguments, out of memory) 346 * @return NULL on error (i.e. invalid arguments, out of memory)
347 * @ingroup response
332 */ 348 */
333struct MHD_Response *MHD_create_response_from_fd (size_t size, 349struct MHD_Response *
334 int fd) 350MHD_create_response_from_fd (size_t size,
351 int fd)
335{ 352{
336 return MHD_create_response_from_fd_at_offset (size, fd, 0); 353 return MHD_create_response_from_fd_at_offset (size, fd, 0);
337} 354}
@@ -341,14 +358,15 @@ struct MHD_Response *MHD_create_response_from_fd (size_t size,
341 * Create a response object. The response object can be extended with 358 * Create a response object. The response object can be extended with
342 * header information and then be used any number of times. 359 * header information and then be used any number of times.
343 * 360 *
344 * @param size size of the data portion of the response 361 * @param size size of the @a data portion of the response
345 * @param data the data itself 362 * @param data the data itself
346 * @param must_free libmicrohttpd should free data when done 363 * @param must_free libmicrohttpd should free data when done
347 * @param must_copy libmicrohttpd must make a copy of data 364 * @param must_copy libmicrohttpd must make a copy of @a data
348 * right away, the data maybe released anytime after 365 * right away, the data maybe released anytime after
349 * this call returns 366 * this call returns
350 * @return NULL on error (i.e. invalid arguments, out of memory) 367 * @return NULL on error (i.e. invalid arguments, out of memory)
351 * @deprecated use MHD_create_response_from_buffer instead 368 * @deprecated use #MHD_create_response_from_buffer instead
369 * @ingroup response
352 */ 370 */
353struct MHD_Response * 371struct MHD_Response *
354MHD_create_response_from_data (size_t size, 372MHD_create_response_from_data (size_t size,
@@ -399,6 +417,7 @@ MHD_create_response_from_data (size_t size,
399 * @param buffer size bytes containing the response's data portion 417 * @param buffer size bytes containing the response's data portion
400 * @param mode flags for buffer management 418 * @param mode flags for buffer management
401 * @return NULL on error (i.e. invalid arguments, out of memory) 419 * @return NULL on error (i.e. invalid arguments, out of memory)
420 * @ingroup response
402 */ 421 */
403struct MHD_Response * 422struct MHD_Response *
404MHD_create_response_from_buffer (size_t size, 423MHD_create_response_from_buffer (size_t size,
@@ -417,6 +436,9 @@ MHD_create_response_from_buffer (size_t size,
417 * libmicrohttpd may keep some of the resources around if the response 436 * libmicrohttpd may keep some of the resources around if the response
418 * is still in the queue for some clients, so the memory may not 437 * is still in the queue for some clients, so the memory may not
419 * necessarily be freed immediatley. 438 * necessarily be freed immediatley.
439 *
440 * @param response response to destroy
441 * @ingroup response
420 */ 442 */
421void 443void
422MHD_destroy_response (struct MHD_Response *response) 444MHD_destroy_response (struct MHD_Response *response)