aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-08 22:59:05 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-08 22:59:05 +0200
commit6347f514aa2388e774d5bf356df8046864e5f73c (patch)
tree98cebf52cce627341d62620255f0ffe0ed36365d
parent6702e6202368720d7a381669c03eedc318f225ca (diff)
downloadlibmicrohttpd-6347f514aa2388e774d5bf356df8046864e5f73c.tar.gz
libmicrohttpd-6347f514aa2388e774d5bf356df8046864e5f73c.zip
introduce 'enum MHD_Result'
-rw-r--r--ChangeLog3
-rw-r--r--doc/libmicrohttpd.texi50
-rw-r--r--src/include/microhttpd.h134
-rw-r--r--src/microhttpd/connection.c46
-rw-r--r--src/microhttpd/connection.h12
-rw-r--r--src/microhttpd/daemon.c68
-rw-r--r--src/microhttpd/digestauth.c12
-rw-r--r--src/microhttpd/internal.c2
-rw-r--r--src/microhttpd/internal.h4
-rw-r--r--src/microhttpd/postprocessor.c31
-rw-r--r--src/microhttpd/response.c16
-rw-r--r--src/microhttpd/response.h2
12 files changed, 197 insertions, 183 deletions
diff --git a/ChangeLog b/ChangeLog
index d400eb85..ca0a8847 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
1Wed 08 Apr 2020 10:53:01 PM CEST
2 Introduce `enum MHD_Result` for #MHD_YES/#MHD_NO to avoid using 'int' so much. -CG
3
1Sat 07 Mar 2020 05:20:33 PM CET 4Sat 07 Mar 2020 05:20:33 PM CET
2 Fixed #6090 (misc. severe socket handling bugs on OS X). -CG 5 Fixed #6090 (misc. severe socket handling bugs on OS X). -CG
3 6
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 4814b3c6..e89f75ed 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -1284,7 +1284,7 @@ Information about an MHD daemon.
1284@chapter Callback functions definition 1284@chapter Callback functions definition
1285 1285
1286 1286
1287@deftypefn {Function Pointer} int {*MHD_AcceptPolicyCallback} (void *cls, const struct sockaddr * addr, socklen_t addrlen) 1287@deftypefn {Function Pointer} enum MHD_Result {*MHD_AcceptPolicyCallback} (void *cls, const struct sockaddr * addr, socklen_t addrlen)
1288Invoked in the context of a connection to allow or deny a client to 1288Invoked in the context of a connection to allow or deny a client to
1289connect. This callback return @code{MHD_YES} if connection is allowed, 1289connect. This callback return @code{MHD_YES} if connection is allowed,
1290@code{MHD_NO} if not. 1290@code{MHD_NO} if not.
@@ -1300,7 +1300,7 @@ length of the address information.
1300@end deftypefn 1300@end deftypefn
1301 1301
1302 1302
1303@deftypefn {Function Pointer} int {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) 1303@deftypefn {Function Pointer} enum MHD_Result {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
1304Invoked in the context of a connection to answer a request from the 1304Invoked in the context of a connection to answer a request from the
1305client. This callback must call MHD functions (example: the 1305client. This callback must call MHD functions (example: the
1306@code{MHD_Response} ones) to provide content to give back to the client 1306@code{MHD_Response} ones) to provide content to give back to the client
@@ -1403,7 +1403,7 @@ reason for request termination see @code{MHD_OPTION_NOTIFY_COMPLETED}.
1403@end deftypefn 1403@end deftypefn
1404 1404
1405 1405
1406@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size) 1406@deftypefn {Function Pointer} enum MHD_Result {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size)
1407Iterator over key-value pairs. This iterator can be used to iterate 1407Iterator over key-value pairs. This iterator can be used to iterate
1408over all of the cookies, headers, or @code{POST}-data fields of a 1408over all of the cookies, headers, or @code{POST}-data fields of a
1409request, and also to iterate over the headers that have been added to a 1409request, and also to iterate over the headers that have been added to a
@@ -1440,7 +1440,7 @@ iteration.
1440@end deftypefn 1440@end deftypefn
1441 1441
1442 1442
1443@deftypefn {Function Pointer} int {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max) 1443@deftypefn {Function Pointer} ssize_t {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max)
1444Callback used by MHD in order to obtain content. The callback has to 1444Callback used by MHD in order to obtain content. The callback has to
1445copy at most @var{max} bytes of content into @var{buf}. The total 1445copy at most @var{max} bytes of content into @var{buf}. The total
1446number of bytes that has been placed into @var{buf} should be returned. 1446number of bytes that has been placed into @var{buf} should be returned.
@@ -1496,7 +1496,7 @@ It should be used to free resources associated with the content reader.
1496@end deftypefn 1496@end deftypefn
1497 1497
1498 1498
1499@deftypefn {Function Pointer} int {*MHD_PostDataIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size) 1499@deftypefn {Function Pointer} enum MHD_Result {*MHD_PostDataIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size)
1500Iterator over key-value pairs where the value maybe made available in 1500Iterator over key-value pairs where the value maybe made available in
1501increments and/or may not be zero-terminated. Used for processing 1501increments and/or may not be zero-terminated. Used for processing
1502@code{POST} data. 1502@code{POST} data.
@@ -1587,7 +1587,7 @@ Return @code{NULL} on error, handle to daemon on success.
1587@end deftypefun 1587@end deftypefun
1588 1588
1589 1589
1590@deftypefun int MHD_quiesce_daemon (struct MHD_Daemon *daemon) 1590@deftypefun MHD_socket MHD_quiesce_daemon (struct MHD_Daemon *daemon)
1591@cindex quiesce 1591@cindex quiesce
1592Stop accepting connections from the listening socket. Allows clients 1592Stop accepting connections from the listening socket. Allows clients
1593to continue processing, but stops accepting new connections. Note 1593to continue processing, but stops accepting new connections. Note
@@ -1613,7 +1613,7 @@ Shutdown an HTTP daemon.
1613@end deftypefun 1613@end deftypefun
1614 1614
1615 1615
1616@deftypefun int MHD_run (struct MHD_Daemon *daemon) 1616@deftypefun enum MHD_Result MHD_run (struct MHD_Daemon *daemon)
1617Run webserver operations (without blocking unless in client callbacks). 1617Run webserver operations (without blocking unless in client callbacks).
1618This method should be called by clients in combination with 1618This method should be called by clients in combination with
1619@code{MHD_get_fdset()} if the client-controlled @code{select}-method is used. 1619@code{MHD_get_fdset()} if the client-controlled @code{select}-method is used.
@@ -1634,7 +1634,7 @@ started with the right options for this call.
1634@end deftypefun 1634@end deftypefun
1635 1635
1636 1636
1637@deftypefun int MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set) 1637@deftypefun enum MHD_Result MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set)
1638Run webserver operations given sets of ready socket handles. 1638Run webserver operations given sets of ready socket handles.
1639@cindex select 1639@cindex select
1640 1640
@@ -1710,7 +1710,7 @@ to indicate further details about the error.
1710@chapter Implementing external @code{select} 1710@chapter Implementing external @code{select}
1711 1711
1712 1712
1713@deftypefun int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd) 1713@deftypefun enum MHD_Result MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd)
1714Obtain the @code{select()} sets for this daemon. The daemon's socket 1714Obtain the @code{select()} sets for this daemon. The daemon's socket
1715is added to @var{read_fd_set}. The list of currently existent 1715is added to @var{read_fd_set}. The list of currently existent
1716connections is scanned and their file descriptors added to the correct 1716connections is scanned and their file descriptors added to the correct
@@ -1736,12 +1736,12 @@ the right options for this call.
1736@end deftypefun 1736@end deftypefun
1737 1737
1738 1738
1739@deftypefun int MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, unsigned int fd_setsize) 1739@deftypefun enum MHD_Result MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, unsigned int fd_setsize)
1740Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application. 1740Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application.
1741@end deftypefun 1741@end deftypefun
1742 1742
1743 1743
1744@deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) 1744@deftypefun enum MHD_Result MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout)
1745@cindex timeout 1745@cindex timeout
1746Obtain timeout value for select for this daemon (only needed if 1746Obtain timeout value for select for this daemon (only needed if
1747connection timeout is used). The returned value is how many 1747connection timeout is used). The returned value is how many
@@ -1802,7 +1802,7 @@ would contain the string ``key''.
1802@end deftypefun 1802@end deftypefun
1803 1803
1804 1804
1805@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value) 1805@deftypefun enum MHD_Result MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value)
1806This function can be used to append an entry to 1806This function can be used to append an entry to
1807the list of HTTP headers of a connection (so that the 1807the list of HTTP headers of a connection (so that the
1808@code{MHD_get_connection_values function} will return 1808@code{MHD_get_connection_values function} will return
@@ -1884,7 +1884,7 @@ response and we finally destroy it only when the daemon shuts down.
1884@section Enqueuing a response 1884@section Enqueuing a response
1885 1885
1886 1886
1887@deftypefun int MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response) 1887@deftypefun enum MHD_Result MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
1888Queue a response to be transmitted to the client as soon as possible 1888Queue a response to be transmitted to the client as soon as possible
1889but only after MHD_AccessHandlerCallback returns. This function 1889but only after MHD_AccessHandlerCallback returns. This function
1890checks that it is legal to queue a response at this time for the 1890checks that it is legal to queue a response at this time for the
@@ -2148,7 +2148,7 @@ MHD_destroy_response(response);
2148@section Adding headers to a response 2148@section Adding headers to a response
2149 2149
2150 2150
2151@deftypefun int MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) 2151@deftypefun enum MHD_Result MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content)
2152Add a header line to the response. The strings referenced by 2152Add a header line to the response. The strings referenced by
2153@var{header} and @var{content} must be zero-terminated and they are 2153@var{header} and @var{content} must be zero-terminated and they are
2154duplicated into memory blocks embedded in @var{response}. 2154duplicated into memory blocks embedded in @var{response}.
@@ -2172,7 +2172,7 @@ memory allocation error).
2172@end deftypefun 2172@end deftypefun
2173 2173
2174 2174
2175@deftypefun int MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content) 2175@deftypefun enum MHD_Result MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content)
2176Add a footer line to the response. The strings referenced by 2176Add a footer line to the response. The strings referenced by
2177@var{footer} and @var{content} must be zero-terminated and they are 2177@var{footer} and @var{content} must be zero-terminated and they are
2178duplicated into memory blocks embedded in @var{response}. 2178duplicated into memory blocks embedded in @var{response}.
@@ -2190,7 +2190,7 @@ memory allocation error).
2190 2190
2191 2191
2192 2192
2193@deftypefun int MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) 2193@deftypefun enum MHD_Result MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content)
2194Delete a header (or footer) line from the response. Return @code{MHD_NO} on error 2194Delete a header (or footer) line from the response. Return @code{MHD_NO} on error
2195(arguments are invalid or no such header known). 2195(arguments are invalid or no such header known).
2196@end deftypefun 2196@end deftypefun
@@ -2201,7 +2201,7 @@ Delete a header (or footer) line from the response. Return @code{MHD_NO} on err
2201@section Setting response options 2201@section Setting response options
2202 2202
2203 2203
2204@deftypefun int MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...) 2204@deftypefun enum MHD_Result MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...)
2205Set special flags and options for a response. 2205Set special flags and options for a response.
2206 2206
2207Calling this functions sets the given flags and options for the response. 2207Calling this functions sets the given flags and options for the response.
@@ -2281,7 +2281,7 @@ a connection by queueing a response (using the
2281have been created with the following function: 2281have been created with the following function:
2282 2282
2283 2283
2284@deftypefun int MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls) 2284@deftypefun enum MHD_Result MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls)
2285Create a response suitable for switching protocols. Returns @code{MHD_YES} on success. @code{upgrade_handler} must not be @code{NULL}. 2285Create a response suitable for switching protocols. Returns @code{MHD_YES} on success. @code{upgrade_handler} must not be @code{NULL}.
2286 2286
2287When creating this type of response, the ``Connection: Upgrade'' 2287When creating this type of response, the ``Connection: Upgrade''
@@ -2322,7 +2322,7 @@ argument for calls to @code{MHD_upgrade_action}. Applications must eventually u
2322 2322
2323@end deftypefn 2323@end deftypefn
2324 2324
2325@deftypefun int MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...) 2325@deftypefun enum MHD_Result MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...)
2326Perform special operations related to upgraded connections. 2326Perform special operations related to upgraded connections.
2327 2327
2328@table @var 2328@table @var
@@ -2374,7 +2374,7 @@ Instead, applications using thread modes other than
2374@code{MHD_USE_THREAD_PER_CONNECTION} should use the 2374@code{MHD_USE_THREAD_PER_CONNECTION} should use the
2375following functions to perform flow control. 2375following functions to perform flow control.
2376 2376
2377@deftypefun int MHD_suspend_connection (struct MHD_Connection *connection) 2377@deftypefun enum MHD_Result MHD_suspend_connection (struct MHD_Connection *connection)
2378Suspend handling of network data for a given connection. This can 2378Suspend handling of network data for a given connection. This can
2379be used to dequeue a connection from MHD's event loop (external 2379be used to dequeue a connection from MHD's event loop (external
2380select, internal select or thread pool; not applicable to 2380select, internal select or thread pool; not applicable to
@@ -2408,7 +2408,7 @@ the connection to suspend
2408@end table 2408@end table
2409@end deftypefun 2409@end deftypefun
2410 2410
2411@deftypefun int MHD_resume_connection (struct MHD_Connection *connection) 2411@deftypefun enum MHD_Result MHD_resume_connection (struct MHD_Connection *connection)
2412Resume handling of network data for suspended connection. It is safe 2412Resume handling of network data for suspended connection. It is safe
2413to resume a suspended connection at any time. Calling this function 2413to resume a suspended connection at any time. Calling this function
2414on a connection that was not previously suspended will result in 2414on a connection that was not previously suspended will result in
@@ -2602,7 +2602,7 @@ Most of the time it is sound to specify 300 seconds as its values.
2602@end deftypefun 2602@end deftypefun
2603 2603
2604 2604
2605@deftypefun int MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale, enum MHD_DigestAuthAlgorithm algo) 2605@deftypefun enum MHD_Result MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale, enum MHD_DigestAuthAlgorithm algo)
2606Queues a response to request authentication from the client, 2606Queues a response to request authentication from the client,
2607return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. 2607return @code{MHD_YES} if successful, otherwise @code{MHD_NO}.
2608 2608
@@ -2626,7 +2626,7 @@ must then be selected when checking digests received from clients!
2626@end deftypefun 2626@end deftypefun
2627 2627
2628 2628
2629@deftypefun int MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale) 2629@deftypefun enum MHD_Result MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale)
2630Queues a response to request authentication from the client, 2630Queues a response to request authentication from the client,
2631return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. 2631return @code{MHD_YES} if successful, otherwise @code{MHD_NO}.
2632 2632
@@ -2847,7 +2847,7 @@ a PP handle.
2847@end deftypefun 2847@end deftypefun
2848 2848
2849 2849
2850@deftypefun int MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len) 2850@deftypefun enum MHD_Result MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len)
2851Parse and process @code{POST} data. Call this function when @code{POST} 2851Parse and process @code{POST} data. Call this function when @code{POST}
2852data is available (usually during an @code{MHD_AccessHandlerCallback}) 2852data is available (usually during an @code{MHD_AccessHandlerCallback})
2853with the @var{upload_data} and @var{upload_data_size}. Whenever 2853with the @var{upload_data} and @var{upload_data_size}. Whenever
@@ -2870,7 +2870,7 @@ Return @code{MHD_YES} on success, @code{MHD_NO} on error
2870@end deftypefun 2870@end deftypefun
2871 2871
2872 2872
2873@deftypefun int MHD_destroy_post_processor (struct MHD_PostProcessor *pp) 2873@deftypefun enum MHD_Result MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
2874Release PostProcessor resources. After this function is being called, 2874Release PostProcessor resources. After this function is being called,
2875the PostProcessor is guaranteed to no longer call its iterator. There 2875the PostProcessor is guaranteed to no longer call its iterator. There
2876is no special call to the iterator to indicate the end of the post processing 2876is no special call to the iterator to indicate the end of the post processing
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 109afa5b..f0daa3df 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 Copyright (C) 2006--2019 Christian Grothoff (and other contributing authors) 3 Copyright (C) 2006--2020 Christian Grothoff (and other contributing authors)
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -135,14 +135,22 @@ typedef intptr_t ssize_t;
135#define MHD_VERSION 0x00097001 135#define MHD_VERSION 0x00097001
136 136
137/** 137/**
138 * MHD-internal return code for "YES". 138 * Operational results from MHD calls.
139 */ 139 */
140#define MHD_YES 1 140enum MHD_Result
141{
142 /**
143 * MHD result code for "NO".
144 */
145 MHD_NO = 0,
146
147 /**
148 * MHD result code for "YES".
149 */
150 MHD_YES = 1
151
152};
141 153
142/**
143 * MHD-internal return code for "NO".
144 */
145#define MHD_NO 0
146 154
147/** 155/**
148 * MHD digest auth internal code for an invalid nonce. 156 * MHD digest auth internal code for an invalid nonce.
@@ -2118,10 +2126,10 @@ typedef void
2118 * @param addrlen length of @a addr 2126 * @param addrlen length of @a addr
2119 * @return #MHD_YES if connection is allowed, #MHD_NO if not 2127 * @return #MHD_YES if connection is allowed, #MHD_NO if not
2120 */ 2128 */
2121typedef int 2129typedef enum MHD_Result
2122(*MHD_AcceptPolicyCallback) (void *cls, 2130(*MHD_AcceptPolicyCallback)(void *cls,
2123 const struct sockaddr *addr, 2131 const struct sockaddr *addr,
2124 socklen_t addrlen); 2132 socklen_t addrlen);
2125 2133
2126 2134
2127/** 2135/**
@@ -2163,15 +2171,15 @@ typedef int
2163 * #MHD_NO if the socket must be closed due to a serios 2171 * #MHD_NO if the socket must be closed due to a serios
2164 * error while handling the request 2172 * error while handling the request
2165 */ 2173 */
2166typedef int 2174typedef enum MHD_Result
2167(*MHD_AccessHandlerCallback) (void *cls, 2175(*MHD_AccessHandlerCallback)(void *cls,
2168 struct MHD_Connection *connection, 2176 struct MHD_Connection *connection,
2169 const char *url, 2177 const char *url,
2170 const char *method, 2178 const char *method,
2171 const char *version, 2179 const char *version,
2172 const char *upload_data, 2180 const char *upload_data,
2173 size_t *upload_data_size, 2181 size_t *upload_data_size,
2174 void **con_cls); 2182 void **con_cls);
2175 2183
2176 2184
2177/** 2185/**
@@ -2234,11 +2242,11 @@ typedef void
2234 * #MHD_NO to abort the iteration 2242 * #MHD_NO to abort the iteration
2235 * @ingroup request 2243 * @ingroup request
2236 */ 2244 */
2237typedef int 2245typedef enum MHD_Result
2238(*MHD_KeyValueIterator) (void *cls, 2246(*MHD_KeyValueIterator)(void *cls,
2239 enum MHD_ValueKind kind, 2247 enum MHD_ValueKind kind,
2240 const char *key, 2248 const char *key,
2241 const char *value); 2249 const char *value);
2242 2250
2243 2251
2244/** 2252/**
@@ -2259,13 +2267,13 @@ typedef int
2259 * #MHD_NO to abort the iteration 2267 * #MHD_NO to abort the iteration
2260 * @ingroup request 2268 * @ingroup request
2261 */ 2269 */
2262typedef int 2270typedef enum MHD_Result
2263(*MHD_KeyValueIteratorN) (void *cls, 2271(*MHD_KeyValueIteratorN)(void *cls,
2264 enum MHD_ValueKind kind, 2272 enum MHD_ValueKind kind,
2265 const char *key, 2273 const char *key,
2266 size_t key_size, 2274 size_t key_size,
2267 const char *value, 2275 const char *value,
2268 size_t value_size); 2276 size_t value_size);
2269 2277
2270 2278
2271/** 2279/**
@@ -2351,16 +2359,16 @@ typedef void
2351 * @return #MHD_YES to continue iterating, 2359 * @return #MHD_YES to continue iterating,
2352 * #MHD_NO to abort the iteration 2360 * #MHD_NO to abort the iteration
2353 */ 2361 */
2354typedef int 2362typedef enum MHD_Result
2355(*MHD_PostDataIterator) (void *cls, 2363(*MHD_PostDataIterator)(void *cls,
2356 enum MHD_ValueKind kind, 2364 enum MHD_ValueKind kind,
2357 const char *key, 2365 const char *key,
2358 const char *filename, 2366 const char *filename,
2359 const char *content_type, 2367 const char *content_type,
2360 const char *transfer_encoding, 2368 const char *transfer_encoding,
2361 const char *data, 2369 const char *data,
2362 uint64_t off, 2370 uint64_t off,
2363 size_t size); 2371 size_t size);
2364 2372
2365/* **************** Daemon handling functions ***************** */ 2373/* **************** Daemon handling functions ***************** */
2366 2374
@@ -2481,7 +2489,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
2481 * set to indicate further details about the error. 2489 * set to indicate further details about the error.
2482 * @ingroup specialized 2490 * @ingroup specialized
2483 */ 2491 */
2484_MHD_EXTERN int 2492_MHD_EXTERN enum MHD_Result
2485MHD_add_connection (struct MHD_Daemon *daemon, 2493MHD_add_connection (struct MHD_Daemon *daemon,
2486 MHD_socket client_socket, 2494 MHD_socket client_socket,
2487 const struct sockaddr *addr, 2495 const struct sockaddr *addr,
@@ -2517,7 +2525,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
2517 * fit fd_set. 2525 * fit fd_set.
2518 * @ingroup event 2526 * @ingroup event
2519 */ 2527 */
2520_MHD_EXTERN int 2528_MHD_EXTERN enum MHD_Result
2521MHD_get_fdset (struct MHD_Daemon *daemon, 2529MHD_get_fdset (struct MHD_Daemon *daemon,
2522 fd_set *read_fd_set, 2530 fd_set *read_fd_set,
2523 fd_set *write_fd_set, 2531 fd_set *write_fd_set,
@@ -2557,7 +2565,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
2557 * fit fd_set. 2565 * fit fd_set.
2558 * @ingroup event 2566 * @ingroup event
2559 */ 2567 */
2560_MHD_EXTERN int 2568_MHD_EXTERN enum MHD_Result
2561MHD_get_fdset2 (struct MHD_Daemon *daemon, 2569MHD_get_fdset2 (struct MHD_Daemon *daemon,
2562 fd_set *read_fd_set, 2570 fd_set *read_fd_set,
2563 fd_set *write_fd_set, 2571 fd_set *write_fd_set,
@@ -2613,7 +2621,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
2613 * necessitate the use of a timeout right now). 2621 * necessitate the use of a timeout right now).
2614 * @ingroup event 2622 * @ingroup event
2615 */ 2623 */
2616_MHD_EXTERN int 2624_MHD_EXTERN enum MHD_Result
2617MHD_get_timeout (struct MHD_Daemon *daemon, 2625MHD_get_timeout (struct MHD_Daemon *daemon,
2618 MHD_UNSIGNED_LONG_LONG *timeout); 2626 MHD_UNSIGNED_LONG_LONG *timeout);
2619 2627
@@ -2638,7 +2646,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
2638 * options for this call. 2646 * options for this call.
2639 * @ingroup event 2647 * @ingroup event
2640 */ 2648 */
2641_MHD_EXTERN int 2649_MHD_EXTERN enum MHD_Result
2642MHD_run (struct MHD_Daemon *daemon); 2650MHD_run (struct MHD_Daemon *daemon);
2643 2651
2644 2652
@@ -2664,7 +2672,7 @@ MHD_run (struct MHD_Daemon *daemon);
2664 * @return #MHD_NO on serious errors, #MHD_YES on success 2672 * @return #MHD_NO on serious errors, #MHD_YES on success
2665 * @ingroup event 2673 * @ingroup event
2666 */ 2674 */
2667_MHD_EXTERN int 2675_MHD_EXTERN enum MHD_Result
2668MHD_run_from_select (struct MHD_Daemon *daemon, 2676MHD_run_from_select (struct MHD_Daemon *daemon,
2669 const fd_set *read_fd_set, 2677 const fd_set *read_fd_set,
2670 const fd_set *write_fd_set, 2678 const fd_set *write_fd_set,
@@ -2737,7 +2745,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection,
2737 * #MHD_YES on success 2745 * #MHD_YES on success
2738 * @ingroup request 2746 * @ingroup request
2739 */ 2747 */
2740_MHD_EXTERN int 2748_MHD_EXTERN enum MHD_Result
2741MHD_set_connection_value (struct MHD_Connection *connection, 2749MHD_set_connection_value (struct MHD_Connection *connection,
2742 enum MHD_ValueKind kind, 2750 enum MHD_ValueKind kind,
2743 const char *key, 2751 const char *key,
@@ -2769,7 +2777,7 @@ MHD_set_connection_value (struct MHD_Connection *connection,
2769 * #MHD_YES on success 2777 * #MHD_YES on success
2770 * @ingroup request 2778 * @ingroup request
2771 */ 2779 */
2772int 2780_MHD_EXTERN enum MHD_Result
2773MHD_set_connection_value_n (struct MHD_Connection *connection, 2781MHD_set_connection_value_n (struct MHD_Connection *connection,
2774 enum MHD_ValueKind kind, 2782 enum MHD_ValueKind kind,
2775 const char *key, 2783 const char *key,
@@ -2846,7 +2854,7 @@ MHD_lookup_connection_value (struct MHD_Connection *connection,
2846 * #MHD_NO otherwise. 2854 * #MHD_NO otherwise.
2847 * @ingroup request 2855 * @ingroup request
2848 */ 2856 */
2849_MHD_EXTERN int 2857_MHD_EXTERN enum MHD_Result
2850MHD_lookup_connection_value_n (struct MHD_Connection *connection, 2858MHD_lookup_connection_value_n (struct MHD_Connection *connection,
2851 enum MHD_ValueKind kind, 2859 enum MHD_ValueKind kind,
2852 const char *key, 2860 const char *key,
@@ -2866,7 +2874,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection,
2866 * #MHD_YES on success or if message has been queued 2874 * #MHD_YES on success or if message has been queued
2867 * @ingroup response 2875 * @ingroup response
2868 */ 2876 */
2869_MHD_EXTERN int 2877_MHD_EXTERN enum MHD_Result
2870MHD_queue_response (struct MHD_Connection *connection, 2878MHD_queue_response (struct MHD_Connection *connection,
2871 unsigned int status_code, 2879 unsigned int status_code,
2872 struct MHD_Response *response); 2880 struct MHD_Response *response);
@@ -2980,7 +2988,7 @@ enum MHD_ResponseOptions
2980 * @param ... #MHD_RO_END terminated list of options 2988 * @param ... #MHD_RO_END terminated list of options
2981 * @return #MHD_YES on success, #MHD_NO on error 2989 * @return #MHD_YES on success, #MHD_NO on error
2982 */ 2990 */
2983_MHD_EXTERN int 2991_MHD_EXTERN enum MHD_Result
2984MHD_set_response_options (struct MHD_Response *response, 2992MHD_set_response_options (struct MHD_Response *response,
2985 enum MHD_ResponseFlags flags, 2993 enum MHD_ResponseFlags flags,
2986 ...); 2994 ...);
@@ -3239,7 +3247,7 @@ struct MHD_UpgradeResponseHandle;
3239 * @param ... arguments to the action (depends on the action) 3247 * @param ... arguments to the action (depends on the action)
3240 * @return #MHD_NO on error, #MHD_YES on success 3248 * @return #MHD_NO on error, #MHD_YES on success
3241 */ 3249 */
3242_MHD_EXTERN int 3250_MHD_EXTERN enum MHD_Result
3243MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, 3251MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
3244 enum MHD_UpgradeAction action, 3252 enum MHD_UpgradeAction action,
3245 ...); 3253 ...);
@@ -3359,7 +3367,7 @@ MHD_destroy_response (struct MHD_Response *response);
3359 * or out of memory 3367 * or out of memory
3360 * @ingroup response 3368 * @ingroup response
3361 */ 3369 */
3362_MHD_EXTERN int 3370_MHD_EXTERN enum MHD_Result
3363MHD_add_response_header (struct MHD_Response *response, 3371MHD_add_response_header (struct MHD_Response *response,
3364 const char *header, 3372 const char *header,
3365 const char *content); 3373 const char *content);
@@ -3374,7 +3382,7 @@ MHD_add_response_header (struct MHD_Response *response,
3374 * @return #MHD_NO on error (i.e. invalid footer or content format). 3382 * @return #MHD_NO on error (i.e. invalid footer or content format).
3375 * @ingroup response 3383 * @ingroup response
3376 */ 3384 */
3377_MHD_EXTERN int 3385_MHD_EXTERN enum MHD_Result
3378MHD_add_response_footer (struct MHD_Response *response, 3386MHD_add_response_footer (struct MHD_Response *response,
3379 const char *footer, 3387 const char *footer,
3380 const char *content); 3388 const char *content);
@@ -3389,7 +3397,7 @@ MHD_add_response_footer (struct MHD_Response *response,
3389 * @return #MHD_NO on error (no such header known) 3397 * @return #MHD_NO on error (no such header known)
3390 * @ingroup response 3398 * @ingroup response
3391 */ 3399 */
3392_MHD_EXTERN int 3400_MHD_EXTERN enum MHD_Result
3393MHD_del_response_header (struct MHD_Response *response, 3401MHD_del_response_header (struct MHD_Response *response,
3394 const char *header, 3402 const char *header,
3395 const char *content); 3403 const char *content);
@@ -3470,7 +3478,7 @@ MHD_create_post_processor (struct MHD_Connection *connection,
3470 * (out-of-memory, iterator aborted, parse error) 3478 * (out-of-memory, iterator aborted, parse error)
3471 * @ingroup request 3479 * @ingroup request
3472 */ 3480 */
3473_MHD_EXTERN int 3481_MHD_EXTERN enum MHD_Result
3474MHD_post_process (struct MHD_PostProcessor *pp, 3482MHD_post_process (struct MHD_PostProcessor *pp,
3475 const char *post_data, size_t post_data_len); 3483 const char *post_data, size_t post_data_len);
3476 3484
@@ -3485,7 +3493,7 @@ MHD_post_process (struct MHD_PostProcessor *pp,
3485 * value of this function 3493 * value of this function
3486 * @ingroup request 3494 * @ingroup request
3487 */ 3495 */
3488_MHD_EXTERN int 3496_MHD_EXTERN enum MHD_Result
3489MHD_destroy_post_processor (struct MHD_PostProcessor *pp); 3497MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
3490 3498
3491 3499
@@ -3665,7 +3673,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
3665 * @return #MHD_YES on success, #MHD_NO otherwise 3673 * @return #MHD_YES on success, #MHD_NO otherwise
3666 * @ingroup authentication 3674 * @ingroup authentication
3667 */ 3675 */
3668_MHD_EXTERN int 3676_MHD_EXTERN enum MHD_Result
3669MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, 3677MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
3670 const char *realm, 3678 const char *realm,
3671 const char *opaque, 3679 const char *opaque,
@@ -3691,7 +3699,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
3691 * @ingroup authentication 3699 * @ingroup authentication
3692 * @deprecated use MHD_queue_auth_fail_response2() 3700 * @deprecated use MHD_queue_auth_fail_response2()
3693 */ 3701 */
3694_MHD_EXTERN int 3702_MHD_EXTERN enum MHD_Result
3695MHD_queue_auth_fail_response (struct MHD_Connection *connection, 3703MHD_queue_auth_fail_response (struct MHD_Connection *connection,
3696 const char *realm, 3704 const char *realm,
3697 const char *opaque, 3705 const char *opaque,
@@ -3777,7 +3785,7 @@ enum MHD_CONNECTION_OPTION
3777 * @return #MHD_YES on success, #MHD_NO if setting the option failed 3785 * @return #MHD_YES on success, #MHD_NO if setting the option failed
3778 * @ingroup specialized 3786 * @ingroup specialized
3779 */ 3787 */
3780_MHD_EXTERN int 3788_MHD_EXTERN enum MHD_Result
3781MHD_set_connection_option (struct MHD_Connection *connection, 3789MHD_set_connection_option (struct MHD_Connection *connection,
3782 enum MHD_CONNECTION_OPTION option, 3790 enum MHD_CONNECTION_OPTION option,
3783 ...); 3791 ...);
@@ -4042,7 +4050,7 @@ enum MHD_FEATURE
4042 * feature is not supported or feature is unknown. 4050 * feature is not supported or feature is unknown.
4043 * @ingroup specialized 4051 * @ingroup specialized
4044 */ 4052 */
4045_MHD_EXTERN int 4053_MHD_EXTERN enum MHD_Result
4046MHD_is_feature_supported (enum MHD_FEATURE feature); 4054MHD_is_feature_supported (enum MHD_FEATURE feature);
4047 4055
4048 4056
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 77ccfbfb..5d4df248 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -388,7 +388,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection,
388 * #MHD_YES on success 388 * #MHD_YES on success
389 * @ingroup request 389 * @ingroup request
390 */ 390 */
391static int 391static enum MHD_Result
392MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection, 392MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection,
393 enum MHD_ValueKind kind, 393 enum MHD_ValueKind kind,
394 const char *key, 394 const char *key,
@@ -449,7 +449,7 @@ MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection,
449 * #MHD_YES on success 449 * #MHD_YES on success
450 * @ingroup request 450 * @ingroup request
451 */ 451 */
452int 452enum MHD_Result
453MHD_set_connection_value_n (struct MHD_Connection *connection, 453MHD_set_connection_value_n (struct MHD_Connection *connection,
454 enum MHD_ValueKind kind, 454 enum MHD_ValueKind kind,
455 const char *key, 455 const char *key,
@@ -496,7 +496,7 @@ MHD_set_connection_value_n (struct MHD_Connection *connection,
496 * #MHD_YES on success 496 * #MHD_YES on success
497 * @ingroup request 497 * @ingroup request
498 */ 498 */
499int 499enum MHD_Result
500MHD_set_connection_value (struct MHD_Connection *connection, 500MHD_set_connection_value (struct MHD_Connection *connection,
501 enum MHD_ValueKind kind, 501 enum MHD_ValueKind kind,
502 const char *key, 502 const char *key,
@@ -562,7 +562,7 @@ MHD_lookup_connection_value (struct MHD_Connection *connection,
562 * #MHD_NO otherwise. 562 * #MHD_NO otherwise.
563 * @ingroup request 563 * @ingroup request
564 */ 564 */
565_MHD_EXTERN int 565_MHD_EXTERN enum MHD_Result
566MHD_lookup_connection_value_n (struct MHD_Connection *connection, 566MHD_lookup_connection_value_n (struct MHD_Connection *connection,
567 enum MHD_ValueKind kind, 567 enum MHD_ValueKind kind,
568 const char *key, 568 const char *key,
@@ -679,9 +679,9 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection,
679 * message for this connection? 679 * message for this connection?
680 * 680 *
681 * @param connection connection to test 681 * @param connection connection to test
682 * @return 0 if we don't need 100 CONTINUE, 1 if we do 682 * @return false if we don't need 100 CONTINUE, true if we do
683 */ 683 */
684static int 684static bool
685need_100_continue (struct MHD_Connection *connection) 685need_100_continue (struct MHD_Connection *connection)
686{ 686{
687 const char *expect; 687 const char *expect;
@@ -880,7 +880,7 @@ connection_close_error (struct MHD_Connection *connection,
880 * lock on the response will have been released already 880 * lock on the response will have been released already
881 * in this case). 881 * in this case).
882 */ 882 */
883static int 883static enum MHD_Result
884try_ready_normal_body (struct MHD_Connection *connection) 884try_ready_normal_body (struct MHD_Connection *connection)
885{ 885{
886 ssize_t ret; 886 ssize_t ret;
@@ -951,7 +951,7 @@ try_ready_normal_body (struct MHD_Connection *connection)
951 * @param connection the connection 951 * @param connection the connection
952 * @return #MHD_NO if readying the response failed 952 * @return #MHD_NO if readying the response failed
953 */ 953 */
954static int 954static enum MHD_Result
955try_ready_chunked_body (struct MHD_Connection *connection) 955try_ready_chunked_body (struct MHD_Connection *connection)
956{ 956{
957 ssize_t ret; 957 ssize_t ret;
@@ -1082,7 +1082,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
1082 * @return #MHD_YES if (based on the request), a keepalive is 1082 * @return #MHD_YES if (based on the request), a keepalive is
1083 * legal 1083 * legal
1084 */ 1084 */
1085static int 1085static enum MHD_Result
1086keepalive_possible (struct MHD_Connection *connection) 1086keepalive_possible (struct MHD_Connection *connection)
1087{ 1087{
1088 if (MHD_CONN_MUST_CLOSE == connection->keepalive) 1088 if (MHD_CONN_MUST_CLOSE == connection->keepalive)
@@ -1248,7 +1248,7 @@ try_grow_read_buffer (struct MHD_Connection *connection,
1248 * @param connection the connection 1248 * @param connection the connection
1249 * @return #MHD_YES on success, #MHD_NO on failure (out of memory) 1249 * @return #MHD_YES on success, #MHD_NO on failure (out of memory)
1250 */ 1250 */
1251static int 1251static enum MHD_Result
1252build_header_response (struct MHD_Connection *connection) 1252build_header_response (struct MHD_Connection *connection)
1253{ 1253{
1254 struct MHD_Response *response = connection->response; 1254 struct MHD_Response *response = connection->response;
@@ -1627,7 +1627,7 @@ transmit_error_response (struct MHD_Connection *connection,
1627 const char *message) 1627 const char *message)
1628{ 1628{
1629 struct MHD_Response *response; 1629 struct MHD_Response *response;
1630 int iret; 1630 enum MHD_Result iret;
1631 1631
1632 if (NULL == connection->version) 1632 if (NULL == connection->version)
1633 { 1633 {
@@ -1933,7 +1933,7 @@ get_next_header_line (struct MHD_Connection *connection,
1933 * @param value_size number of bytes in @a value 1933 * @param value_size number of bytes in @a value
1934 * @return #MHD_NO on failure (out of memory), #MHD_YES for success 1934 * @return #MHD_NO on failure (out of memory), #MHD_YES for success
1935 */ 1935 */
1936static int 1936static enum MHD_Result
1937connection_add_header (struct MHD_Connection *connection, 1937connection_add_header (struct MHD_Connection *connection,
1938 const char *key, 1938 const char *key,
1939 size_t key_size, 1939 size_t key_size,
@@ -1968,7 +1968,7 @@ connection_add_header (struct MHD_Connection *connection,
1968 * @param connection connection to parse header of 1968 * @param connection connection to parse header of
1969 * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory) 1969 * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory)
1970 */ 1970 */
1971static int 1971static enum MHD_Result
1972parse_cookie_header (struct MHD_Connection *connection) 1972parse_cookie_header (struct MHD_Connection *connection)
1973{ 1973{
1974 const char *hdr; 1974 const char *hdr;
@@ -2094,7 +2094,7 @@ parse_cookie_header (struct MHD_Connection *connection)
2094 * @param line_len length of the first @a line 2094 * @param line_len length of the first @a line
2095 * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed 2095 * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed
2096 */ 2096 */
2097static int 2097static enum MHD_Result
2098parse_initial_message_line (struct MHD_Connection *connection, 2098parse_initial_message_line (struct MHD_Connection *connection,
2099 char *line, 2099 char *line,
2100 size_t line_len) 2100 size_t line_len)
@@ -2485,7 +2485,7 @@ process_request_body (struct MHD_Connection *connection)
2485 * @param next_state the next state to transition to 2485 * @param next_state the next state to transition to
2486 * @return #MHD_NO if we are not done, #MHD_YES if we are 2486 * @return #MHD_NO if we are not done, #MHD_YES if we are
2487 */ 2487 */
2488static int 2488static enum MHD_Result
2489check_write_done (struct MHD_Connection *connection, 2489check_write_done (struct MHD_Connection *connection,
2490 enum MHD_CONNECTION_STATE next_state) 2490 enum MHD_CONNECTION_STATE next_state)
2491{ 2491{
@@ -2514,7 +2514,7 @@ check_write_done (struct MHD_Connection *connection,
2514 * @param line line from the header to process 2514 * @param line line from the header to process
2515 * @return #MHD_YES on success, #MHD_NO on error (malformed @a line) 2515 * @return #MHD_YES on success, #MHD_NO on error (malformed @a line)
2516 */ 2516 */
2517static int 2517static enum MHD_Result
2518process_header_line (struct MHD_Connection *connection, 2518process_header_line (struct MHD_Connection *connection,
2519 char *line) 2519 char *line)
2520{ 2520{
@@ -2573,7 +2573,7 @@ process_header_line (struct MHD_Connection *connection,
2573 * of the given kind 2573 * of the given kind
2574 * @return #MHD_YES if the line was processed successfully 2574 * @return #MHD_YES if the line was processed successfully
2575 */ 2575 */
2576static int 2576static enum MHD_Result
2577process_broken_line (struct MHD_Connection *connection, 2577process_broken_line (struct MHD_Connection *connection,
2578 char *line, 2578 char *line,
2579 enum MHD_ValueKind kind) 2579 enum MHD_ValueKind kind)
@@ -2681,7 +2681,7 @@ parse_connection_headers (struct MHD_Connection *connection)
2681 NULL, 2681 NULL,
2682 NULL)) ) 2682 NULL)) )
2683 { 2683 {
2684 int iret; 2684 enum MHD_Result iret;
2685 2685
2686 /* die, http 1.1 request without host and we are pedantic */ 2686 /* die, http 1.1 request without host and we are pedantic */
2687 connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; 2687 connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
@@ -3272,13 +3272,13 @@ cleanup_connection (struct MHD_Connection *connection)
3272 * @return #MHD_YES if we should continue to process the 3272 * @return #MHD_YES if we should continue to process the
3273 * connection (not dead yet), #MHD_NO if it died 3273 * connection (not dead yet), #MHD_NO if it died
3274 */ 3274 */
3275int 3275enum MHD_Result
3276MHD_connection_handle_idle (struct MHD_Connection *connection) 3276MHD_connection_handle_idle (struct MHD_Connection *connection)
3277{ 3277{
3278 struct MHD_Daemon *daemon = connection->daemon; 3278 struct MHD_Daemon *daemon = connection->daemon;
3279 char *line; 3279 char *line;
3280 size_t line_len; 3280 size_t line_len;
3281 int ret; 3281 enum MHD_Result ret;
3282 3282
3283 connection->in_idle = true; 3283 connection->in_idle = true;
3284 while (! connection->suspended) 3284 while (! connection->suspended)
@@ -3763,7 +3763,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
3763 * @return #MHD_YES if we should continue to process the 3763 * @return #MHD_YES if we should continue to process the
3764 * connection (not dead yet), #MHD_NO if it died 3764 * connection (not dead yet), #MHD_NO if it died
3765 */ 3765 */
3766int 3766enum MHD_Result
3767MHD_connection_epoll_update_ (struct MHD_Connection *connection) 3767MHD_connection_epoll_update_ (struct MHD_Connection *connection)
3768{ 3768{
3769 struct MHD_Daemon *daemon = connection->daemon; 3769 struct MHD_Daemon *daemon = connection->daemon;
@@ -3888,7 +3888,7 @@ MHD_get_connection_info (struct MHD_Connection *connection,
3888 * @return #MHD_YES on success, #MHD_NO if setting the option failed 3888 * @return #MHD_YES on success, #MHD_NO if setting the option failed
3889 * @ingroup specialized 3889 * @ingroup specialized
3890 */ 3890 */
3891int 3891enum MHD_Result
3892MHD_set_connection_option (struct MHD_Connection *connection, 3892MHD_set_connection_option (struct MHD_Connection *connection,
3893 enum MHD_CONNECTION_OPTION option, 3893 enum MHD_CONNECTION_OPTION option,
3894 ...) 3894 ...)
@@ -3954,7 +3954,7 @@ MHD_set_connection_option (struct MHD_Connection *connection,
3954 * #MHD_YES on success or if message has been queued 3954 * #MHD_YES on success or if message has been queued
3955 * @ingroup response 3955 * @ingroup response
3956 */ 3956 */
3957int 3957enum MHD_Result
3958MHD_queue_response (struct MHD_Connection *connection, 3958MHD_queue_response (struct MHD_Connection *connection,
3959 unsigned int status_code, 3959 unsigned int status_code,
3960 struct MHD_Response *response) 3960 struct MHD_Response *response)
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 88f31dbd..29724a24 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -114,10 +114,10 @@ MHD_connection_handle_write (struct MHD_Connection *connection);
114 * recv(), send() and response. 114 * recv(), send() and response.
115 * 115 *
116 * @param connection connection to handle 116 * @param connection connection to handle
117 * @return MHD_YES if we should continue to process the 117 * @return #MHD_YES if we should continue to process the
118 * connection (not dead yet), MHD_NO if it died 118 * connection (not dead yet), #MHD_NO if it died
119 */ 119 */
120int 120enum MHD_Result
121MHD_connection_handle_idle (struct MHD_Connection *connection); 121MHD_connection_handle_idle (struct MHD_Connection *connection);
122 122
123 123
@@ -165,10 +165,10 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection);
165 * the epoll set if needed. 165 * the epoll set if needed.
166 * 166 *
167 * @param connection connection to process 167 * @param connection connection to process
168 * @return MHD_YES if we should continue to process the 168 * @return #MHD_YES if we should continue to process the
169 * connection (not dead yet), MHD_NO if it died 169 * connection (not dead yet), #MHD_NO if it died
170 */ 170 */
171int 171enum MHD_Result
172MHD_connection_epoll_update_ (struct MHD_Connection *connection); 172MHD_connection_epoll_update_ (struct MHD_Connection *connection);
173 173
174#endif 174#endif
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 4f7c2108..f23080ef 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -113,7 +113,7 @@ close_all_connections (struct MHD_Daemon *daemon);
113 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 113 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
114 * @return #MHD_NO on serious errors, #MHD_YES on success 114 * @return #MHD_NO on serious errors, #MHD_YES on success
115 */ 115 */
116static int 116static enum MHD_Result
117MHD_epoll (struct MHD_Daemon *daemon, 117MHD_epoll (struct MHD_Daemon *daemon,
118 int may_block); 118 int may_block);
119 119
@@ -361,7 +361,7 @@ MHD_ip_addr_compare (const void *a1,
361 * @param key where to store the parsed address 361 * @param key where to store the parsed address
362 * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type) 362 * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type)
363 */ 363 */
364static int 364static enum MHD_Result
365MHD_ip_addr_to_key (const struct sockaddr *addr, 365MHD_ip_addr_to_key (const struct sockaddr *addr,
366 socklen_t addrlen, 366 socklen_t addrlen,
367 struct MHD_IPCount *key) 367 struct MHD_IPCount *key)
@@ -412,7 +412,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
412 * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit. 412 * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit.
413 * Also returns #MHD_NO if fails to allocate memory. 413 * Also returns #MHD_NO if fails to allocate memory.
414 */ 414 */
415static int 415static enum MHD_Result
416MHD_ip_limit_add (struct MHD_Daemon *daemon, 416MHD_ip_limit_add (struct MHD_Daemon *daemon,
417 const struct sockaddr *addr, 417 const struct sockaddr *addr,
418 socklen_t addrlen) 418 socklen_t addrlen)
@@ -420,7 +420,7 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
420 struct MHD_IPCount *key; 420 struct MHD_IPCount *key;
421 void **nodep; 421 void **nodep;
422 void *node; 422 void *node;
423 int result; 423 enum MHD_Result result;
424 424
425 daemon = MHD_get_master (daemon); 425 daemon = MHD_get_master (daemon);
426 /* Ignore if no connection limit assigned */ 426 /* Ignore if no connection limit assigned */
@@ -723,7 +723,7 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
723 * fit fd_set. 723 * fit fd_set.
724 * @ingroup event 724 * @ingroup event
725 */ 725 */
726int 726enum MHD_Result
727MHD_get_fdset (struct MHD_Daemon *daemon, 727MHD_get_fdset (struct MHD_Daemon *daemon,
728 fd_set *read_fd_set, 728 fd_set *read_fd_set,
729 fd_set *write_fd_set, 729 fd_set *write_fd_set,
@@ -976,7 +976,7 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh,
976 * fit fd_set. 976 * fit fd_set.
977 * @ingroup event 977 * @ingroup event
978 */ 978 */
979static int 979static enum MHD_Result
980internal_get_fdset2 (struct MHD_Daemon *daemon, 980internal_get_fdset2 (struct MHD_Daemon *daemon,
981 fd_set *read_fd_set, 981 fd_set *read_fd_set,
982 fd_set *write_fd_set, 982 fd_set *write_fd_set,
@@ -987,7 +987,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
987{ 987{
988 struct MHD_Connection *pos; 988 struct MHD_Connection *pos;
989 struct MHD_Connection *posn; 989 struct MHD_Connection *posn;
990 int result = MHD_YES; 990 enum MHD_Result result = MHD_YES;
991 MHD_socket ls; 991 MHD_socket ls;
992 992
993 if (daemon->shutdown) 993 if (daemon->shutdown)
@@ -1125,7 +1125,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
1125 * fit fd_set. 1125 * fit fd_set.
1126 * @ingroup event 1126 * @ingroup event
1127 */ 1127 */
1128int 1128enum MHD_Result
1129MHD_get_fdset2 (struct MHD_Daemon *daemon, 1129MHD_get_fdset2 (struct MHD_Daemon *daemon,
1130 fd_set *read_fd_set, 1130 fd_set *read_fd_set,
1131 fd_set *write_fd_set, 1131 fd_set *write_fd_set,
@@ -1191,13 +1191,13 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
1191 * #MHD_NO if a serious error was encountered and the 1191 * #MHD_NO if a serious error was encountered and the
1192 * connection is to be closed. 1192 * connection is to be closed.
1193 */ 1193 */
1194static int 1194static enum MHD_Result
1195call_handlers (struct MHD_Connection *con, 1195call_handlers (struct MHD_Connection *con,
1196 bool read_ready, 1196 bool read_ready,
1197 bool write_ready, 1197 bool write_ready,
1198 bool force_close) 1198 bool force_close)
1199{ 1199{
1200 int ret; 1200 enum MHD_Result ret;
1201 bool states_info_processed = false; 1201 bool states_info_processed = false;
1202 /* Fast track flag */ 1202 /* Fast track flag */
1203 bool on_fasttrack = (con->state == MHD_CONNECTION_INIT); 1203 bool on_fasttrack = (con->state == MHD_CONNECTION_INIT);
@@ -2369,7 +2369,7 @@ psk_gnutls_adapter (gnutls_session_t session,
2369 * The socket will be closed in any case; 'errno' is 2369 * The socket will be closed in any case; 'errno' is
2370 * set to indicate further details about the error. 2370 * set to indicate further details about the error.
2371 */ 2371 */
2372static int 2372static enum MHD_Result
2373internal_add_connection (struct MHD_Daemon *daemon, 2373internal_add_connection (struct MHD_Daemon *daemon,
2374 MHD_socket client_socket, 2374 MHD_socket client_socket,
2375 const struct sockaddr *addr, 2375 const struct sockaddr *addr,
@@ -2969,12 +2969,12 @@ MHD_resume_connection (struct MHD_Connection *connection)
2969 * @param daemon daemon context 2969 * @param daemon daemon context
2970 * @return #MHD_YES if a connection was actually resumed 2970 * @return #MHD_YES if a connection was actually resumed
2971 */ 2971 */
2972static int 2972static enum MHD_Result
2973resume_suspended_connections (struct MHD_Daemon *daemon) 2973resume_suspended_connections (struct MHD_Daemon *daemon)
2974{ 2974{
2975 struct MHD_Connection *pos; 2975 struct MHD_Connection *pos;
2976 struct MHD_Connection *prev = NULL; 2976 struct MHD_Connection *prev = NULL;
2977 int ret; 2977 enum MHD_Result ret;
2978 const bool used_thr_p_c = (0 != (daemon->options 2978 const bool used_thr_p_c = (0 != (daemon->options
2979 & MHD_USE_THREAD_PER_CONNECTION)); 2979 & MHD_USE_THREAD_PER_CONNECTION));
2980#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 2980#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
@@ -3124,7 +3124,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
3124 * set to indicate further details about the error. 3124 * set to indicate further details about the error.
3125 * @ingroup specialized 3125 * @ingroup specialized
3126 */ 3126 */
3127int 3127enum MHD_Result
3128MHD_add_connection (struct MHD_Daemon *daemon, 3128MHD_add_connection (struct MHD_Daemon *daemon,
3129 MHD_socket client_socket, 3129 MHD_socket client_socket,
3130 const struct sockaddr *addr, 3130 const struct sockaddr *addr,
@@ -3185,7 +3185,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
3185 * a return code of #MHD_NO only refers to the actual 3185 * a return code of #MHD_NO only refers to the actual
3186 * accept() system call. 3186 * accept() system call.
3187 */ 3187 */
3188static int 3188static enum MHD_Result
3189MHD_accept_connection (struct MHD_Daemon *daemon) 3189MHD_accept_connection (struct MHD_Daemon *daemon)
3190{ 3190{
3191#if HAVE_INET6 3191#if HAVE_INET6
@@ -3443,7 +3443,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
3443 * necessitate the use of a timeout right now). 3443 * necessitate the use of a timeout right now).
3444 * @ingroup event 3444 * @ingroup event
3445 */ 3445 */
3446int 3446enum MHD_Result
3447MHD_get_timeout (struct MHD_Daemon *daemon, 3447MHD_get_timeout (struct MHD_Daemon *daemon,
3448 MHD_UNSIGNED_LONG_LONG *timeout) 3448 MHD_UNSIGNED_LONG_LONG *timeout)
3449{ 3449{
@@ -3533,7 +3533,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
3533 * @return #MHD_NO on serious errors, #MHD_YES on success 3533 * @return #MHD_NO on serious errors, #MHD_YES on success
3534 * @ingroup event 3534 * @ingroup event
3535 */ 3535 */
3536static int 3536static enum MHD_Result
3537internal_run_from_select (struct MHD_Daemon *daemon, 3537internal_run_from_select (struct MHD_Daemon *daemon,
3538 const fd_set *read_fd_set, 3538 const fd_set *read_fd_set,
3539 const fd_set *write_fd_set, 3539 const fd_set *write_fd_set,
@@ -3637,7 +3637,7 @@ internal_run_from_select (struct MHD_Daemon *daemon,
3637 * @return #MHD_NO on serious errors, #MHD_YES on success 3637 * @return #MHD_NO on serious errors, #MHD_YES on success
3638 * @ingroup event 3638 * @ingroup event
3639 */ 3639 */
3640int 3640enum MHD_Result
3641MHD_run_from_select (struct MHD_Daemon *daemon, 3641MHD_run_from_select (struct MHD_Daemon *daemon,
3642 const fd_set *read_fd_set, 3642 const fd_set *read_fd_set,
3643 const fd_set *write_fd_set, 3643 const fd_set *write_fd_set,
@@ -3662,8 +3662,8 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
3662 if (0 != (daemon->options & MHD_USE_EPOLL)) 3662 if (0 != (daemon->options & MHD_USE_EPOLL))
3663 { 3663 {
3664#ifdef EPOLL_SUPPORT 3664#ifdef EPOLL_SUPPORT
3665 int ret = MHD_epoll (daemon, 3665 enum MHD_Result ret = MHD_epoll (daemon,
3666 MHD_NO); 3666 MHD_NO);
3667 3667
3668 MHD_cleanup_connections (daemon); 3668 MHD_cleanup_connections (daemon);
3669 return ret; 3669 return ret;
@@ -3691,7 +3691,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
3691 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 3691 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
3692 * @return #MHD_NO on serious errors, #MHD_YES on success 3692 * @return #MHD_NO on serious errors, #MHD_YES on success
3693 */ 3693 */
3694static int 3694static enum MHD_Result
3695MHD_select (struct MHD_Daemon *daemon, 3695MHD_select (struct MHD_Daemon *daemon,
3696 int may_block) 3696 int may_block)
3697{ 3697{
@@ -3860,7 +3860,7 @@ MHD_select (struct MHD_Daemon *daemon,
3860 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 3860 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
3861 * @return #MHD_NO on serious errors, #MHD_YES on success 3861 * @return #MHD_NO on serious errors, #MHD_YES on success
3862 */ 3862 */
3863static int 3863static enum MHD_Result
3864MHD_poll_all (struct MHD_Daemon *daemon, 3864MHD_poll_all (struct MHD_Daemon *daemon,
3865 int may_block) 3865 int may_block)
3866{ 3866{
@@ -4075,7 +4075,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
4075 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 4075 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
4076 * @return #MHD_NO on serious errors, #MHD_YES on success 4076 * @return #MHD_NO on serious errors, #MHD_YES on success
4077 */ 4077 */
4078static int 4078static enum MHD_Result
4079MHD_poll_listen_socket (struct MHD_Daemon *daemon, 4079MHD_poll_listen_socket (struct MHD_Daemon *daemon,
4080 int may_block) 4080 int may_block)
4081{ 4081{
@@ -4159,7 +4159,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
4159 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 4159 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
4160 * @return #MHD_NO on serious errors, #MHD_YES on success 4160 * @return #MHD_NO on serious errors, #MHD_YES on success
4161 */ 4161 */
4162static int 4162static enum MHD_Result
4163MHD_poll (struct MHD_Daemon *daemon, 4163MHD_poll (struct MHD_Daemon *daemon,
4164 int may_block) 4164 int may_block)
4165{ 4165{
@@ -4238,7 +4238,7 @@ is_urh_ready (struct MHD_UpgradeResponseHandle *const urh)
4238 * @remark To be called only from thread that process 4238 * @remark To be called only from thread that process
4239 * daemon's select()/poll()/etc. 4239 * daemon's select()/poll()/etc.
4240 */ 4240 */
4241static int 4241static enum MHD_Result
4242run_epoll_for_upgrade (struct MHD_Daemon *daemon) 4242run_epoll_for_upgrade (struct MHD_Daemon *daemon)
4243{ 4243{
4244 struct epoll_event events[MAX_EVENTS]; 4244 struct epoll_event events[MAX_EVENTS];
@@ -4357,7 +4357,7 @@ static const char *const epoll_itc_marker = "itc_marker";
4357 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 4357 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
4358 * @return #MHD_NO on serious errors, #MHD_YES on success 4358 * @return #MHD_NO on serious errors, #MHD_YES on success
4359 */ 4359 */
4360static int 4360static enum MHD_Result
4361MHD_epoll (struct MHD_Daemon *daemon, 4361MHD_epoll (struct MHD_Daemon *daemon,
4362 int may_block) 4362 int may_block)
4363{ 4363{
@@ -4673,7 +4673,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
4673 * options for this call. 4673 * options for this call.
4674 * @ingroup event 4674 * @ingroup event
4675 */ 4675 */
4676int 4676enum MHD_Result
4677MHD_run (struct MHD_Daemon *daemon) 4677MHD_run (struct MHD_Daemon *daemon)
4678{ 4678{
4679 if ( (daemon->shutdown) || 4679 if ( (daemon->shutdown) ||
@@ -4967,7 +4967,7 @@ typedef void
4967 * @param ap the options 4967 * @param ap the options
4968 * @return #MHD_YES on success, #MHD_NO on error 4968 * @return #MHD_YES on success, #MHD_NO on error
4969 */ 4969 */
4970static int 4970static enum MHD_Result
4971parse_options_va (struct MHD_Daemon *daemon, 4971parse_options_va (struct MHD_Daemon *daemon,
4972 const struct sockaddr **servaddr, 4972 const struct sockaddr **servaddr,
4973 va_list ap); 4973 va_list ap);
@@ -4981,13 +4981,13 @@ parse_options_va (struct MHD_Daemon *daemon,
4981 * @param ... the options 4981 * @param ... the options
4982 * @return #MHD_YES on success, #MHD_NO on error 4982 * @return #MHD_YES on success, #MHD_NO on error
4983 */ 4983 */
4984static int 4984static enum MHD_Result
4985parse_options (struct MHD_Daemon *daemon, 4985parse_options (struct MHD_Daemon *daemon,
4986 const struct sockaddr **servaddr, 4986 const struct sockaddr **servaddr,
4987 ...) 4987 ...)
4988{ 4988{
4989 va_list ap; 4989 va_list ap;
4990 int ret; 4990 enum MHD_Result ret;
4991 4991
4992 va_start (ap, servaddr); 4992 va_start (ap, servaddr);
4993 ret = parse_options_va (daemon, 4993 ret = parse_options_va (daemon,
@@ -5006,7 +5006,7 @@ parse_options (struct MHD_Daemon *daemon,
5006 * @param ap the options 5006 * @param ap the options
5007 * @return #MHD_YES on success, #MHD_NO on error 5007 * @return #MHD_YES on success, #MHD_NO on error
5008 */ 5008 */
5009static int 5009static enum MHD_Result
5010parse_options_va (struct MHD_Daemon *daemon, 5010parse_options_va (struct MHD_Daemon *daemon,
5011 const struct sockaddr **servaddr, 5011 const struct sockaddr **servaddr,
5012 va_list ap) 5012 va_list ap)
@@ -5016,7 +5016,7 @@ parse_options_va (struct MHD_Daemon *daemon,
5016 unsigned int i; 5016 unsigned int i;
5017 unsigned int uv; 5017 unsigned int uv;
5018#ifdef HTTPS_SUPPORT 5018#ifdef HTTPS_SUPPORT
5019 int ret; 5019 enum MHD_Result ret;
5020 const char *pstr; 5020 const char *pstr;
5021#if GNUTLS_VERSION_MAJOR >= 3 5021#if GNUTLS_VERSION_MAJOR >= 3
5022 gnutls_certificate_retrieve_function2 *pgcrf; 5022 gnutls_certificate_retrieve_function2 *pgcrf;
@@ -5614,7 +5614,7 @@ setup_epoll_fd (struct MHD_Daemon *daemon)
5614 * @param daemon daemon to initialize for epoll() 5614 * @param daemon daemon to initialize for epoll()
5615 * @return #MHD_YES on success, #MHD_NO on failure 5615 * @return #MHD_YES on success, #MHD_NO on failure
5616 */ 5616 */
5617static int 5617static enum MHD_Result
5618setup_epoll_to_listen (struct MHD_Daemon *daemon) 5618setup_epoll_to_listen (struct MHD_Daemon *daemon)
5619{ 5619{
5620 struct epoll_event event; 5620 struct epoll_event event;
@@ -7093,7 +7093,7 @@ MHD_get_version (void)
7093 * feature is not supported or feature is unknown. 7093 * feature is not supported or feature is unknown.
7094 * @ingroup specialized 7094 * @ingroup specialized
7095 */ 7095 */
7096_MHD_EXTERN int 7096enum MHD_Result
7097MHD_is_feature_supported (enum MHD_FEATURE feature) 7097MHD_is_feature_supported (enum MHD_FEATURE feature)
7098{ 7098{
7099 switch (feature) 7099 switch (feature)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index b6a684a4..1fc931ad 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -521,7 +521,7 @@ lookup_sub_value (char *dest,
521 * @param nc The nonce counter, zero to add the nonce to the array 521 * @param nc The nonce counter, zero to add the nonce to the array
522 * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array) 522 * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array)
523 */ 523 */
524static int 524static enum MHD_Result
525check_nonce_nc (struct MHD_Connection *connection, 525check_nonce_nc (struct MHD_Connection *connection,
526 const char *nonce, 526 const char *nonce,
527 uint64_t nc) 527 uint64_t nc)
@@ -743,7 +743,7 @@ calculate_nonce (uint32_t nonce_time,
743 * @return #MHD_YES if the key-value pair is in the headers, 743 * @return #MHD_YES if the key-value pair is in the headers,
744 * #MHD_NO if not 744 * #MHD_NO if not
745 */ 745 */
746static int 746static enum MHD_Result
747test_header (struct MHD_Connection *connection, 747test_header (struct MHD_Connection *connection,
748 const char *key, 748 const char *key,
749 size_t key_size, 749 size_t key_size,
@@ -790,14 +790,14 @@ test_header (struct MHD_Connection *connection,
790 * @return #MHD_YES if the arguments match, 790 * @return #MHD_YES if the arguments match,
791 * #MHD_NO if not 791 * #MHD_NO if not
792 */ 792 */
793static int 793static enum MHD_Result
794check_argument_match (struct MHD_Connection *connection, 794check_argument_match (struct MHD_Connection *connection,
795 const char *args) 795 const char *args)
796{ 796{
797 struct MHD_HTTP_Header *pos; 797 struct MHD_HTTP_Header *pos;
798 char *argb; 798 char *argb;
799 unsigned int num_headers; 799 unsigned int num_headers;
800 int ret; 800 enum MHD_Result ret;
801 801
802 argb = strdup (args); 802 argb = strdup (args);
803 if (NULL == argb) 803 if (NULL == argb)
@@ -1338,7 +1338,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
1338 * @return #MHD_YES on success, #MHD_NO otherwise 1338 * @return #MHD_YES on success, #MHD_NO otherwise
1339 * @ingroup authentication 1339 * @ingroup authentication
1340 */ 1340 */
1341int 1341enum MHD_Result
1342MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, 1342MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
1343 const char *realm, 1343 const char *realm,
1344 const char *opaque, 1344 const char *opaque,
@@ -1461,7 +1461,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
1461 * @return #MHD_YES on success, #MHD_NO otherwise 1461 * @return #MHD_YES on success, #MHD_NO otherwise
1462 * @ingroup authentication 1462 * @ingroup authentication
1463 */ 1463 */
1464int 1464enum MHD_Result
1465MHD_queue_auth_fail_response (struct MHD_Connection *connection, 1465MHD_queue_auth_fail_response (struct MHD_Connection *connection,
1466 const char *realm, 1466 const char *realm,
1467 const char *opaque, 1467 const char *opaque,
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index b8d8f540..ba601fa0 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -184,7 +184,7 @@ MHD_http_unescape (char *val)
184 * #MHD_YES for success (parsing succeeded, @a cb always 184 * #MHD_YES for success (parsing succeeded, @a cb always
185 * returned #MHD_YES) 185 * returned #MHD_YES)
186 */ 186 */
187int 187enum MHD_Result
188MHD_parse_arguments_ (struct MHD_Connection *connection, 188MHD_parse_arguments_ (struct MHD_Connection *connection,
189 enum MHD_ValueKind kind, 189 enum MHD_ValueKind kind,
190 char *args, 190 char *args,
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index ad16535e..d5d9b0d1 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1910,7 +1910,7 @@ MHD_unescape_plus (char *arg);
1910 * @return #MHD_YES on success (continue to iterate) 1910 * @return #MHD_YES on success (continue to iterate)
1911 * #MHD_NO to signal failure (and abort iteration) 1911 * #MHD_NO to signal failure (and abort iteration)
1912 */ 1912 */
1913typedef int 1913typedef enum MHD_Result
1914(*MHD_ArgumentIterator_)(struct MHD_Connection *connection, 1914(*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
1915 const char *key, 1915 const char *key,
1916 size_t key_size, 1916 size_t key_size,
@@ -1933,7 +1933,7 @@ typedef int
1933 * #MHD_YES for success (parsing succeeded, @a cb always 1933 * #MHD_YES for success (parsing succeeded, @a cb always
1934 * returned #MHD_YES) 1934 * returned #MHD_YES)
1935 */ 1935 */
1936int 1936enum MHD_Result
1937MHD_parse_arguments_ (struct MHD_Connection *connection, 1937MHD_parse_arguments_ (struct MHD_Connection *connection,
1938 enum MHD_ValueKind kind, 1938 enum MHD_ValueKind kind,
1939 char *args, 1939 char *args,
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index b7f6b108..0069147b 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -176,7 +176,7 @@ struct MHD_PostProcessor
176 * Value data left over from previous iteration. 176 * Value data left over from previous iteration.
177 */ 177 */
178 char xbuf[2]; 178 char xbuf[2];
179 179
180 /** 180 /**
181 * Size of our buffer for the key. 181 * Size of our buffer for the key.
182 */ 182 */
@@ -220,9 +220,9 @@ struct MHD_PostProcessor
220 /** 220 /**
221 * Set if we still need to run the unescape logic 221 * Set if we still need to run the unescape logic
222 * on the key allocated at the end of this struct. 222 * on the key allocated at the end of this struct.
223 */ 223 */
224 bool must_unescape_key; 224 bool must_unescape_key;
225 225
226 /** 226 /**
227 * State of the parser. 227 * State of the parser.
228 */ 228 */
@@ -478,7 +478,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
478 (pp->state == PP_Callback) ) && 478 (pp->state == PP_Callback) ) &&
479 (pp->state != PP_Error) ) 479 (pp->state != PP_Error) )
480 { 480 {
481 switch (pp->state) { 481 switch (pp->state)
482 {
482 case PP_Error: 483 case PP_Error:
483 /* clearly impossible as per while loop invariant */ 484 /* clearly impossible as per while loop invariant */
484 abort (); 485 abort ();
@@ -520,7 +521,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
520 case PP_ProcessValue: 521 case PP_ProcessValue:
521 if (NULL == start_value) 522 if (NULL == start_value)
522 start_value = &post_data[poff]; 523 start_value = &post_data[poff];
523 switch (post_data[poff]) { 524 switch (post_data[poff])
525 {
524 case '=': 526 case '=':
525 /* case 'key==' */ 527 /* case 'key==' */
526 pp->state = PP_Error; 528 pp->state = PP_Error;
@@ -529,8 +531,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
529 /* case 'value&' */ 531 /* case 'value&' */
530 end_value = &post_data[poff]; 532 end_value = &post_data[poff];
531 poff++; 533 poff++;
532 if ( pp->must_ikvi || 534 if (pp->must_ikvi ||
533 (start_value != end_value) ) 535 (start_value != end_value) )
534 { 536 {
535 pp->state = PP_Callback; 537 pp->state = PP_Callback;
536 } 538 }
@@ -538,7 +540,7 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
538 { 540 {
539 pp->buffer_pos = 0; 541 pp->buffer_pos = 0;
540 pp->value_offset = 0; 542 pp->value_offset = 0;
541 pp->state = PP_Init; 543 pp->state = PP_Init;
542 } 544 }
543 continue; 545 continue;
544 case '\n': 546 case '\n':
@@ -576,7 +578,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
576 } 578 }
577 break; /* end PP_ProcessValue */ 579 break; /* end PP_ProcessValue */
578 case PP_Done: 580 case PP_Done:
579 switch (post_data[poff]) { 581 switch (post_data[poff])
582 {
580 case '\n': 583 case '\n':
581 case '\r': 584 case '\r':
582 poff++; 585 poff++;
@@ -632,9 +635,9 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
632 } 635 }
633 636
634 /* save remaining data for next iteration */ 637 /* save remaining data for next iteration */
635 if (NULL != start_key) 638 if (NULL != start_key)
636 { 639 {
637 if (NULL == end_key) 640 if (NULL == end_key)
638 end_key = &post_data[poff]; 641 end_key = &post_data[poff];
639 memcpy (&kbuf[pp->buffer_pos], 642 memcpy (&kbuf[pp->buffer_pos],
640 start_key, 643 start_key,
@@ -1366,7 +1369,7 @@ END:
1366 * (out-of-memory, iterator aborted, parse error) 1369 * (out-of-memory, iterator aborted, parse error)
1367 * @ingroup request 1370 * @ingroup request
1368 */ 1371 */
1369int 1372enum MHD_Result
1370MHD_post_process (struct MHD_PostProcessor *pp, 1373MHD_post_process (struct MHD_PostProcessor *pp,
1371 const char *post_data, 1374 const char *post_data,
1372 size_t post_data_len) 1375 size_t post_data_len)
@@ -1404,10 +1407,10 @@ MHD_post_process (struct MHD_PostProcessor *pp,
1404 * value of this function 1407 * value of this function
1405 * @ingroup request 1408 * @ingroup request
1406 */ 1409 */
1407int 1410enum MHD_Result
1408MHD_destroy_post_processor (struct MHD_PostProcessor *pp) 1411MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
1409{ 1412{
1410 int ret; 1413 enum MHD_Result ret;
1411 1414
1412 if (NULL == pp) 1415 if (NULL == pp)
1413 return MHD_YES; 1416 return MHD_YES;
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 5adfdfa9..abedefcf 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -78,7 +78,7 @@
78 * @param content value to add 78 * @param content value to add
79 * @return #MHD_NO on error (i.e. invalid header or content format). 79 * @return #MHD_NO on error (i.e. invalid header or content format).
80 */ 80 */
81static int 81static enum MHD_Result
82add_response_entry (struct MHD_Response *response, 82add_response_entry (struct MHD_Response *response,
83 enum MHD_ValueKind kind, 83 enum MHD_ValueKind kind,
84 const char *header, 84 const char *header,
@@ -129,7 +129,7 @@ add_response_entry (struct MHD_Response *response,
129 * @return #MHD_NO on error (i.e. invalid header or content format). 129 * @return #MHD_NO on error (i.e. invalid header or content format).
130 * @ingroup response 130 * @ingroup response
131 */ 131 */
132int 132enum MHD_Result
133MHD_add_response_header (struct MHD_Response *response, 133MHD_add_response_header (struct MHD_Response *response,
134 const char *header, 134 const char *header,
135 const char *content) 135 const char *content)
@@ -173,7 +173,7 @@ MHD_add_response_header (struct MHD_Response *response,
173 * @return #MHD_NO on error (i.e. invalid footer or content format). 173 * @return #MHD_NO on error (i.e. invalid footer or content format).
174 * @ingroup response 174 * @ingroup response
175 */ 175 */
176int 176enum MHD_Result
177MHD_add_response_footer (struct MHD_Response *response, 177MHD_add_response_footer (struct MHD_Response *response,
178 const char *footer, 178 const char *footer,
179 const char *content) 179 const char *content)
@@ -194,7 +194,7 @@ MHD_add_response_footer (struct MHD_Response *response,
194 * @return #MHD_NO on error (no such header known) 194 * @return #MHD_NO on error (no such header known)
195 * @ingroup response 195 * @ingroup response
196 */ 196 */
197int 197enum MHD_Result
198MHD_del_response_header (struct MHD_Response *response, 198MHD_del_response_header (struct MHD_Response *response,
199 const char *header, 199 const char *header,
200 const char *content) 200 const char *content)
@@ -412,13 +412,13 @@ MHD_create_response_from_callback (uint64_t size,
412 * @param ... #MHD_RO_END terminated list of options 412 * @param ... #MHD_RO_END terminated list of options
413 * @return #MHD_YES on success, #MHD_NO on error 413 * @return #MHD_YES on success, #MHD_NO on error
414 */ 414 */
415int 415enum MHD_Result
416MHD_set_response_options (struct MHD_Response *response, 416MHD_set_response_options (struct MHD_Response *response,
417 enum MHD_ResponseFlags flags, 417 enum MHD_ResponseFlags flags,
418 ...) 418 ...)
419{ 419{
420 va_list ap; 420 va_list ap;
421 int ret; 421 enum MHD_Result ret;
422 enum MHD_ResponseOptions ro; 422 enum MHD_ResponseOptions ro;
423 423
424 ret = MHD_YES; 424 ret = MHD_YES;
@@ -788,7 +788,7 @@ MHD_create_response_from_buffer_with_free_callback (size_t size,
788 * @param ... arguments to the action (depends on the action) 788 * @param ... arguments to the action (depends on the action)
789 * @return #MHD_NO on error, #MHD_YES on success 789 * @return #MHD_NO on error, #MHD_YES on success
790 */ 790 */
791_MHD_EXTERN int 791_MHD_EXTERN enum MHD_Result
792MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, 792MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
793 enum MHD_UpgradeAction action, 793 enum MHD_UpgradeAction action,
794 ...) 794 ...)
@@ -894,7 +894,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
894 * @return #MHD_YES on success, #MHD_NO on failure (will cause 894 * @return #MHD_YES on success, #MHD_NO on failure (will cause
895 * connection to be closed) 895 * connection to be closed)
896 */ 896 */
897int 897enum MHD_Result
898MHD_response_execute_upgrade_ (struct MHD_Response *response, 898MHD_response_execute_upgrade_ (struct MHD_Response *response,
899 struct MHD_Connection *connection) 899 struct MHD_Connection *connection)
900{ 900{
diff --git a/src/microhttpd/response.h b/src/microhttpd/response.h
index 3f4717de..03448e56 100644
--- a/src/microhttpd/response.h
+++ b/src/microhttpd/response.h
@@ -49,7 +49,7 @@ MHD_increment_response_rc (struct MHD_Response *response);
49 * @return #MHD_YES on success, #MHD_NO on failure (will cause 49 * @return #MHD_YES on success, #MHD_NO on failure (will cause
50 * connection to be closed) 50 * connection to be closed)
51 */ 51 */
52int 52enum MHD_Result
53MHD_response_execute_upgrade_ (struct MHD_Response *response, 53MHD_response_execute_upgrade_ (struct MHD_Response *response,
54 struct MHD_Connection *connection); 54 struct MHD_Connection *connection);
55 55