aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/examples/sessions.c3
-rw-r--r--src/daemon/basicauth.c6
-rw-r--r--src/daemon/connection.c2
-rw-r--r--src/daemon/daemon.c94
-rw-r--r--src/daemon/digestauth.c3
-rw-r--r--src/daemon/internal.c1
-rw-r--r--src/daemon/internal.h5
-rw-r--r--src/daemon/memorypool.c11
-rw-r--r--src/daemon/memorypool.h7
-rw-r--r--src/daemon/postprocessor.c51
-rw-r--r--src/daemon/response.c7
-rw-r--r--src/daemon/test_daemon.c2
-rw-r--r--src/daemon/test_postprocessor.c2
-rw-r--r--src/daemon/test_postprocessor_large.c2
-rw-r--r--src/examples/https_fileserver_example.c2
-rw-r--r--src/examples/post_example.c4
-rw-r--r--src/include/microhttpd.h17
-rw-r--r--src/include/plibc/plibc.h2
-rw-r--r--src/testcurl/https/tls_test_common.c5
-rw-r--r--src/testcurl/https/tls_test_common.h8
20 files changed, 148 insertions, 86 deletions
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index eff035df..870f9249 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -522,6 +522,7 @@ post_iterator (void *cls,
522 * 522 *
523 * @param cls argument given together with the function 523 * @param cls argument given together with the function
524 * pointer when the handler was registered with MHD 524 * pointer when the handler was registered with MHD
525 * @param connection handle to connection which is being processed
525 * @param url the requested url 526 * @param url the requested url
526 * @param method the HTTP method used ("GET", "PUT", etc.) 527 * @param method the HTTP method used ("GET", "PUT", etc.)
527 * @param version the HTTP version string (i.e. "HTTP/1.1") 528 * @param version the HTTP version string (i.e. "HTTP/1.1")
@@ -535,7 +536,7 @@ post_iterator (void *cls,
535 * @param upload_data_size set initially to the size of the 536 * @param upload_data_size set initially to the size of the
536 * upload_data provided; the method must update this 537 * upload_data provided; the method must update this
537 * value to the number of bytes NOT processed; 538 * value to the number of bytes NOT processed;
538 * @param con_cls pointer that the callback can set to some 539 * @param ptr pointer that the callback can set to some
539 * address and that will be preserved by MHD for future 540 * address and that will be preserved by MHD for future
540 * calls for this request; since the access handler may 541 * calls for this request; since the access handler may
541 * be called many times (i.e., for a PUT/POST operation 542 * be called many times (i.e., for a PUT/POST operation
diff --git a/src/daemon/basicauth.c b/src/daemon/basicauth.c
index 06d006e0..e8a69e7d 100644
--- a/src/daemon/basicauth.c
+++ b/src/daemon/basicauth.c
@@ -100,10 +100,14 @@ MHD_basic_auth_get_username_password(struct MHD_Connection *connection,
100 100
101 101
102/** 102/**
103 * Queues a response to request basic authentication from the client 103 * Queues a response to request basic authentication from the client.
104 * The given response object is expected to include the payload for
105 * the response; the "WWW-Authenticate" header will be added and the
106 * response queued with the 'UNAUTHORIZED' status code.
104 * 107 *
105 * @param connection The MHD connection structure 108 * @param connection The MHD connection structure
106 * @param realm the realm presented to the client 109 * @param realm the realm presented to the client
110 * @param response response object to modify and queue
107 * @return MHD_YES on success, MHD_NO otherwise 111 * @return MHD_YES on success, MHD_NO otherwise
108 */ 112 */
109int 113int
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index 7b04a661..728da12d 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -1107,7 +1107,7 @@ get_next_header_line (struct MHD_Connection *connection)
1107 } 1107 }
1108 return NULL; 1108 return NULL;
1109 } 1109 }
1110 /* found, check if we have proper CRLF */ 1110 /* found, check if we have proper LFCR */
1111 if (('\r' == rbuf[pos]) && ('\n' == rbuf[pos + 1])) 1111 if (('\r' == rbuf[pos]) && ('\n' == rbuf[pos + 1]))
1112 rbuf[pos++] = '\0'; /* skip both r and n */ 1112 rbuf[pos++] = '\0'; /* skip both r and n */
1113 rbuf[pos++] = '\0'; 1113 rbuf[pos++] = '\0';
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 9bc5502b..ef69d14b 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -95,7 +95,7 @@
95 * @param cls unused 95 * @param cls unused
96 * @param file name of the file with the problem 96 * @param file name of the file with the problem
97 * @param line line number with the problem 97 * @param line line number with the problem
98 * @param msg error message with details 98 * @param reason error message with details
99 */ 99 */
100static void 100static void
101mhd_panic_std (void *cls, 101mhd_panic_std (void *cls,
@@ -722,7 +722,7 @@ exit:
722/** 722/**
723 * Callback for receiving data from the socket. 723 * Callback for receiving data from the socket.
724 * 724 *
725 * @param conn the MHD connection structure 725 * @param connection the MHD connection structure
726 * @param other where to write received data to 726 * @param other where to write received data to
727 * @param i maximum size of other (in bytes) 727 * @param i maximum size of other (in bytes)
728 * @return number of bytes actually received 728 * @return number of bytes actually received
@@ -747,7 +747,7 @@ recv_param_adapter (struct MHD_Connection *connection,
747/** 747/**
748 * Callback for writing data to the socket. 748 * Callback for writing data to the socket.
749 * 749 *
750 * @param conn the MHD connection structure 750 * @param connection the MHD connection structure
751 * @param other data to write 751 * @param other data to write
752 * @param i number of bytes to write 752 * @param i number of bytes to write
753 * @return actual number of bytes written 753 * @return actual number of bytes written
@@ -803,6 +803,9 @@ send_param_adapter (struct MHD_Connection *connection,
803 803
804/** 804/**
805 * Signature of main function for a thread. 805 * Signature of main function for a thread.
806 *
807 * @param cls closure argument for the function
808 * @return termination code from the thread
806 */ 809 */
807typedef void *(*ThreadStartRoutine)(void *cls); 810typedef void *(*ThreadStartRoutine)(void *cls);
808 811
@@ -817,7 +820,7 @@ typedef void *(*ThreadStartRoutine)(void *cls);
817 * @return 0 on success 820 * @return 0 on success
818 */ 821 */
819static int 822static int
820create_thread (pthread_t * thread, 823create_thread (pthread_t *thread,
821 const struct MHD_Daemon *daemon, 824 const struct MHD_Daemon *daemon,
822 ThreadStartRoutine start_routine, 825 ThreadStartRoutine start_routine,
823 void *arg) 826 void *arg)
@@ -1057,29 +1060,22 @@ MHD_add_connection (struct MHD_Daemon *daemon,
1057 gnutls_transport_set_ptr (connection->tls_session, 1060 gnutls_transport_set_ptr (connection->tls_session,
1058 (gnutls_transport_ptr_t) connection); 1061 (gnutls_transport_ptr_t) connection);
1059 gnutls_transport_set_pull_function (connection->tls_session, 1062 gnutls_transport_set_pull_function (connection->tls_session,
1060 (gnutls_pull_func) & 1063 (gnutls_pull_func) &recv_param_adapter);
1061 recv_param_adapter);
1062 gnutls_transport_set_push_function (connection->tls_session, 1064 gnutls_transport_set_push_function (connection->tls_session,
1063 (gnutls_push_func) & 1065 (gnutls_push_func) &send_param_adapter);
1064 send_param_adapter);
1065 1066
1066 if (daemon->https_mem_trust){ 1067 if (daemon->https_mem_trust)
1067 gnutls_certificate_server_set_request(connection->tls_session, GNUTLS_CERT_REQUEST); 1068 gnutls_certificate_server_set_request(connection->tls_session, GNUTLS_CERT_REQUEST);
1068 }
1069 } 1069 }
1070#endif 1070#endif
1071 1071
1072 if (0 != pthread_mutex_lock(&daemon->cleanup_connection_mutex)) 1072 if (0 != pthread_mutex_lock(&daemon->cleanup_connection_mutex))
1073 { 1073 MHD_PANIC ("Failed to acquire cleanup mutex\n");
1074 MHD_PANIC ("Failed to acquire cleanup mutex\n");
1075 }
1076 DLL_insert (daemon->connections_head, 1074 DLL_insert (daemon->connections_head,
1077 daemon->connections_tail, 1075 daemon->connections_tail,
1078 connection); 1076 connection);
1079 if (0 != pthread_mutex_unlock(&daemon->cleanup_connection_mutex)) 1077 if (0 != pthread_mutex_unlock(&daemon->cleanup_connection_mutex))
1080 { 1078 MHD_PANIC ("Failed to release cleanup mutex\n");
1081 MHD_PANIC ("Failed to release cleanup mutex\n");
1082 }
1083 1079
1084 /* attempt to create handler thread */ 1080 /* attempt to create handler thread */
1085 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) 1081 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
@@ -1742,6 +1738,7 @@ MHD_select_thread (void *cls)
1742/** 1738/**
1743 * Start a webserver on the given port. 1739 * Start a webserver on the given port.
1744 * 1740 *
1741 * @param flags combination of MHD_FLAG values
1745 * @param port port to bind to 1742 * @param port port to bind to
1746 * @param apc callback to call to check which clients 1743 * @param apc callback to call to check which clients
1747 * will be allowed to connect 1744 * will be allowed to connect
@@ -1751,7 +1748,7 @@ MHD_select_thread (void *cls)
1751 * @return NULL on error, handle to daemon on success 1748 * @return NULL on error, handle to daemon on success
1752 */ 1749 */
1753struct MHD_Daemon * 1750struct MHD_Daemon *
1754MHD_start_daemon (unsigned int options, 1751MHD_start_daemon (unsigned int flags,
1755 uint16_t port, 1752 uint16_t port,
1756 MHD_AcceptPolicyCallback apc, 1753 MHD_AcceptPolicyCallback apc,
1757 void *apc_cls, 1754 void *apc_cls,
@@ -1761,7 +1758,7 @@ MHD_start_daemon (unsigned int options,
1761 va_list ap; 1758 va_list ap;
1762 1759
1763 va_start (ap, dh_cls); 1760 va_start (ap, dh_cls);
1764 daemon = MHD_start_daemon_va (options, port, apc, apc_cls, dh, dh_cls, ap); 1761 daemon = MHD_start_daemon_va (flags, port, apc, apc_cls, dh, dh_cls, ap);
1765 va_end (ap); 1762 va_end (ap);
1766 return daemon; 1763 return daemon;
1767} 1764}
@@ -2163,16 +2160,19 @@ create_socket (int domain, int type, int protocol)
2163/** 2160/**
2164 * Start a webserver on the given port. 2161 * Start a webserver on the given port.
2165 * 2162 *
2163 * @param flags combination of MHD_FLAG values
2166 * @param port port to bind to 2164 * @param port port to bind to
2167 * @param apc callback to call to check which clients 2165 * @param apc callback to call to check which clients
2168 * will be allowed to connect 2166 * will be allowed to connect
2169 * @param apc_cls extra argument to apc 2167 * @param apc_cls extra argument to apc
2170 * @param dh default handler for all URIs 2168 * @param dh default handler for all URIs
2171 * @param dh_cls extra argument to dh 2169 * @param dh_cls extra argument to dh
2170 * @param ap list of options (type-value pairs,
2171 * terminated with MHD_OPTION_END).
2172 * @return NULL on error, handle to daemon on success 2172 * @return NULL on error, handle to daemon on success
2173 */ 2173 */
2174struct MHD_Daemon * 2174struct MHD_Daemon *
2175MHD_start_daemon_va (unsigned int options, 2175MHD_start_daemon_va (unsigned int flags,
2176 uint16_t port, 2176 uint16_t port,
2177 MHD_AcceptPolicyCallback apc, 2177 MHD_AcceptPolicyCallback apc,
2178 void *apc_cls, 2178 void *apc_cls,
@@ -2193,15 +2193,15 @@ MHD_start_daemon_va (unsigned int options,
2193 int use_pipe; 2193 int use_pipe;
2194 2194
2195#ifndef HAVE_INET6 2195#ifndef HAVE_INET6
2196 if (0 != (options & MHD_USE_IPv6)) 2196 if (0 != (flags & MHD_USE_IPv6))
2197 return NULL; 2197 return NULL;
2198#endif 2198#endif
2199#ifndef HAVE_POLL_H 2199#ifndef HAVE_POLL_H
2200 if (0 != (options & MHD_USE_POLL)) 2200 if (0 != (flags & MHD_USE_POLL))
2201 return NULL; 2201 return NULL;
2202#endif 2202#endif
2203#if ! HTTPS_SUPPORT 2203#if ! HTTPS_SUPPORT
2204 if (0 != (options & MHD_USE_SSL)) 2204 if (0 != (flags & MHD_USE_SSL))
2205 return NULL; 2205 return NULL;
2206#endif 2206#endif
2207 if (NULL == dh) 2207 if (NULL == dh)
@@ -2211,7 +2211,7 @@ MHD_start_daemon_va (unsigned int options,
2211 memset (daemon, 0, sizeof (struct MHD_Daemon)); 2211 memset (daemon, 0, sizeof (struct MHD_Daemon));
2212 /* try to open listen socket */ 2212 /* try to open listen socket */
2213#if HTTPS_SUPPORT 2213#if HTTPS_SUPPORT
2214 if (0 != (options & MHD_USE_SSL)) 2214 if (0 != (flags & MHD_USE_SSL))
2215 { 2215 {
2216 gnutls_priority_init (&daemon->priority_cache, 2216 gnutls_priority_init (&daemon->priority_cache,
2217 "NORMAL", 2217 "NORMAL",
@@ -2219,7 +2219,7 @@ MHD_start_daemon_va (unsigned int options,
2219 } 2219 }
2220#endif 2220#endif
2221 daemon->socket_fd = -1; 2221 daemon->socket_fd = -1;
2222 daemon->options = (enum MHD_OPTION) options; 2222 daemon->options = (enum MHD_OPTION) flags;
2223 daemon->port = port; 2223 daemon->port = port;
2224 daemon->apc = apc; 2224 daemon->apc = apc;
2225 daemon->apc_cls = apc_cls; 2225 daemon->apc_cls = apc_cls;
@@ -2252,7 +2252,7 @@ MHD_start_daemon_va (unsigned int options,
2252 return NULL; 2252 return NULL;
2253 } 2253 }
2254#ifndef WINDOWS 2254#ifndef WINDOWS
2255 if ( (0 == (options & MHD_USE_POLL)) && 2255 if ( (0 == (flags & MHD_USE_POLL)) &&
2256 (daemon->wpipe[0] >= FD_SETSIZE) ) 2256 (daemon->wpipe[0] >= FD_SETSIZE) )
2257 { 2257 {
2258#if HAVE_MESSAGES 2258#if HAVE_MESSAGES
@@ -2271,7 +2271,7 @@ MHD_start_daemon_va (unsigned int options,
2271 daemon->nonce_nc_size = 4; /* tiny */ 2271 daemon->nonce_nc_size = 4; /* tiny */
2272#endif 2272#endif
2273#if HTTPS_SUPPORT 2273#if HTTPS_SUPPORT
2274 if (0 != (options & MHD_USE_SSL)) 2274 if (0 != (flags & MHD_USE_SSL))
2275 { 2275 {
2276 daemon->cred_type = GNUTLS_CRD_CERTIFICATE; 2276 daemon->cred_type = GNUTLS_CRD_CERTIFICATE;
2277 } 2277 }
@@ -2281,7 +2281,7 @@ MHD_start_daemon_va (unsigned int options,
2281 if (MHD_YES != parse_options_va (daemon, &servaddr, ap)) 2281 if (MHD_YES != parse_options_va (daemon, &servaddr, ap))
2282 { 2282 {
2283#if HTTPS_SUPPORT 2283#if HTTPS_SUPPORT
2284 if ( (0 != (options & MHD_USE_SSL)) && 2284 if ( (0 != (flags & MHD_USE_SSL)) &&
2285 (NULL != daemon->priority_cache) ) 2285 (NULL != daemon->priority_cache) )
2286 gnutls_priority_deinit (daemon->priority_cache); 2286 gnutls_priority_deinit (daemon->priority_cache);
2287#endif 2287#endif
@@ -2299,7 +2299,7 @@ MHD_start_daemon_va (unsigned int options,
2299 "Specified value for NC_SIZE too large\n"); 2299 "Specified value for NC_SIZE too large\n");
2300#endif 2300#endif
2301#if HTTPS_SUPPORT 2301#if HTTPS_SUPPORT
2302 if (0 != (options & MHD_USE_SSL)) 2302 if (0 != (flags & MHD_USE_SSL))
2303 gnutls_priority_deinit (daemon->priority_cache); 2303 gnutls_priority_deinit (daemon->priority_cache);
2304#endif 2304#endif
2305 free (daemon); 2305 free (daemon);
@@ -2314,7 +2314,7 @@ MHD_start_daemon_va (unsigned int options,
2314 STRERROR (errno)); 2314 STRERROR (errno));
2315#endif 2315#endif
2316#if HTTPS_SUPPORT 2316#if HTTPS_SUPPORT
2317 if (0 != (options & MHD_USE_SSL)) 2317 if (0 != (flags & MHD_USE_SSL))
2318 gnutls_priority_deinit (daemon->priority_cache); 2318 gnutls_priority_deinit (daemon->priority_cache);
2319#endif 2319#endif
2320 free (daemon); 2320 free (daemon);
@@ -2329,7 +2329,7 @@ MHD_start_daemon_va (unsigned int options,
2329 "MHD failed to initialize nonce-nc mutex\n"); 2329 "MHD failed to initialize nonce-nc mutex\n");
2330#endif 2330#endif
2331#if HTTPS_SUPPORT 2331#if HTTPS_SUPPORT
2332 if (0 != (options & MHD_USE_SSL)) 2332 if (0 != (flags & MHD_USE_SSL))
2333 gnutls_priority_deinit (daemon->priority_cache); 2333 gnutls_priority_deinit (daemon->priority_cache);
2334#endif 2334#endif
2335 free (daemon->nnc); 2335 free (daemon->nnc);
@@ -2339,7 +2339,7 @@ MHD_start_daemon_va (unsigned int options,
2339#endif 2339#endif
2340 2340
2341 /* Thread pooling currently works only with internal select thread model */ 2341 /* Thread pooling currently works only with internal select thread model */
2342 if ( (0 == (options & MHD_USE_SELECT_INTERNALLY)) && 2342 if ( (0 == (flags & MHD_USE_SELECT_INTERNALLY)) &&
2343 (daemon->worker_pool_size > 0) ) 2343 (daemon->worker_pool_size > 0) )
2344 { 2344 {
2345#if HAVE_MESSAGES 2345#if HAVE_MESSAGES
@@ -2350,7 +2350,7 @@ MHD_start_daemon_va (unsigned int options,
2350 } 2350 }
2351 2351
2352#ifdef __SYMBIAN32__ 2352#ifdef __SYMBIAN32__
2353 if (0 != (options & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) 2353 if (0 != (flags & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION)))
2354 { 2354 {
2355#if HAVE_MESSAGES 2355#if HAVE_MESSAGES
2356 MHD_DLOG (daemon, 2356 MHD_DLOG (daemon,
@@ -2363,14 +2363,14 @@ MHD_start_daemon_va (unsigned int options,
2363 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) 2363 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) )
2364 { 2364 {
2365 /* try to open listen socket */ 2365 /* try to open listen socket */
2366 if ((options & MHD_USE_IPv6) != 0) 2366 if ((flags & MHD_USE_IPv6) != 0)
2367 socket_fd = create_socket (PF_INET6, SOCK_STREAM, 0); 2367 socket_fd = create_socket (PF_INET6, SOCK_STREAM, 0);
2368 else 2368 else
2369 socket_fd = create_socket (PF_INET, SOCK_STREAM, 0); 2369 socket_fd = create_socket (PF_INET, SOCK_STREAM, 0);
2370 if (-1 == socket_fd) 2370 if (-1 == socket_fd)
2371 { 2371 {
2372#if HAVE_MESSAGES 2372#if HAVE_MESSAGES
2373 if (0 != (options & MHD_USE_DEBUG)) 2373 if (0 != (flags & MHD_USE_DEBUG))
2374 MHD_DLOG (daemon, 2374 MHD_DLOG (daemon,
2375 "Call to socket failed: %s\n", 2375 "Call to socket failed: %s\n",
2376 STRERROR (errno)); 2376 STRERROR (errno));
@@ -2380,7 +2380,7 @@ MHD_start_daemon_va (unsigned int options,
2380 if ((SETSOCKOPT (socket_fd, 2380 if ((SETSOCKOPT (socket_fd,
2381 SOL_SOCKET, 2381 SOL_SOCKET,
2382 SO_REUSEADDR, 2382 SO_REUSEADDR,
2383 &on, sizeof (on)) < 0) && ((options & MHD_USE_DEBUG) != 0)) 2383 &on, sizeof (on)) < 0) && ((flags & MHD_USE_DEBUG) != 0))
2384 { 2384 {
2385#if HAVE_MESSAGES 2385#if HAVE_MESSAGES
2386 MHD_DLOG (daemon, 2386 MHD_DLOG (daemon,
@@ -2391,7 +2391,7 @@ MHD_start_daemon_va (unsigned int options,
2391 2391
2392 /* check for user supplied sockaddr */ 2392 /* check for user supplied sockaddr */
2393#if HAVE_INET6 2393#if HAVE_INET6
2394 if (0 != (options & MHD_USE_IPv6)) 2394 if (0 != (flags & MHD_USE_IPv6))
2395 addrlen = sizeof (struct sockaddr_in6); 2395 addrlen = sizeof (struct sockaddr_in6);
2396 else 2396 else
2397#endif 2397#endif
@@ -2399,7 +2399,7 @@ MHD_start_daemon_va (unsigned int options,
2399 if (NULL == servaddr) 2399 if (NULL == servaddr)
2400 { 2400 {
2401#if HAVE_INET6 2401#if HAVE_INET6
2402 if (0 != (options & MHD_USE_IPv6)) 2402 if (0 != (flags & MHD_USE_IPv6))
2403 { 2403 {
2404 memset (&servaddr6, 0, sizeof (struct sockaddr_in6)); 2404 memset (&servaddr6, 0, sizeof (struct sockaddr_in6));
2405 servaddr6.sin6_family = AF_INET6; 2405 servaddr6.sin6_family = AF_INET6;
@@ -2423,7 +2423,7 @@ MHD_start_daemon_va (unsigned int options,
2423 } 2423 }
2424 daemon->socket_fd = socket_fd; 2424 daemon->socket_fd = socket_fd;
2425 2425
2426 if (0 != (options & MHD_USE_IPv6)) 2426 if (0 != (flags & MHD_USE_IPv6))
2427 { 2427 {
2428#ifdef IPPROTO_IPV6 2428#ifdef IPPROTO_IPV6
2429#ifdef IPV6_V6ONLY 2429#ifdef IPV6_V6ONLY
@@ -2448,7 +2448,7 @@ MHD_start_daemon_va (unsigned int options,
2448 if (-1 == BIND (socket_fd, servaddr, addrlen)) 2448 if (-1 == BIND (socket_fd, servaddr, addrlen))
2449 { 2449 {
2450#if HAVE_MESSAGES 2450#if HAVE_MESSAGES
2451 if (0 != (options & MHD_USE_DEBUG)) 2451 if (0 != (flags & MHD_USE_DEBUG))
2452 MHD_DLOG (daemon, 2452 MHD_DLOG (daemon,
2453 "Failed to bind to port %u: %s\n", 2453 "Failed to bind to port %u: %s\n",
2454 (unsigned int) port, 2454 (unsigned int) port,
@@ -2461,7 +2461,7 @@ MHD_start_daemon_va (unsigned int options,
2461 if (LISTEN (socket_fd, 20) < 0) 2461 if (LISTEN (socket_fd, 20) < 0)
2462 { 2462 {
2463#if HAVE_MESSAGES 2463#if HAVE_MESSAGES
2464 if (0 != (options & MHD_USE_DEBUG)) 2464 if (0 != (flags & MHD_USE_DEBUG))
2465 MHD_DLOG (daemon, 2465 MHD_DLOG (daemon,
2466 "Failed to listen for connections: %s\n", 2466 "Failed to listen for connections: %s\n",
2467 STRERROR (errno)); 2467 STRERROR (errno));
@@ -2476,10 +2476,10 @@ MHD_start_daemon_va (unsigned int options,
2476 } 2476 }
2477#ifndef WINDOWS 2477#ifndef WINDOWS
2478 if ( (socket_fd >= FD_SETSIZE) && 2478 if ( (socket_fd >= FD_SETSIZE) &&
2479 (0 == (options & MHD_USE_POLL)) ) 2479 (0 == (flags & MHD_USE_POLL)) )
2480 { 2480 {
2481#if HAVE_MESSAGES 2481#if HAVE_MESSAGES
2482 if ((options & MHD_USE_DEBUG) != 0) 2482 if ((flags & MHD_USE_DEBUG) != 0)
2483 MHD_DLOG (daemon, 2483 MHD_DLOG (daemon,
2484 "Socket descriptor larger than FD_SETSIZE: %d > %d\n", 2484 "Socket descriptor larger than FD_SETSIZE: %d > %d\n",
2485 socket_fd, 2485 socket_fd,
@@ -2514,7 +2514,7 @@ MHD_start_daemon_va (unsigned int options,
2514 2514
2515#if HTTPS_SUPPORT 2515#if HTTPS_SUPPORT
2516 /* initialize HTTPS daemon certificate aspects & send / recv functions */ 2516 /* initialize HTTPS daemon certificate aspects & send / recv functions */
2517 if ((0 != (options & MHD_USE_SSL)) && (0 != MHD_TLS_init (daemon))) 2517 if ((0 != (flags & MHD_USE_SSL)) && (0 != MHD_TLS_init (daemon)))
2518 { 2518 {
2519#if HAVE_MESSAGES 2519#if HAVE_MESSAGES
2520 MHD_DLOG (daemon, 2520 MHD_DLOG (daemon,
@@ -2527,8 +2527,8 @@ MHD_start_daemon_va (unsigned int options,
2527 goto free_and_fail; 2527 goto free_and_fail;
2528 } 2528 }
2529#endif 2529#endif
2530 if ( ( (0 != (options & MHD_USE_THREAD_PER_CONNECTION)) || 2530 if ( ( (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) ||
2531 ( (0 != (options & MHD_USE_SELECT_INTERNALLY)) && 2531 ( (0 != (flags & MHD_USE_SELECT_INTERNALLY)) &&
2532 (0 == daemon->worker_pool_size)) ) && 2532 (0 == daemon->worker_pool_size)) ) &&
2533 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) && 2533 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) &&
2534 (0 != (res_thread_create = 2534 (0 != (res_thread_create =
@@ -2671,7 +2671,7 @@ thread_failed:
2671 pthread_mutex_destroy (&daemon->nnc_lock); 2671 pthread_mutex_destroy (&daemon->nnc_lock);
2672#endif 2672#endif
2673#if HTTPS_SUPPORT 2673#if HTTPS_SUPPORT
2674 if (0 != (options & MHD_USE_SSL)) 2674 if (0 != (flags & MHD_USE_SSL))
2675 gnutls_priority_deinit (daemon->priority_cache); 2675 gnutls_priority_deinit (daemon->priority_cache);
2676#endif 2676#endif
2677 free (daemon); 2677 free (daemon);
diff --git a/src/daemon/digestauth.c b/src/daemon/digestauth.c
index 3143ea5c..d6c26114 100644
--- a/src/daemon/digestauth.c
+++ b/src/daemon/digestauth.c
@@ -736,6 +736,9 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
736 * @param connection The MHD connection structure 736 * @param connection The MHD connection structure
737 * @param realm the realm presented to the client 737 * @param realm the realm presented to the client
738 * @param opaque string to user for opaque value 738 * @param opaque string to user for opaque value
739 * @param response reply to send; should contain the "access denied"
740 * body; note that this function will set the "WWW Authenticate"
741 * header and that the caller should not do this
739 * @param signal_stale MHD_YES if the nonce is invalid to add 742 * @param signal_stale MHD_YES if the nonce is invalid to add
740 * 'stale=true' to the authentication header 743 * 'stale=true' to the authentication header
741 * @return MHD_YES on success, MHD_NO otherwise 744 * @return MHD_YES on success, MHD_NO otherwise
diff --git a/src/daemon/internal.c b/src/daemon/internal.c
index 453634e8..1730c0c9 100644
--- a/src/daemon/internal.c
+++ b/src/daemon/internal.c
@@ -111,6 +111,7 @@ MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...)
111 * 111 *
112 * @param cls closure (use NULL) 112 * @param cls closure (use NULL)
113 * @param connection handle to connection, not used 113 * @param connection handle to connection, not used
114 * @param val value to unescape (modified in the process)
114 * @return length of the resulting val (strlen(val) maybe 115 * @return length of the resulting val (strlen(val) maybe
115 * shorter afterwards due to elimination of escape sequences) 116 * shorter afterwards due to elimination of escape sequences)
116 */ 117 */
diff --git a/src/daemon/internal.h b/src/daemon/internal.h
index 13f4ddaf..f76d6834 100644
--- a/src/daemon/internal.h
+++ b/src/daemon/internal.h
@@ -57,14 +57,14 @@ extern void *mhd_panic_cls;
57/** 57/**
58 * Trigger 'panic' action based on fatal errors. 58 * Trigger 'panic' action based on fatal errors.
59 * 59 *
60 * @param error message (const char *) 60 * @param msg error message (const char *)
61 */ 61 */
62#define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg) 62#define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg)
63#else 63#else
64/** 64/**
65 * Trigger 'panic' action based on fatal errors. 65 * Trigger 'panic' action based on fatal errors.
66 * 66 *
67 * @param error message (const char *) 67 * @param msg error message (const char *)
68 */ 68 */
69#define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL) 69#define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL)
70#endif 70#endif
@@ -156,6 +156,7 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
156 * 156 *
157 * @param cls closure (use NULL) 157 * @param cls closure (use NULL)
158 * @param connection handle to connection, not used 158 * @param connection handle to connection, not used
159 * @param val value to unescape (modified in the process)
159 * @return length of the resulting val (strlen(val) maybe 160 * @return length of the resulting val (strlen(val) maybe
160 * shorter afterwards due to elimination of escape sequences) 161 * shorter afterwards due to elimination of escape sequences)
161 */ 162 */
diff --git a/src/daemon/memorypool.c b/src/daemon/memorypool.c
index 32f5217f..bd7c0c3a 100644
--- a/src/daemon/memorypool.c
+++ b/src/daemon/memorypool.c
@@ -81,6 +81,7 @@ struct MemoryPool
81 * Create a memory pool. 81 * Create a memory pool.
82 * 82 *
83 * @param max maximum size of the pool 83 * @param max maximum size of the pool
84 * @return NULL on error
84 */ 85 */
85struct MemoryPool * 86struct MemoryPool *
86MHD_pool_create (size_t max) 87MHD_pool_create (size_t max)
@@ -119,6 +120,8 @@ MHD_pool_create (size_t max)
119 120
120/** 121/**
121 * Destroy a memory pool. 122 * Destroy a memory pool.
123 *
124 * @param pool memory pool to destroy
122 */ 125 */
123void 126void
124MHD_pool_destroy (struct MemoryPool *pool) 127MHD_pool_destroy (struct MemoryPool *pool)
@@ -135,6 +138,12 @@ MHD_pool_destroy (struct MemoryPool *pool)
135 138
136/** 139/**
137 * Allocate size bytes from the pool. 140 * Allocate size bytes from the pool.
141 *
142 * @param pool memory pool to use for the operation
143 * @param size number of bytes to allocate
144 * @param from_end allocate from end of pool (set to MHD_YES);
145 * use this for small, persistent allocations that
146 * will never be reallocated
138 * @return NULL if the pool cannot support size more 147 * @return NULL if the pool cannot support size more
139 * bytes 148 * bytes
140 */ 149 */
@@ -170,6 +179,7 @@ MHD_pool_allocate (struct MemoryPool *pool,
170 * allocation may be leaked until the pool is 179 * allocation may be leaked until the pool is
171 * destroyed (and copying the data maybe required). 180 * destroyed (and copying the data maybe required).
172 * 181 *
182 * @param pool memory pool to use for the operation
173 * @param old the existing block 183 * @param old the existing block
174 * @param old_size the size of the existing block 184 * @param old_size the size of the existing block
175 * @param new_size the new size of the block 185 * @param new_size the new size of the block
@@ -223,6 +233,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
223 * Clear all entries from the memory pool except 233 * Clear all entries from the memory pool except
224 * for "keep" of the given "size". 234 * for "keep" of the given "size".
225 * 235 *
236 * @param pool memory pool to use for the operation
226 * @param keep pointer to the entry to keep (maybe NULL) 237 * @param keep pointer to the entry to keep (maybe NULL)
227 * @param size how many bytes need to be kept at this address 238 * @param size how many bytes need to be kept at this address
228 * @return addr new address of "keep" (if it had to change) 239 * @return addr new address of "keep" (if it had to change)
diff --git a/src/daemon/memorypool.h b/src/daemon/memorypool.h
index 3dfd4dcc..8187a91d 100644
--- a/src/daemon/memorypool.h
+++ b/src/daemon/memorypool.h
@@ -42,6 +42,7 @@ struct MemoryPool;
42 * Create a memory pool. 42 * Create a memory pool.
43 * 43 *
44 * @param max maximum size of the pool 44 * @param max maximum size of the pool
45 * @return NULL on error
45 */ 46 */
46struct MemoryPool * 47struct MemoryPool *
47MHD_pool_create (size_t max); 48MHD_pool_create (size_t max);
@@ -49,6 +50,8 @@ MHD_pool_create (size_t max);
49 50
50/** 51/**
51 * Destroy a memory pool. 52 * Destroy a memory pool.
53 *
54 * @param pool memory pool to destroy
52 */ 55 */
53void 56void
54MHD_pool_destroy (struct MemoryPool *pool); 57MHD_pool_destroy (struct MemoryPool *pool);
@@ -57,6 +60,8 @@ MHD_pool_destroy (struct MemoryPool *pool);
57/** 60/**
58 * Allocate size bytes from the pool. 61 * Allocate size bytes from the pool.
59 * 62 *
63 * @param pool memory pool to use for the operation
64 * @param size number of bytes to allocate
60 * @param from_end allocate from end of pool (set to MHD_YES); 65 * @param from_end allocate from end of pool (set to MHD_YES);
61 * use this for small, persistent allocations that 66 * use this for small, persistent allocations that
62 * will never be reallocated 67 * will never be reallocated
@@ -77,6 +82,7 @@ MHD_pool_allocate (struct MemoryPool *pool,
77 * allocation may be leaked until the pool is 82 * allocation may be leaked until the pool is
78 * destroyed (and copying the data maybe required). 83 * destroyed (and copying the data maybe required).
79 * 84 *
85 * @param pool memory pool to use for the operation
80 * @param old the existing block 86 * @param old the existing block
81 * @param old_size the size of the existing block 87 * @param old_size the size of the existing block
82 * @param new_size the new size of the block 88 * @param new_size the new size of the block
@@ -95,6 +101,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
95 * Clear all entries from the memory pool except 101 * Clear all entries from the memory pool except
96 * for "keep" of the given "size". 102 * for "keep" of the given "size".
97 * 103 *
104 * @param pool memory pool to use for the operation
98 * @param keep pointer to the entry to keep (maybe NULL) 105 * @param keep pointer to the entry to keep (maybe NULL)
99 * @param size how many bytes need to be kept at this address 106 * @param size how many bytes need to be kept at this address
100 * @return addr new address of "keep" (if it had to change) 107 * @return addr new address of "keep" (if it had to change)
diff --git a/src/daemon/postprocessor.c b/src/daemon/postprocessor.c
index 98437744..6cd6d82d 100644
--- a/src/daemon/postprocessor.c
+++ b/src/daemon/postprocessor.c
@@ -71,19 +71,19 @@ enum RN_State
71 RN_Inactive = 0, 71 RN_Inactive = 0,
72 72
73 /** 73 /**
74 * If the next character is '\n', skip it. Otherwise, 74 * If the next character is CR, skip it. Otherwise,
75 * just go inactive. 75 * just go inactive.
76 */ 76 */
77 RN_OptN = 1, 77 RN_OptN = 1,
78 78
79 /** 79 /**
80 * Expect '\r\n' (and only '\r\n'). As always, we also 80 * Expect LFCR (and only LFCR). As always, we also
81 * expect only '\r' or only '\n'. 81 * expect only LF or only CR.
82 */ 82 */
83 RN_Full = 2, 83 RN_Full = 2,
84 84
85 /** 85 /**
86 * Expect either '\r\n' or '--\r\n'. If '--\r\n', transition into dash-state 86 * Expect either LFCR or '--'LFCR. If '--'LFCR, transition into dash-state
87 * for the main state machine 87 * for the main state machine
88 */ 88 */
89 RN_Dash = 3, 89 RN_Dash = 3,
@@ -221,9 +221,9 @@ struct MHD_PostProcessor
221 enum PP_State state; 221 enum PP_State state;
222 222
223 /** 223 /**
224 * Side-state-machine: skip '\r\n' (or just '\n'). 224 * Side-state-machine: skip LRCR (or just LF).
225 * Set to 0 if we are not in skip mode. Set to 2 225 * Set to 0 if we are not in skip mode. Set to 2
226 * if a '\r\n' is expected, set to 1 if a '\n' should 226 * if a LFCR is expected, set to 1 if a CR should
227 * be skipped if it is the next character. 227 * be skipped if it is the next character.
228 */ 228 */
229 enum RN_State skip_rn; 229 enum RN_State skip_rn;
@@ -256,22 +256,22 @@ struct MHD_PostProcessor
256 * specifically the parsing of the keys). A 256 * specifically the parsing of the keys). A
257 * tiny value (256-1024) should be sufficient. 257 * tiny value (256-1024) should be sufficient.
258 * Do NOT use 0. 258 * Do NOT use 0.
259 * @param ikvi iterator to be called with the parsed data 259 * @param iter iterator to be called with the parsed data
260 * @param cls first argument to ikvi 260 * @param iter_cls first argument to iter
261 * @return NULL on error (out of memory, unsupported encoding), 261 * @return NULL on error (out of memory, unsupported encoding),
262 * otherwise a PP handle 262 * otherwise a PP handle
263 */ 263 */
264struct MHD_PostProcessor * 264struct MHD_PostProcessor *
265MHD_create_post_processor (struct MHD_Connection *connection, 265MHD_create_post_processor (struct MHD_Connection *connection,
266 size_t buffer_size, 266 size_t buffer_size,
267 MHD_PostDataIterator ikvi, void *cls) 267 MHD_PostDataIterator iter, void *iter_cls)
268{ 268{
269 struct MHD_PostProcessor *ret; 269 struct MHD_PostProcessor *ret;
270 const char *encoding; 270 const char *encoding;
271 const char *boundary; 271 const char *boundary;
272 size_t blen; 272 size_t blen;
273 273
274 if ((buffer_size < 256) || (connection == NULL) || (ikvi == NULL)) 274 if ((buffer_size < 256) || (connection == NULL) || (iter == NULL))
275 mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); 275 mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL);
276 encoding = MHD_lookup_connection_value (connection, 276 encoding = MHD_lookup_connection_value (connection,
277 MHD_HEADER_KIND, 277 MHD_HEADER_KIND,
@@ -312,8 +312,8 @@ MHD_create_post_processor (struct MHD_Connection *connection,
312 return NULL; 312 return NULL;
313 memset (ret, 0, sizeof (struct MHD_PostProcessor) + buffer_size + 1); 313 memset (ret, 0, sizeof (struct MHD_PostProcessor) + buffer_size + 1);
314 ret->connection = connection; 314 ret->connection = connection;
315 ret->ikvi = ikvi; 315 ret->ikvi = iter;
316 ret->cls = cls; 316 ret->cls = iter_cls;
317 ret->encoding = encoding; 317 ret->encoding = encoding;
318 ret->buffer_size = buffer_size; 318 ret->buffer_size = buffer_size;
319 ret->state = PP_Init; 319 ret->state = PP_Init;
@@ -508,6 +508,15 @@ try_match_header (const char *prefix, char *line, char **suffix)
508/** 508/**
509 * 509 *
510 * @param pp post processor context 510 * @param pp post processor context
511 * @param boundary boundary to look for
512 * @param blen number of bytes in boundary
513 * @param ioffptr set to the end of the boundary if found,
514 * otherwise incremented by one (FIXME: quirky API!)
515 * @param next_state state to which we should advance the post processor
516 * if the boundary is found
517 * @param next_dash_state dash_state to which we should advance the
518 * post processor if the boundary is found
519 * @return MHD_NO if the boundary is not found, MHD_YES if we did find it
511 */ 520 */
512static int 521static int
513find_boundary (struct MHD_PostProcessor *pp, 522find_boundary (struct MHD_PostProcessor *pp,
@@ -595,6 +604,8 @@ try_get_value (const char *buf,
595 * @param pp post processor context 604 * @param pp post processor context
596 * @param ioffptr set to how many bytes have been 605 * @param ioffptr set to how many bytes have been
597 * processed 606 * processed
607 * @param next_state state to which the post processor should
608 * be advanced if we find the end of the headers
598 * @return MHD_YES if we can continue processing, 609 * @return MHD_YES if we can continue processing,
599 * MHD_NO on error or if we do not have 610 * MHD_NO on error or if we do not have
600 * enough data yet 611 * enough data yet
@@ -617,7 +628,7 @@ process_multipart_headers (struct MHD_PostProcessor *pp,
617 } 628 }
618 if (newline == pp->buffer_pos) 629 if (newline == pp->buffer_pos)
619 return MHD_NO; /* will need more data */ 630 return MHD_NO; /* will need more data */
620 if (newline == 0) 631 if (0 == newline)
621 { 632 {
622 /* empty line - end of headers */ 633 /* empty line - end of headers */
623 pp->skip_rn = RN_Full; 634 pp->skip_rn = RN_Full;
@@ -652,6 +663,7 @@ process_multipart_headers (struct MHD_PostProcessor *pp,
652 * process accordingly. 663 * process accordingly.
653 * 664 *
654 * @param pp post processor context 665 * @param pp post processor context
666 * @param ioffptr incremented based on the number of bytes processed
655 * @param boundary the boundary to look for 667 * @param boundary the boundary to look for
656 * @param blen strlen(boundary) 668 * @param blen strlen(boundary)
657 * @param next_state what state to go into after the 669 * @param next_state what state to go into after the
@@ -707,7 +719,7 @@ process_value_to_boundary (struct MHD_PostProcessor *pp,
707 /* cannot check for boundary, process content that 719 /* cannot check for boundary, process content that
708 we have and check again later; except, if we have 720 we have and check again later; except, if we have
709 no content, abort (out of memory) */ 721 no content, abort (out of memory) */
710 if ((newline == 0) && (pp->buffer_pos == pp->buffer_size)) 722 if ((0 == newline) && (pp->buffer_pos == pp->buffer_size))
711 { 723 {
712 pp->state = PP_Error; 724 pp->state = PP_Error;
713 return MHD_NO; 725 return MHD_NO;
@@ -745,23 +757,23 @@ process_value_to_boundary (struct MHD_PostProcessor *pp,
745static void 757static void
746free_unmarked (struct MHD_PostProcessor *pp) 758free_unmarked (struct MHD_PostProcessor *pp)
747{ 759{
748 if ((pp->content_name != NULL) && (0 == (pp->have & NE_content_name))) 760 if ((NULL != pp->content_name) && (0 == (pp->have & NE_content_name)))
749 { 761 {
750 free (pp->content_name); 762 free (pp->content_name);
751 pp->content_name = NULL; 763 pp->content_name = NULL;
752 } 764 }
753 if ((pp->content_type != NULL) && (0 == (pp->have & NE_content_type))) 765 if ((NULL != pp->content_type) && (0 == (pp->have & NE_content_type)))
754 { 766 {
755 free (pp->content_type); 767 free (pp->content_type);
756 pp->content_type = NULL; 768 pp->content_type = NULL;
757 } 769 }
758 if ((pp->content_filename != NULL) && 770 if ((NULL != pp->content_filename) &&
759 (0 == (pp->have & NE_content_filename))) 771 (0 == (pp->have & NE_content_filename)))
760 { 772 {
761 free (pp->content_filename); 773 free (pp->content_filename);
762 pp->content_filename = NULL; 774 pp->content_filename = NULL;
763 } 775 }
764 if ((pp->content_transfer_encoding != NULL) && 776 if ((NULL != pp->content_transfer_encoding) &&
765 (0 == (pp->have & NE_content_transfer_encoding))) 777 (0 == (pp->have & NE_content_transfer_encoding)))
766 { 778 {
767 free (pp->content_transfer_encoding); 779 free (pp->content_transfer_encoding);
@@ -774,6 +786,9 @@ free_unmarked (struct MHD_PostProcessor *pp)
774 * Decode multipart POST data. 786 * Decode multipart POST data.
775 * 787 *
776 * @param pp post processor context 788 * @param pp post processor context
789 * @param post_data data to decode
790 * @param post_data_len number of bytes in 'post_data'
791 * @return MHD_NO on error,
777 */ 792 */
778static int 793static int
779post_process_multipart (struct MHD_PostProcessor *pp, 794post_process_multipart (struct MHD_PostProcessor *pp,
diff --git a/src/daemon/response.c b/src/daemon/response.c
index dbd034ad..5db03824 100644
--- a/src/daemon/response.c
+++ b/src/daemon/response.c
@@ -158,6 +158,7 @@ MHD_del_response_header (struct MHD_Response *response,
158/** 158/**
159 * Get all of the headers added to a response. 159 * Get all of the headers added to a response.
160 * 160 *
161 * @param response response to query
161 * @param iterator callback to call on each header; 162 * @param iterator callback to call on each header;
162 * maybe NULL (then just count headers) 163 * maybe NULL (then just count headers)
163 * @param iterator_cls extra argument to iterator 164 * @param iterator_cls extra argument to iterator
@@ -185,11 +186,13 @@ MHD_get_response_headers (struct MHD_Response *response,
185/** 186/**
186 * Get a particular header from the response. 187 * Get a particular header from the response.
187 * 188 *
189 * @param response response to query
188 * @param key which header to get 190 * @param key which header to get
189 * @return NULL if header does not exist 191 * @return NULL if header does not exist
190 */ 192 */
191const char * 193const char *
192MHD_get_response_header (struct MHD_Response *response, const char *key) 194MHD_get_response_header (struct MHD_Response *response,
195 const char *key)
193{ 196{
194 struct MHD_HTTP_Header *pos; 197 struct MHD_HTTP_Header *pos;
195 198
@@ -296,7 +299,7 @@ free_callback (void *cls)
296 * 299 *
297 * @param size size of the data portion of the response 300 * @param size size of the data portion of the response
298 * @param fd file descriptor referring to a file on disk with the data 301 * @param fd file descriptor referring to a file on disk with the data
299 * @param off offset to start reading from in the file 302 * @param offset offset to start reading from in the file
300 * @return NULL on error (i.e. invalid arguments, out of memory) 303 * @return NULL on error (i.e. invalid arguments, out of memory)
301 */ 304 */
302struct MHD_Response *MHD_create_response_from_fd_at_offset (size_t size, 305struct MHD_Response *MHD_create_response_from_fd_at_offset (size_t size,
diff --git a/src/daemon/test_daemon.c b/src/daemon/test_daemon.c
index ed4844b8..4140fb4f 100644
--- a/src/daemon/test_daemon.c
+++ b/src/daemon/test_daemon.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file daemon_test.c 22 * @file test_daemon.c
23 * @brief Testcase for libmicrohttpd starts and stops 23 * @brief Testcase for libmicrohttpd starts and stops
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
diff --git a/src/daemon/test_postprocessor.c b/src/daemon/test_postprocessor.c
index f470024a..eb412b72 100644
--- a/src/daemon/test_postprocessor.c
+++ b/src/daemon/test_postprocessor.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file postprocessor_test.c 22 * @file test_postprocessor.c
23 * @brief Testcase for postprocessor 23 * @brief Testcase for postprocessor
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
diff --git a/src/daemon/test_postprocessor_large.c b/src/daemon/test_postprocessor_large.c
index 6c1ea145..2af84dcc 100644
--- a/src/daemon/test_postprocessor_large.c
+++ b/src/daemon/test_postprocessor_large.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file postprocessor_large_test.c 22 * @file test_postprocessor_large.c
23 * @brief Testcase with very large input for postprocessor 23 * @brief Testcase with very large input for postprocessor
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c
index ca9d8a32..a732d8c8 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -17,7 +17,7 @@
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/ 18*/
19/** 19/**
20 * @file https_server_example.c 20 * @file https_fileserver_example.c
21 * @brief a simple HTTPS file server using TLS. 21 * @brief a simple HTTPS file server using TLS.
22 * 22 *
23 * Usage : 23 * Usage :
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index e70f7bf5..b1a6e7fa 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -492,9 +492,9 @@ post_iterator (void *cls,
492/** 492/**
493 * Main MHD callback for handling requests. 493 * Main MHD callback for handling requests.
494 * 494 *
495 *
496 * @param cls argument given together with the function 495 * @param cls argument given together with the function
497 * pointer when the handler was registered with MHD 496 * pointer when the handler was registered with MHD
497 * @param connection handle identifying the incoming connection
498 * @param url the requested url 498 * @param url the requested url
499 * @param method the HTTP method used ("GET", "PUT", etc.) 499 * @param method the HTTP method used ("GET", "PUT", etc.)
500 * @param version the HTTP version string (i.e. "HTTP/1.1") 500 * @param version the HTTP version string (i.e. "HTTP/1.1")
@@ -508,7 +508,7 @@ post_iterator (void *cls,
508 * @param upload_data_size set initially to the size of the 508 * @param upload_data_size set initially to the size of the
509 * upload_data provided; the method must update this 509 * upload_data provided; the method must update this
510 * value to the number of bytes NOT processed; 510 * value to the number of bytes NOT processed;
511 * @param con_cls pointer that the callback can set to some 511 * @param ptr pointer that the callback can set to some
512 * address and that will be preserved by MHD for future 512 * address and that will be preserved by MHD for future
513 * calls for this request; since the access handler may 513 * calls for this request; since the access handler may
514 * be called many times (i.e., for a PUT/POST operation 514 * be called many times (i.e., for a PUT/POST operation
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 3a9310cd..65861e93 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -66,7 +66,7 @@
66 * "platform.h" in the MHD distribution). If you have done so, you 66 * "platform.h" in the MHD distribution). If you have done so, you
67 * should also have a line with "#define MHD_PLATFORM_H" which will 67 * should also have a line with "#define MHD_PLATFORM_H" which will
68 * prevent this header from trying (and, depending on your platform, 68 * prevent this header from trying (and, depending on your platform,
69 * failing) to #include the right headers. 69 * failing) to include the right headers.
70 */ 70 */
71 71
72#ifndef MHD_MICROHTTPD_H 72#ifndef MHD_MICROHTTPD_H
@@ -1066,12 +1066,12 @@ typedef int
1066 * @param apc_cls extra argument to apc 1066 * @param apc_cls extra argument to apc
1067 * @param dh handler called for all requests (repeatedly) 1067 * @param dh handler called for all requests (repeatedly)
1068 * @param dh_cls extra argument to dh 1068 * @param dh_cls extra argument to dh
1069 * @param ... list of options (type-value pairs, 1069 * @param ap list of options (type-value pairs,
1070 * terminated with MHD_OPTION_END). 1070 * terminated with MHD_OPTION_END).
1071 * @return NULL on error, handle to daemon on success 1071 * @return NULL on error, handle to daemon on success
1072 */ 1072 */
1073struct MHD_Daemon * 1073struct MHD_Daemon *
1074MHD_start_daemon_va (unsigned int options, 1074MHD_start_daemon_va (unsigned int flags,
1075 uint16_t port, 1075 uint16_t port,
1076 MHD_AcceptPolicyCallback apc, void *apc_cls, 1076 MHD_AcceptPolicyCallback apc, void *apc_cls,
1077 MHD_AccessHandlerCallback dh, void *dh_cls, 1077 MHD_AccessHandlerCallback dh, void *dh_cls,
@@ -1458,7 +1458,7 @@ MHD_create_response_from_fd (size_t size,
1458 * @param fd file descriptor referring to a file on disk with the 1458 * @param fd file descriptor referring to a file on disk with the
1459 * data; will be closed when response is destroyed; 1459 * data; will be closed when response is destroyed;
1460 * fd should be in 'blocking' mode 1460 * fd should be in 'blocking' mode
1461 * @param off offset to start reading from in the file; 1461 * @param offset offset to start reading from in the file;
1462 * Be careful! 'off_t' may have been compiled to be a 1462 * Be careful! 'off_t' may have been compiled to be a
1463 * 64-bit variable for MHD, in which case your application 1463 * 64-bit variable for MHD, in which case your application
1464 * also has to be compiled using the same options! Read 1464 * also has to be compiled using the same options! Read
@@ -1655,6 +1655,7 @@ int
1655MHD_del_response_header (struct MHD_Response *response, 1655MHD_del_response_header (struct MHD_Response *response,
1656 const char *header, const char *content); 1656 const char *header, const char *content);
1657 1657
1658
1658/** 1659/**
1659 * Get all of the headers (and footers) added to a response. 1660 * Get all of the headers (and footers) added to a response.
1660 * 1661 *
@@ -1702,14 +1703,14 @@ const char *MHD_get_response_header (struct MHD_Response *response,
1702 * performance, use 32 or 64k (i.e. 65536). 1703 * performance, use 32 or 64k (i.e. 65536).
1703 * @param iter iterator to be called with the parsed data, 1704 * @param iter iterator to be called with the parsed data,
1704 * Must NOT be NULL. 1705 * Must NOT be NULL.
1705 * @param cls first argument to ikvi 1706 * @param iter_cls first argument to iter
1706 * @return NULL on error (out of memory, unsupported encoding), 1707 * @return NULL on error (out of memory, unsupported encoding),
1707 * otherwise a PP handle 1708 * otherwise a PP handle
1708 */ 1709 */
1709struct MHD_PostProcessor * 1710struct MHD_PostProcessor *
1710MHD_create_post_processor (struct MHD_Connection *connection, 1711MHD_create_post_processor (struct MHD_Connection *connection,
1711 size_t buffer_size, 1712 size_t buffer_size,
1712 MHD_PostDataIterator iter, void *cls); 1713 MHD_PostDataIterator iter, void *iter_cls);
1713 1714
1714/** 1715/**
1715 * Parse and process POST data. 1716 * Parse and process POST data.
@@ -1818,9 +1819,13 @@ MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
1818 1819
1819/** 1820/**
1820 * Queues a response to request basic authentication from the client 1821 * Queues a response to request basic authentication from the client
1822 * The given response object is expected to include the payload for
1823 * the response; the "WWW-Authenticate" header will be added and the
1824 * response queued with the 'UNAUTHORIZED' status code.
1821 * 1825 *
1822 * @param connection The MHD connection structure 1826 * @param connection The MHD connection structure
1823 * @param realm the realm presented to the client 1827 * @param realm the realm presented to the client
1828 * @param response response object to modify and queue
1824 * @return MHD_YES on success, MHD_NO otherwise 1829 * @return MHD_YES on success, MHD_NO otherwise
1825 */ 1830 */
1826int 1831int
diff --git a/src/include/plibc/plibc.h b/src/include/plibc/plibc.h
index 36698bf7..559deb52 100644
--- a/src/include/plibc/plibc.h
+++ b/src/include/plibc/plibc.h
@@ -18,7 +18,7 @@
18*/ 18*/
19 19
20/** 20/**
21 * @file include/plibc.h 21 * @file plibc.h
22 * @brief PlibC header 22 * @brief PlibC header
23 * @attention This file is usually not installed under Unix, 23 * @attention This file is usually not installed under Unix,
24 * so ship it with your application 24 * so ship it with your application
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index e64f4126..8679280f 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -252,10 +252,13 @@ send_curl_req (char *url, struct CBC * cbc, const char *cipher_suite,
252 return CURLE_OK; 252 return CURLE_OK;
253} 253}
254 254
255
255/** 256/**
256 * compile test file url pointing to the current running directory path 257 * compile test file url pointing to the current running directory path
258 *
257 * @param url - char buffer into which the url is compiled 259 * @param url - char buffer into which the url is compiled
258 * @return 260 * @param port port to use for the test
261 * @return -1 on error
259 */ 262 */
260int 263int
261gen_test_file_url (char *url, int port) 264gen_test_file_url (char *url, int port)
diff --git a/src/testcurl/https/tls_test_common.h b/src/testcurl/https/tls_test_common.h
index 7cc7e122..501c0226 100644
--- a/src/testcurl/https/tls_test_common.h
+++ b/src/testcurl/https/tls_test_common.h
@@ -98,6 +98,14 @@ http_dummy_ahc (void *cls, struct MHD_Connection *connection,
98 const char *version, size_t *upload_data_size, 98 const char *version, size_t *upload_data_size,
99 void **ptr); 99 void **ptr);
100 100
101
102/**
103 * compile test file url pointing to the current running directory path
104 *
105 * @param url - char buffer into which the url is compiled
106 * @param port port to use for the test
107 * @return -1 on error
108 */
101int gen_test_file_url (char *url, int port); 109int gen_test_file_url (char *url, int port);
102 110
103int 111int