libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 6347f514aa2388e774d5bf356df8046864e5f73c
parent 6702e6202368720d7a381669c03eedc318f225ca
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed,  8 Apr 2020 22:59:05 +0200

introduce 'enum MHD_Result'

Diffstat:
MChangeLog | 3+++
Mdoc/libmicrohttpd.texi | 50+++++++++++++++++++++++++-------------------------
Msrc/include/microhttpd.h | 134++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Msrc/microhttpd/connection.c | 46+++++++++++++++++++++++-----------------------
Msrc/microhttpd/connection.h | 12++++++------
Msrc/microhttpd/daemon.c | 68++++++++++++++++++++++++++++++++++----------------------------------
Msrc/microhttpd/digestauth.c | 12++++++------
Msrc/microhttpd/internal.c | 2+-
Msrc/microhttpd/internal.h | 4++--
Msrc/microhttpd/postprocessor.c | 31+++++++++++++++++--------------
Msrc/microhttpd/response.c | 16++++++++--------
Msrc/microhttpd/response.h | 2+-
12 files changed, 197 insertions(+), 183 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +Wed 08 Apr 2020 10:53:01 PM CEST + Introduce `enum MHD_Result` for #MHD_YES/#MHD_NO to avoid using 'int' so much. -CG + Sat 07 Mar 2020 05:20:33 PM CET Fixed #6090 (misc. severe socket handling bugs on OS X). -CG diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi @@ -1284,7 +1284,7 @@ Information about an MHD daemon. @chapter Callback functions definition -@deftypefn {Function Pointer} int {*MHD_AcceptPolicyCallback} (void *cls, const struct sockaddr * addr, socklen_t addrlen) +@deftypefn {Function Pointer} enum MHD_Result {*MHD_AcceptPolicyCallback} (void *cls, const struct sockaddr * addr, socklen_t addrlen) Invoked in the context of a connection to allow or deny a client to connect. This callback return @code{MHD_YES} if connection is allowed, @code{MHD_NO} if not. @@ -1300,7 +1300,7 @@ length of the address information. @end deftypefn -@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) +@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) Invoked in the context of a connection to answer a request from the client. This callback must call MHD functions (example: the @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}. @end deftypefn -@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size) +@deftypefn {Function Pointer} enum MHD_Result {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size) Iterator over key-value pairs. This iterator can be used to iterate over all of the cookies, headers, or @code{POST}-data fields of a request, and also to iterate over the headers that have been added to a @@ -1440,7 +1440,7 @@ iteration. @end deftypefn -@deftypefn {Function Pointer} int {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max) +@deftypefn {Function Pointer} ssize_t {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max) Callback used by MHD in order to obtain content. The callback has to copy at most @var{max} bytes of content into @var{buf}. The total number 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. @end deftypefn -@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) +@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) Iterator over key-value pairs where the value maybe made available in increments and/or may not be zero-terminated. Used for processing @code{POST} data. @@ -1587,7 +1587,7 @@ Return @code{NULL} on error, handle to daemon on success. @end deftypefun -@deftypefun int MHD_quiesce_daemon (struct MHD_Daemon *daemon) +@deftypefun MHD_socket MHD_quiesce_daemon (struct MHD_Daemon *daemon) @cindex quiesce Stop accepting connections from the listening socket. Allows clients to continue processing, but stops accepting new connections. Note @@ -1613,7 +1613,7 @@ Shutdown an HTTP daemon. @end deftypefun -@deftypefun int MHD_run (struct MHD_Daemon *daemon) +@deftypefun enum MHD_Result MHD_run (struct MHD_Daemon *daemon) Run webserver operations (without blocking unless in client callbacks). This method should be called by clients in combination with @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. @end deftypefun -@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) +@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) Run webserver operations given sets of ready socket handles. @cindex select @@ -1710,7 +1710,7 @@ to indicate further details about the error. @chapter Implementing external @code{select} -@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) +@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) Obtain the @code{select()} sets for this daemon. The daemon's socket is added to @var{read_fd_set}. The list of currently existent connections is scanned and their file descriptors added to the correct @@ -1736,12 +1736,12 @@ the right options for this call. @end deftypefun -@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) +@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) Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application. @end deftypefun -@deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) +@deftypefun enum MHD_Result MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) @cindex timeout Obtain timeout value for select for this daemon (only needed if connection timeout is used). The returned value is how many @@ -1802,7 +1802,7 @@ would contain the string ``key''. @end deftypefun -@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value) +@deftypefun enum MHD_Result MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value) This function can be used to append an entry to the list of HTTP headers of a connection (so that the @code{MHD_get_connection_values function} will return @@ -1884,7 +1884,7 @@ response and we finally destroy it only when the daemon shuts down. @section Enqueuing a response -@deftypefun int MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response) +@deftypefun enum MHD_Result MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response) Queue a response to be transmitted to the client as soon as possible but only after MHD_AccessHandlerCallback returns. This function checks that it is legal to queue a response at this time for the @@ -2148,7 +2148,7 @@ MHD_destroy_response(response); @section Adding headers to a response -@deftypefun int MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) +@deftypefun enum MHD_Result MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) Add a header line to the response. The strings referenced by @var{header} and @var{content} must be zero-terminated and they are duplicated into memory blocks embedded in @var{response}. @@ -2172,7 +2172,7 @@ memory allocation error). @end deftypefun -@deftypefun int MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content) +@deftypefun enum MHD_Result MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content) Add a footer line to the response. The strings referenced by @var{footer} and @var{content} must be zero-terminated and they are duplicated into memory blocks embedded in @var{response}. @@ -2190,7 +2190,7 @@ memory allocation error). -@deftypefun int MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) +@deftypefun enum MHD_Result MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) Delete a header (or footer) line from the response. Return @code{MHD_NO} on error (arguments are invalid or no such header known). @end deftypefun @@ -2201,7 +2201,7 @@ Delete a header (or footer) line from the response. Return @code{MHD_NO} on err @section Setting response options -@deftypefun int MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...) +@deftypefun enum MHD_Result MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...) Set special flags and options for a response. Calling this functions sets the given flags and options for the response. @@ -2281,7 +2281,7 @@ a connection by queueing a response (using the have been created with the following function: -@deftypefun int MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls) +@deftypefun enum MHD_Result MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls) Create a response suitable for switching protocols. Returns @code{MHD_YES} on success. @code{upgrade_handler} must not be @code{NULL}. When creating this type of response, the ``Connection: Upgrade'' @@ -2322,7 +2322,7 @@ argument for calls to @code{MHD_upgrade_action}. Applications must eventually u @end deftypefn -@deftypefun int MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...) +@deftypefun enum MHD_Result MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...) Perform special operations related to upgraded connections. @table @var @@ -2374,7 +2374,7 @@ Instead, applications using thread modes other than @code{MHD_USE_THREAD_PER_CONNECTION} should use the following functions to perform flow control. -@deftypefun int MHD_suspend_connection (struct MHD_Connection *connection) +@deftypefun enum MHD_Result MHD_suspend_connection (struct MHD_Connection *connection) Suspend handling of network data for a given connection. This can be used to dequeue a connection from MHD's event loop (external select, internal select or thread pool; not applicable to @@ -2408,7 +2408,7 @@ the connection to suspend @end table @end deftypefun -@deftypefun int MHD_resume_connection (struct MHD_Connection *connection) +@deftypefun enum MHD_Result MHD_resume_connection (struct MHD_Connection *connection) Resume handling of network data for suspended connection. It is safe to resume a suspended connection at any time. Calling this function on 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. @end deftypefun -@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) +@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) Queues a response to request authentication from the client, return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. @@ -2626,7 +2626,7 @@ must then be selected when checking digests received from clients! @end deftypefun -@deftypefun int MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale) +@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) Queues a response to request authentication from the client, return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. @@ -2847,7 +2847,7 @@ a PP handle. @end deftypefun -@deftypefun int MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len) +@deftypefun enum MHD_Result MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len) Parse and process @code{POST} data. Call this function when @code{POST} data is available (usually during an @code{MHD_AccessHandlerCallback}) with 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 @end deftypefun -@deftypefun int MHD_destroy_post_processor (struct MHD_PostProcessor *pp) +@deftypefun enum MHD_Result MHD_destroy_post_processor (struct MHD_PostProcessor *pp) Release PostProcessor resources. After this function is being called, the PostProcessor is guaranteed to no longer call its iterator. There is 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 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2006--2019 Christian Grothoff (and other contributing authors) + Copyright (C) 2006--2020 Christian Grothoff (and other contributing authors) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -135,14 +135,22 @@ typedef intptr_t ssize_t; #define MHD_VERSION 0x00097001 /** - * MHD-internal return code for "YES". + * Operational results from MHD calls. */ -#define MHD_YES 1 +enum MHD_Result +{ + /** + * MHD result code for "NO". + */ + MHD_NO = 0, + + /** + * MHD result code for "YES". + */ + MHD_YES = 1 + +}; -/** - * MHD-internal return code for "NO". - */ -#define MHD_NO 0 /** * MHD digest auth internal code for an invalid nonce. @@ -2118,10 +2126,10 @@ typedef void * @param addrlen length of @a addr * @return #MHD_YES if connection is allowed, #MHD_NO if not */ -typedef int -(*MHD_AcceptPolicyCallback) (void *cls, - const struct sockaddr *addr, - socklen_t addrlen); +typedef enum MHD_Result +(*MHD_AcceptPolicyCallback)(void *cls, + const struct sockaddr *addr, + socklen_t addrlen); /** @@ -2163,15 +2171,15 @@ typedef int * #MHD_NO if the socket must be closed due to a serios * error while handling the request */ -typedef 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); +typedef 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); /** @@ -2234,11 +2242,11 @@ typedef void * #MHD_NO to abort the iteration * @ingroup request */ -typedef int -(*MHD_KeyValueIterator) (void *cls, - enum MHD_ValueKind kind, - const char *key, - const char *value); +typedef enum MHD_Result +(*MHD_KeyValueIterator)(void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *value); /** @@ -2259,13 +2267,13 @@ typedef int * #MHD_NO to abort the iteration * @ingroup request */ -typedef int -(*MHD_KeyValueIteratorN) (void *cls, - enum MHD_ValueKind kind, - const char *key, - size_t key_size, - const char *value, - size_t value_size); +typedef enum MHD_Result +(*MHD_KeyValueIteratorN)(void *cls, + enum MHD_ValueKind kind, + const char *key, + size_t key_size, + const char *value, + size_t value_size); /** @@ -2351,16 +2359,16 @@ typedef void * @return #MHD_YES to continue iterating, * #MHD_NO to abort the iteration */ -typedef 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); +typedef 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); /* **************** Daemon handling functions ***************** */ @@ -2481,7 +2489,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon); * set to indicate further details about the error. * @ingroup specialized */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_add_connection (struct MHD_Daemon *daemon, MHD_socket client_socket, const struct sockaddr *addr, @@ -2517,7 +2525,7 @@ MHD_add_connection (struct MHD_Daemon *daemon, * fit fd_set. * @ingroup event */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_get_fdset (struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, @@ -2557,7 +2565,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon, * fit fd_set. * @ingroup event */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, @@ -2613,7 +2621,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, * necessitate the use of a timeout right now). * @ingroup event */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_get_timeout (struct MHD_Daemon *daemon, MHD_UNSIGNED_LONG_LONG *timeout); @@ -2638,7 +2646,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon, * options for this call. * @ingroup event */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_run (struct MHD_Daemon *daemon); @@ -2664,7 +2672,7 @@ MHD_run (struct MHD_Daemon *daemon); * @return #MHD_NO on serious errors, #MHD_YES on success * @ingroup event */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, @@ -2737,7 +2745,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection, * #MHD_YES on success * @ingroup request */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, @@ -2769,7 +2777,7 @@ MHD_set_connection_value (struct MHD_Connection *connection, * #MHD_YES on success * @ingroup request */ -int +_MHD_EXTERN enum MHD_Result MHD_set_connection_value_n (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, @@ -2846,7 +2854,7 @@ MHD_lookup_connection_value (struct MHD_Connection *connection, * #MHD_NO otherwise. * @ingroup request */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_lookup_connection_value_n (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, @@ -2866,7 +2874,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection, * #MHD_YES on success or if message has been queued * @ingroup response */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response); @@ -2980,7 +2988,7 @@ enum MHD_ResponseOptions * @param ... #MHD_RO_END terminated list of options * @return #MHD_YES on success, #MHD_NO on error */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...); @@ -3239,7 +3247,7 @@ struct MHD_UpgradeResponseHandle; * @param ... arguments to the action (depends on the action) * @return #MHD_NO on error, #MHD_YES on success */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...); @@ -3359,7 +3367,7 @@ MHD_destroy_response (struct MHD_Response *response); * or out of memory * @ingroup response */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content); @@ -3374,7 +3382,7 @@ MHD_add_response_header (struct MHD_Response *response, * @return #MHD_NO on error (i.e. invalid footer or content format). * @ingroup response */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content); @@ -3389,7 +3397,7 @@ MHD_add_response_footer (struct MHD_Response *response, * @return #MHD_NO on error (no such header known) * @ingroup response */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content); @@ -3470,7 +3478,7 @@ MHD_create_post_processor (struct MHD_Connection *connection, * (out-of-memory, iterator aborted, parse error) * @ingroup request */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len); @@ -3485,7 +3493,7 @@ MHD_post_process (struct MHD_PostProcessor *pp, * value of this function * @ingroup request */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_destroy_post_processor (struct MHD_PostProcessor *pp); @@ -3665,7 +3673,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection, * @return #MHD_YES on success, #MHD_NO otherwise * @ingroup authentication */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, const char *realm, const char *opaque, @@ -3691,7 +3699,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, * @ingroup authentication * @deprecated use MHD_queue_auth_fail_response2() */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, @@ -3777,7 +3785,7 @@ enum MHD_CONNECTION_OPTION * @return #MHD_YES on success, #MHD_NO if setting the option failed * @ingroup specialized */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_set_connection_option (struct MHD_Connection *connection, enum MHD_CONNECTION_OPTION option, ...); @@ -4042,7 +4050,7 @@ enum MHD_FEATURE * feature is not supported or feature is unknown. * @ingroup specialized */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_is_feature_supported (enum MHD_FEATURE feature); diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -388,7 +388,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection, * #MHD_YES on success * @ingroup request */ -static int +static enum MHD_Result MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, @@ -449,7 +449,7 @@ MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection, * #MHD_YES on success * @ingroup request */ -int +enum MHD_Result MHD_set_connection_value_n (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, @@ -496,7 +496,7 @@ MHD_set_connection_value_n (struct MHD_Connection *connection, * #MHD_YES on success * @ingroup request */ -int +enum MHD_Result MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, @@ -562,7 +562,7 @@ MHD_lookup_connection_value (struct MHD_Connection *connection, * #MHD_NO otherwise. * @ingroup request */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_lookup_connection_value_n (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, @@ -679,9 +679,9 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection, * message for this connection? * * @param connection connection to test - * @return 0 if we don't need 100 CONTINUE, 1 if we do + * @return false if we don't need 100 CONTINUE, true if we do */ -static int +static bool need_100_continue (struct MHD_Connection *connection) { const char *expect; @@ -880,7 +880,7 @@ connection_close_error (struct MHD_Connection *connection, * lock on the response will have been released already * in this case). */ -static int +static enum MHD_Result try_ready_normal_body (struct MHD_Connection *connection) { ssize_t ret; @@ -951,7 +951,7 @@ try_ready_normal_body (struct MHD_Connection *connection) * @param connection the connection * @return #MHD_NO if readying the response failed */ -static int +static enum MHD_Result try_ready_chunked_body (struct MHD_Connection *connection) { ssize_t ret; @@ -1082,7 +1082,7 @@ try_ready_chunked_body (struct MHD_Connection *connection) * @return #MHD_YES if (based on the request), a keepalive is * legal */ -static int +static enum MHD_Result keepalive_possible (struct MHD_Connection *connection) { if (MHD_CONN_MUST_CLOSE == connection->keepalive) @@ -1248,7 +1248,7 @@ try_grow_read_buffer (struct MHD_Connection *connection, * @param connection the connection * @return #MHD_YES on success, #MHD_NO on failure (out of memory) */ -static int +static enum MHD_Result build_header_response (struct MHD_Connection *connection) { struct MHD_Response *response = connection->response; @@ -1627,7 +1627,7 @@ transmit_error_response (struct MHD_Connection *connection, const char *message) { struct MHD_Response *response; - int iret; + enum MHD_Result iret; if (NULL == connection->version) { @@ -1933,7 +1933,7 @@ get_next_header_line (struct MHD_Connection *connection, * @param value_size number of bytes in @a value * @return #MHD_NO on failure (out of memory), #MHD_YES for success */ -static int +static enum MHD_Result connection_add_header (struct MHD_Connection *connection, const char *key, size_t key_size, @@ -1968,7 +1968,7 @@ connection_add_header (struct MHD_Connection *connection, * @param connection connection to parse header of * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory) */ -static int +static enum MHD_Result parse_cookie_header (struct MHD_Connection *connection) { const char *hdr; @@ -2094,7 +2094,7 @@ parse_cookie_header (struct MHD_Connection *connection) * @param line_len length of the first @a line * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed */ -static int +static enum MHD_Result parse_initial_message_line (struct MHD_Connection *connection, char *line, size_t line_len) @@ -2485,7 +2485,7 @@ process_request_body (struct MHD_Connection *connection) * @param next_state the next state to transition to * @return #MHD_NO if we are not done, #MHD_YES if we are */ -static int +static enum MHD_Result check_write_done (struct MHD_Connection *connection, enum MHD_CONNECTION_STATE next_state) { @@ -2514,7 +2514,7 @@ check_write_done (struct MHD_Connection *connection, * @param line line from the header to process * @return #MHD_YES on success, #MHD_NO on error (malformed @a line) */ -static int +static enum MHD_Result process_header_line (struct MHD_Connection *connection, char *line) { @@ -2573,7 +2573,7 @@ process_header_line (struct MHD_Connection *connection, * of the given kind * @return #MHD_YES if the line was processed successfully */ -static int +static enum MHD_Result process_broken_line (struct MHD_Connection *connection, char *line, enum MHD_ValueKind kind) @@ -2681,7 +2681,7 @@ parse_connection_headers (struct MHD_Connection *connection) NULL, NULL)) ) { - int iret; + enum MHD_Result iret; /* die, http 1.1 request without host and we are pedantic */ connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; @@ -3272,13 +3272,13 @@ cleanup_connection (struct MHD_Connection *connection) * @return #MHD_YES if we should continue to process the * connection (not dead yet), #MHD_NO if it died */ -int +enum MHD_Result MHD_connection_handle_idle (struct MHD_Connection *connection) { struct MHD_Daemon *daemon = connection->daemon; char *line; size_t line_len; - int ret; + enum MHD_Result ret; connection->in_idle = true; while (! connection->suspended) @@ -3763,7 +3763,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) * @return #MHD_YES if we should continue to process the * connection (not dead yet), #MHD_NO if it died */ -int +enum MHD_Result MHD_connection_epoll_update_ (struct MHD_Connection *connection) { struct MHD_Daemon *daemon = connection->daemon; @@ -3888,7 +3888,7 @@ MHD_get_connection_info (struct MHD_Connection *connection, * @return #MHD_YES on success, #MHD_NO if setting the option failed * @ingroup specialized */ -int +enum MHD_Result MHD_set_connection_option (struct MHD_Connection *connection, enum MHD_CONNECTION_OPTION option, ...) @@ -3954,7 +3954,7 @@ MHD_set_connection_option (struct MHD_Connection *connection, * #MHD_YES on success or if message has been queued * @ingroup response */ -int +enum MHD_Result MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response) diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h @@ -114,10 +114,10 @@ MHD_connection_handle_write (struct MHD_Connection *connection); * recv(), send() and response. * * @param connection connection to handle - * @return MHD_YES if we should continue to process the - * connection (not dead yet), MHD_NO if it died + * @return #MHD_YES if we should continue to process the + * connection (not dead yet), #MHD_NO if it died */ -int +enum MHD_Result MHD_connection_handle_idle (struct MHD_Connection *connection); @@ -165,10 +165,10 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection); * the epoll set if needed. * * @param connection connection to process - * @return MHD_YES if we should continue to process the - * connection (not dead yet), MHD_NO if it died + * @return #MHD_YES if we should continue to process the + * connection (not dead yet), #MHD_NO if it died */ -int +enum MHD_Result MHD_connection_epoll_update_ (struct MHD_Connection *connection); #endif diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -113,7 +113,7 @@ close_all_connections (struct MHD_Daemon *daemon); * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking * @return #MHD_NO on serious errors, #MHD_YES on success */ -static int +static enum MHD_Result MHD_epoll (struct MHD_Daemon *daemon, int may_block); @@ -361,7 +361,7 @@ MHD_ip_addr_compare (const void *a1, * @param key where to store the parsed address * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type) */ -static int +static enum MHD_Result MHD_ip_addr_to_key (const struct sockaddr *addr, socklen_t addrlen, struct MHD_IPCount *key) @@ -412,7 +412,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr, * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit. * Also returns #MHD_NO if fails to allocate memory. */ -static int +static enum MHD_Result MHD_ip_limit_add (struct MHD_Daemon *daemon, const struct sockaddr *addr, socklen_t addrlen) @@ -420,7 +420,7 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon, struct MHD_IPCount *key; void **nodep; void *node; - int result; + enum MHD_Result result; daemon = MHD_get_master (daemon); /* Ignore if no connection limit assigned */ @@ -723,7 +723,7 @@ MHD_TLS_init (struct MHD_Daemon *daemon) * fit fd_set. * @ingroup event */ -int +enum MHD_Result MHD_get_fdset (struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, @@ -976,7 +976,7 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh, * fit fd_set. * @ingroup event */ -static int +static enum MHD_Result internal_get_fdset2 (struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, @@ -987,7 +987,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon, { struct MHD_Connection *pos; struct MHD_Connection *posn; - int result = MHD_YES; + enum MHD_Result result = MHD_YES; MHD_socket ls; if (daemon->shutdown) @@ -1125,7 +1125,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon, * fit fd_set. * @ingroup event */ -int +enum MHD_Result MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, @@ -1191,13 +1191,13 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, * #MHD_NO if a serious error was encountered and the * connection is to be closed. */ -static int +static enum MHD_Result call_handlers (struct MHD_Connection *con, bool read_ready, bool write_ready, bool force_close) { - int ret; + enum MHD_Result ret; bool states_info_processed = false; /* Fast track flag */ bool on_fasttrack = (con->state == MHD_CONNECTION_INIT); @@ -2369,7 +2369,7 @@ psk_gnutls_adapter (gnutls_session_t session, * The socket will be closed in any case; 'errno' is * set to indicate further details about the error. */ -static int +static enum MHD_Result internal_add_connection (struct MHD_Daemon *daemon, MHD_socket client_socket, const struct sockaddr *addr, @@ -2969,12 +2969,12 @@ MHD_resume_connection (struct MHD_Connection *connection) * @param daemon daemon context * @return #MHD_YES if a connection was actually resumed */ -static int +static enum MHD_Result resume_suspended_connections (struct MHD_Daemon *daemon) { struct MHD_Connection *pos; struct MHD_Connection *prev = NULL; - int ret; + enum MHD_Result ret; const bool used_thr_p_c = (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)); #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) @@ -3124,7 +3124,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon) * set to indicate further details about the error. * @ingroup specialized */ -int +enum MHD_Result MHD_add_connection (struct MHD_Daemon *daemon, MHD_socket client_socket, const struct sockaddr *addr, @@ -3185,7 +3185,7 @@ MHD_add_connection (struct MHD_Daemon *daemon, * a return code of #MHD_NO only refers to the actual * accept() system call. */ -static int +static enum MHD_Result MHD_accept_connection (struct MHD_Daemon *daemon) { #if HAVE_INET6 @@ -3443,7 +3443,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) * necessitate the use of a timeout right now). * @ingroup event */ -int +enum MHD_Result MHD_get_timeout (struct MHD_Daemon *daemon, MHD_UNSIGNED_LONG_LONG *timeout) { @@ -3533,7 +3533,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon, * @return #MHD_NO on serious errors, #MHD_YES on success * @ingroup event */ -static int +static enum MHD_Result internal_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, @@ -3637,7 +3637,7 @@ internal_run_from_select (struct MHD_Daemon *daemon, * @return #MHD_NO on serious errors, #MHD_YES on success * @ingroup event */ -int +enum MHD_Result MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, @@ -3662,8 +3662,8 @@ MHD_run_from_select (struct MHD_Daemon *daemon, if (0 != (daemon->options & MHD_USE_EPOLL)) { #ifdef EPOLL_SUPPORT - int ret = MHD_epoll (daemon, - MHD_NO); + enum MHD_Result ret = MHD_epoll (daemon, + MHD_NO); MHD_cleanup_connections (daemon); return ret; @@ -3691,7 +3691,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon, * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking * @return #MHD_NO on serious errors, #MHD_YES on success */ -static int +static enum MHD_Result MHD_select (struct MHD_Daemon *daemon, int may_block) { @@ -3860,7 +3860,7 @@ MHD_select (struct MHD_Daemon *daemon, * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking * @return #MHD_NO on serious errors, #MHD_YES on success */ -static int +static enum MHD_Result MHD_poll_all (struct MHD_Daemon *daemon, int may_block) { @@ -4075,7 +4075,7 @@ MHD_poll_all (struct MHD_Daemon *daemon, * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking * @return #MHD_NO on serious errors, #MHD_YES on success */ -static int +static enum MHD_Result MHD_poll_listen_socket (struct MHD_Daemon *daemon, int may_block) { @@ -4159,7 +4159,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon, * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking * @return #MHD_NO on serious errors, #MHD_YES on success */ -static int +static enum MHD_Result MHD_poll (struct MHD_Daemon *daemon, int may_block) { @@ -4238,7 +4238,7 @@ is_urh_ready (struct MHD_UpgradeResponseHandle *const urh) * @remark To be called only from thread that process * daemon's select()/poll()/etc. */ -static int +static enum MHD_Result run_epoll_for_upgrade (struct MHD_Daemon *daemon) { struct epoll_event events[MAX_EVENTS]; @@ -4357,7 +4357,7 @@ static const char *const epoll_itc_marker = "itc_marker"; * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking * @return #MHD_NO on serious errors, #MHD_YES on success */ -static int +static enum MHD_Result MHD_epoll (struct MHD_Daemon *daemon, int may_block) { @@ -4673,7 +4673,7 @@ MHD_epoll (struct MHD_Daemon *daemon, * options for this call. * @ingroup event */ -int +enum MHD_Result MHD_run (struct MHD_Daemon *daemon) { if ( (daemon->shutdown) || @@ -4967,7 +4967,7 @@ typedef void * @param ap the options * @return #MHD_YES on success, #MHD_NO on error */ -static int +static enum MHD_Result parse_options_va (struct MHD_Daemon *daemon, const struct sockaddr **servaddr, va_list ap); @@ -4981,13 +4981,13 @@ parse_options_va (struct MHD_Daemon *daemon, * @param ... the options * @return #MHD_YES on success, #MHD_NO on error */ -static int +static enum MHD_Result parse_options (struct MHD_Daemon *daemon, const struct sockaddr **servaddr, ...) { va_list ap; - int ret; + enum MHD_Result ret; va_start (ap, servaddr); ret = parse_options_va (daemon, @@ -5006,7 +5006,7 @@ parse_options (struct MHD_Daemon *daemon, * @param ap the options * @return #MHD_YES on success, #MHD_NO on error */ -static int +static enum MHD_Result parse_options_va (struct MHD_Daemon *daemon, const struct sockaddr **servaddr, va_list ap) @@ -5016,7 +5016,7 @@ parse_options_va (struct MHD_Daemon *daemon, unsigned int i; unsigned int uv; #ifdef HTTPS_SUPPORT - int ret; + enum MHD_Result ret; const char *pstr; #if GNUTLS_VERSION_MAJOR >= 3 gnutls_certificate_retrieve_function2 *pgcrf; @@ -5614,7 +5614,7 @@ setup_epoll_fd (struct MHD_Daemon *daemon) * @param daemon daemon to initialize for epoll() * @return #MHD_YES on success, #MHD_NO on failure */ -static int +static enum MHD_Result setup_epoll_to_listen (struct MHD_Daemon *daemon) { struct epoll_event event; @@ -7093,7 +7093,7 @@ MHD_get_version (void) * feature is not supported or feature is unknown. * @ingroup specialized */ -_MHD_EXTERN int +enum MHD_Result MHD_is_feature_supported (enum MHD_FEATURE feature) { switch (feature) diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c @@ -521,7 +521,7 @@ lookup_sub_value (char *dest, * @param nc The nonce counter, zero to add the nonce to the array * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array) */ -static int +static enum MHD_Result check_nonce_nc (struct MHD_Connection *connection, const char *nonce, uint64_t nc) @@ -743,7 +743,7 @@ calculate_nonce (uint32_t nonce_time, * @return #MHD_YES if the key-value pair is in the headers, * #MHD_NO if not */ -static int +static enum MHD_Result test_header (struct MHD_Connection *connection, const char *key, size_t key_size, @@ -790,14 +790,14 @@ test_header (struct MHD_Connection *connection, * @return #MHD_YES if the arguments match, * #MHD_NO if not */ -static int +static enum MHD_Result check_argument_match (struct MHD_Connection *connection, const char *args) { struct MHD_HTTP_Header *pos; char *argb; unsigned int num_headers; - int ret; + enum MHD_Result ret; argb = strdup (args); if (NULL == argb) @@ -1338,7 +1338,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection, * @return #MHD_YES on success, #MHD_NO otherwise * @ingroup authentication */ -int +enum MHD_Result MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, const char *realm, const char *opaque, @@ -1461,7 +1461,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, * @return #MHD_YES on success, #MHD_NO otherwise * @ingroup authentication */ -int +enum MHD_Result MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c @@ -184,7 +184,7 @@ MHD_http_unescape (char *val) * #MHD_YES for success (parsing succeeded, @a cb always * returned #MHD_YES) */ -int +enum MHD_Result MHD_parse_arguments_ (struct MHD_Connection *connection, enum MHD_ValueKind kind, char *args, diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h @@ -1910,7 +1910,7 @@ MHD_unescape_plus (char *arg); * @return #MHD_YES on success (continue to iterate) * #MHD_NO to signal failure (and abort iteration) */ -typedef int +typedef enum MHD_Result (*MHD_ArgumentIterator_)(struct MHD_Connection *connection, const char *key, size_t key_size, @@ -1933,7 +1933,7 @@ typedef int * #MHD_YES for success (parsing succeeded, @a cb always * returned #MHD_YES) */ -int +enum MHD_Result MHD_parse_arguments_ (struct MHD_Connection *connection, enum MHD_ValueKind kind, char *args, diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c @@ -176,7 +176,7 @@ struct MHD_PostProcessor * Value data left over from previous iteration. */ char xbuf[2]; - + /** * Size of our buffer for the key. */ @@ -220,9 +220,9 @@ struct MHD_PostProcessor /** * Set if we still need to run the unescape logic * on the key allocated at the end of this struct. - */ + */ bool must_unescape_key; - + /** * State of the parser. */ @@ -478,7 +478,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, (pp->state == PP_Callback) ) && (pp->state != PP_Error) ) { - switch (pp->state) { + switch (pp->state) + { case PP_Error: /* clearly impossible as per while loop invariant */ abort (); @@ -520,7 +521,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, case PP_ProcessValue: if (NULL == start_value) start_value = &post_data[poff]; - switch (post_data[poff]) { + switch (post_data[poff]) + { case '=': /* case 'key==' */ pp->state = PP_Error; @@ -529,8 +531,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, /* case 'value&' */ end_value = &post_data[poff]; poff++; - if ( pp->must_ikvi || - (start_value != end_value) ) + if (pp->must_ikvi || + (start_value != end_value) ) { pp->state = PP_Callback; } @@ -538,7 +540,7 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, { pp->buffer_pos = 0; pp->value_offset = 0; - pp->state = PP_Init; + pp->state = PP_Init; } continue; case '\n': @@ -576,7 +578,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, } break; /* end PP_ProcessValue */ case PP_Done: - switch (post_data[poff]) { + switch (post_data[poff]) + { case '\n': case '\r': poff++; @@ -632,9 +635,9 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, } /* save remaining data for next iteration */ - if (NULL != start_key) + if (NULL != start_key) { - if (NULL == end_key) + if (NULL == end_key) end_key = &post_data[poff]; memcpy (&kbuf[pp->buffer_pos], start_key, @@ -1366,7 +1369,7 @@ END: * (out-of-memory, iterator aborted, parse error) * @ingroup request */ -int +enum MHD_Result MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len) @@ -1404,10 +1407,10 @@ MHD_post_process (struct MHD_PostProcessor *pp, * value of this function * @ingroup request */ -int +enum MHD_Result MHD_destroy_post_processor (struct MHD_PostProcessor *pp) { - int ret; + enum MHD_Result ret; if (NULL == pp) return MHD_YES; diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c @@ -78,7 +78,7 @@ * @param content value to add * @return #MHD_NO on error (i.e. invalid header or content format). */ -static int +static enum MHD_Result add_response_entry (struct MHD_Response *response, enum MHD_ValueKind kind, const char *header, @@ -129,7 +129,7 @@ add_response_entry (struct MHD_Response *response, * @return #MHD_NO on error (i.e. invalid header or content format). * @ingroup response */ -int +enum MHD_Result MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) @@ -173,7 +173,7 @@ MHD_add_response_header (struct MHD_Response *response, * @return #MHD_NO on error (i.e. invalid footer or content format). * @ingroup response */ -int +enum MHD_Result MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content) @@ -194,7 +194,7 @@ MHD_add_response_footer (struct MHD_Response *response, * @return #MHD_NO on error (no such header known) * @ingroup response */ -int +enum MHD_Result MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) @@ -412,13 +412,13 @@ MHD_create_response_from_callback (uint64_t size, * @param ... #MHD_RO_END terminated list of options * @return #MHD_YES on success, #MHD_NO on error */ -int +enum MHD_Result MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...) { va_list ap; - int ret; + enum MHD_Result ret; enum MHD_ResponseOptions ro; ret = MHD_YES; @@ -788,7 +788,7 @@ MHD_create_response_from_buffer_with_free_callback (size_t size, * @param ... arguments to the action (depends on the action) * @return #MHD_NO on error, #MHD_YES on success */ -_MHD_EXTERN int +_MHD_EXTERN enum MHD_Result MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...) @@ -894,7 +894,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, * @return #MHD_YES on success, #MHD_NO on failure (will cause * connection to be closed) */ -int +enum MHD_Result MHD_response_execute_upgrade_ (struct MHD_Response *response, struct MHD_Connection *connection) { diff --git a/src/microhttpd/response.h b/src/microhttpd/response.h @@ -49,7 +49,7 @@ MHD_increment_response_rc (struct MHD_Response *response); * @return #MHD_YES on success, #MHD_NO on failure (will cause * connection to be closed) */ -int +enum MHD_Result MHD_response_execute_upgrade_ (struct MHD_Response *response, struct MHD_Connection *connection);