tighten formatting rules

This commit is contained in:
Christian Grothoff
2019-10-31 13:06:08 +01:00
parent e0a0762845
commit 7389c34528
160 changed files with 902 additions and 529 deletions
+17
View File
@@ -49,8 +49,12 @@ nl_assign_brace=remove
# No extra newlines that cause noisy diffs
nl_start_of_file=remove
nl_after_func_proto = 2
nl_after_func_body = 3
# If there's no new line, it's not a text file!
nl_end_of_file=add
nl_max_blank_in_func = 3
nl_max = 3
sp_inside_paren = remove
@@ -69,6 +73,7 @@ sp_between_ptr_star = remove
sp_before_sparen = add
sp_inside_fparen = remove
sp_inside_sparen = remove
# add space before function call and decl: "foo (x)"
sp_func_call_paren = add
@@ -76,3 +81,15 @@ sp_func_proto_paren = add
sp_func_proto_paren_empty = add
sp_func_def_paren = add
sp_func_def_paren_empty = add
# We'd want it for "if ( (foo) || (bar) )", but not for "if (m())",
# so as uncrustify doesn't give exactly what we want => ignore
sp_paren_paren = ignore
sp_inside_paren = remove
sp_bool = force
nl_func_type_name = force
#nl_branch_else = add
nl_else_brace = add
nl_elseif_brace = add
nl_for_brace = add
-1
View File
@@ -39,7 +39,6 @@
"<html><head><title>Access denied</title></head><body>Access denied</body></html>"
static int
ahc_echo (void *cls,
struct MHD_Connection *connection,
-1
View File
@@ -49,7 +49,6 @@ static unsigned int small_deltas[SMALL];
static struct MHD_Response *response;
/**
* Signature of the callback used by MHD to notify the
* application about completed requests.
-1
View File
@@ -49,7 +49,6 @@ static unsigned int small_deltas[SMALL];
static struct MHD_Response *response;
/**
* Signature of the callback used by MHD to notify the
* application about completed requests.
+2 -7
View File
@@ -57,9 +57,7 @@ callback (void *cls,
// Consider suspending connection until data will be ready.
return 0;
}
* End of pseudo code. */
if (buf_size < (param->response_size - pos))
* End of pseudo code. */if (buf_size < (param->response_size - pos))
size_to_copy = buf_size;
else
size_to_copy = param->response_size - pos;
@@ -72,10 +70,7 @@ callback (void *cls,
// Close connection with error.
return MHD_CONTENT_READER_END_WITH_ERROR;
}
* End of pseudo code. */
/* Return amount of data copied to buffer. */
return size_to_copy;
* End of pseudo code. *//* Return amount of data copied to buffer. */return size_to_copy;
}
+1
View File
@@ -62,6 +62,7 @@ ahc_echo (void *cls,
return ret;
}
#include <x86intrin.h>
static void
+3
View File
@@ -871,6 +871,8 @@ ignore_sigpipe ()
fprintf (stderr,
"Failed to install SIGPIPE handler: %s\n", strerror (errno));
}
#endif
@@ -958,4 +960,5 @@ main (int argc, char *const *argv)
return 0;
}
/* end of demo.c */
+3
View File
@@ -872,6 +872,8 @@ ignore_sigpipe (void)
fprintf (stderr,
"Failed to install SIGPIPE handler: %s\n", strerror (errno));
}
#endif
/* test server key */
@@ -1013,4 +1015,5 @@ main (int argc, char *const *argv)
return 0;
}
/* end of demo_https.c */
+1
View File
@@ -149,4 +149,5 @@ main (int argc, char *const *argv)
return 0;
}
/* end of digest_auth_example.c */
+4
View File
@@ -100,6 +100,7 @@ compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset,
return (Z_OK == ret) ? MHD_YES : MHD_NO;
}
static ssize_t
read_cb (void *cls, uint64_t pos, char *mem, size_t size)
{
@@ -139,6 +140,7 @@ done:
return ret;
}
static void
free_cb (void *cls)
{
@@ -149,6 +151,7 @@ free_cb (void *cls)
free (holder);
}
static int
ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const
char *method, const char *version,
@@ -207,6 +210,7 @@ file_error:
return MHD_NO;
}
int
main (int argc, char *const *argv)
{
+3
View File
@@ -59,6 +59,7 @@ can_compress (struct MHD_Connection *con)
return MHD_NO;
}
static int
body_compress (void **buf,
size_t *buf_size)
@@ -88,6 +89,7 @@ body_compress (void **buf,
return MHD_YES;
}
static int
ahc_echo (void *cls,
struct MHD_Connection *connection,
@@ -156,6 +158,7 @@ ahc_echo (void *cls,
return ret;
}
int
main (int argc, char *const *argv)
{
+2
View File
@@ -103,6 +103,7 @@ file_reader (void *cls, uint64_t pos, char *buf, size_t max)
return fread (buf, 1, max, file);
}
static void
file_free_callback (void *cls)
{
@@ -110,6 +111,7 @@ file_free_callback (void *cls)
fclose (file);
}
/* HTTP access handler call back */
static int
http_ahc (void *cls,
+2
View File
@@ -37,6 +37,7 @@ data_generator (void *cls, uint64_t pos, char *buf, size_t max)
return 80;
}
static int
ahc_echo (void *cls,
struct MHD_Connection *connection,
@@ -71,6 +72,7 @@ ahc_echo (void *cls,
return ret;
}
int
main (int argc, char *const *argv)
{
-3
View File
@@ -143,8 +143,6 @@ struct Request
static struct Session *sessions;
/**
* Return the session handle for this connection, or
* create one if this is a new user.
@@ -452,7 +450,6 @@ static struct Page pages[] = {
};
/**
* Iterator over key-value pairs where the value
* maybe made available in increments and/or may
+1
View File
@@ -74,6 +74,7 @@ ahc_echo (void *cls,
return ret;
}
int
main (int argc, char *const *argv)
{
+2
View File
@@ -83,6 +83,7 @@ ahc_echo (void *cls,
return ret;
}
int
main (int argc, char *const *argv)
{
@@ -105,4 +106,5 @@ main (int argc, char *const *argv)
return 0;
}
/* end of refuse_post_example.c */
-1
View File
@@ -3,7 +3,6 @@ enum MHD_Bool
struct MHD_TLS_ConnectionState *cs) :
if (MHD_TLS_CONN_NO_TLS != connection->tls_state)
{ /* HTTPS connection. */
if (MHD_TLS_CONN_CONNECTED > connection->tls_state)
+1
View File
@@ -157,6 +157,7 @@ MHD_TLS_fini (void)
gnutls_global_deinit ();
}
#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
_SET_INIT_AND_DEINIT_FUNCS (MHD_TLS_init, MHD_TLS_fini);
#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */
+1
View File
@@ -39,6 +39,7 @@
*/
void
MHD_TLS_check_global_init_ (void);
#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
-1
View File
@@ -42,7 +42,6 @@
#define _(String) (String)
#ifndef _MHD_EXTERN
#if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \
(defined(DLL_EXPORT) || defined(MHD_W32DLL))
-4
View File
@@ -2670,8 +2670,6 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
const fd_set *except_fd_set);
/* **************** Connection handling functions ***************** */
/**
@@ -3085,8 +3083,6 @@ MHD_create_response_from_buffer (size_t size,
enum MHD_ResponseMemoryMode mode);
/**
* Create a response object. The response object can be extended with
* header information and then be used any number of times.
-7
View File
@@ -124,7 +124,6 @@ typedef intptr_t ssize_t;
#define MHD_VERSION 0x01000000
/**
* Representation of 'bool' in the public API as stdbool.h may not
* always be available.
@@ -526,7 +525,6 @@ enum MHD_StatusCode
MHD_SC_CHUNKED_ENCODING_MALFORMED = 40007,
/* 50000-level errors are because of an error internal
to the MHD logic, possibly including our interaction
with the operating system (but not the application) */
@@ -826,7 +824,6 @@ enum MHD_StatusCode
MHD_SC_FAILED_RESPONSE_HEADER_GENERATION = 50056,
/* 60000-level errors are because the application
logic did something wrong or generated an error. */
@@ -1137,7 +1134,6 @@ enum MHD_Method
/** @} */ /* end of group postenc */
/**
* @defgroup headers HTTP headers
* These are the standard headers found in HTTP requests and responses.
@@ -2656,7 +2652,6 @@ enum MHD_ValueKind
};
/**
* Iterator over key-value pairs. This iterator can be used to
* iterate over all of the cookies, headers, or POST-data fields of a
@@ -2747,7 +2742,6 @@ MHD_request_lookup_value (struct MHD_Request *request,
MHD_NONNULL (1);
/**
* @defgroup httpcode HTTP response codes.
* These are the status codes defined for HTTP responses.
@@ -3587,7 +3581,6 @@ MHD_action_parse_post (size_t buffer_size,
MHD_NONNULL (2);
/* ********************** generic query functions ********************** */
-1
View File
@@ -46,7 +46,6 @@
struct MHD_TLS_ConnectionState;
/**
* Callback functions to use for TLS operations.
*/
+1
View File
@@ -61,4 +61,5 @@ MHD_action_continue (void)
return &acont;
}
/* end of action_continue.c */
+2 -1
View File
@@ -48,7 +48,7 @@ response_action (void *cls,
#ifdef UPGRADE_SUPPORT
if ( (NULL != response->upgrade_handler) &&
daemon->disallow_upgrade )
daemon->disallow_upgrade)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
@@ -128,4 +128,5 @@ MHD_action_from_response (struct MHD_Response *response,
return &response->action;
}
/* end of action_from_response */
+1 -1
View File
@@ -25,7 +25,6 @@
#include "internal.h"
/**
* Create an action that parses a POST request.
*
@@ -58,4 +57,5 @@ MHD_action_parse_post (size_t buffer_size,
return NULL; /* not yet implemented */
}
/* end of action_parse_post.c */
+1
View File
@@ -134,4 +134,5 @@ MHD_action_suspend (void)
return &suspend;
}
/* end of action_suspend.c */
+4 -1
View File
@@ -69,6 +69,8 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
/* Do not set 'urh->clean_ready' yet as 'urh' will be used
* in connection thread for a little while. */
}
#endif /* UPGRADE_SUPPORT */
@@ -1054,7 +1056,7 @@ MHD_accept_connection_ (struct MHD_Daemon *daemon)
{
MHD_socket_close_chk_ (s);
}
if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
if (MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
{
/* system/process out of resources */
if (0 == daemon->connections)
@@ -1134,4 +1136,5 @@ MHD_accept_connection_ (struct MHD_Daemon *daemon)
sk_nonbl);
}
/* end of connection_add.c */
+15 -16
View File
@@ -146,9 +146,10 @@ MHD_conn_init_static_ (void)
}
#endif /* SF_FLAGS */
}
#endif /* HAVE_FREEBSD_SENDFILE */
#endif /* HAVE_FREEBSD_SENDFILE */
/**
* Message to transmit when http 1.1 request is received
@@ -439,8 +440,7 @@ sendfile_adapter (struct MHD_Connection *connection)
supported for FD or other 'unusual' errors occurred, so we should try
to fall back to 'SEND'; see also this thread for info on
odd libc/Linux behavior with sendfile:
http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */
request->resp_sender = MHD_resp_sender_std;
http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */request->resp_sender = MHD_resp_sender_std;
return MHD_ERR_AGAIN_;
#else /* HAVE_SOLARIS_SENDFILE */
if ( (EAFNOSUPPORT == err) ||
@@ -534,6 +534,8 @@ sendfile_adapter (struct MHD_Connection *connection)
#endif /* HAVE_FREEBSD_SENDFILE */
return ret;
}
#endif /* _MHD_HAVE_SENDFILE */
@@ -694,7 +696,7 @@ try_ready_chunked_body (struct MHD_Request *request)
= (size_t) (request->response_write_position - response->data_start);
/* buffer already ready, use what is there for the chunk */
ret = response->data_size - data_write_offset;
if ( ((size_t) ret) > request->write_buffer_size - sizeof (cbuf) - 2 )
if ( ((size_t) ret) > request->write_buffer_size - sizeof (cbuf) - 2)
ret = request->write_buffer_size - sizeof (cbuf) - 2;
memcpy (&request->write_buffer[sizeof (cbuf)],
&response->data[data_write_offset],
@@ -1434,8 +1436,7 @@ build_header_response (struct MHD_Request *request)
Note that the change from 'SHOULD NOT' to 'MUST NOT' is
a recent development of the HTTP 1.1 specification.
*/
content_length_len
*/content_length_len
= MHD_snprintf_ (content_length_buf,
sizeof (content_length_buf),
MHD_HTTP_HEADER_CONTENT_LENGTH ": "
@@ -1926,8 +1927,7 @@ process_header_line (struct MHD_Request *request,
header at the beginning of the while
loop since we need to be able to inspect
the *next* header line (in case it starts
with a space...) */
request->last = line;
with a space...) */request->last = line;
request->colon = colon;
return true;
}
@@ -1975,8 +1975,7 @@ process_broken_line (struct MHD_Request *request,
adjacency); also, in the case where these are not adjacent
(not sure how it can happen!), we would want to allocate from
the end of the pool, so as to not destroy the read-buffer's
ability to grow nicely. */
last = MHD_pool_reallocate (connection->pool,
ability to grow nicely. */last = MHD_pool_reallocate (connection->pool,
last,
last_len + 1,
last_len + tmp_len + 1);
@@ -2926,6 +2925,8 @@ connection_epoll_update_ (struct MHD_Connection *connection)
}
return true;
}
#endif
@@ -3014,8 +3015,7 @@ connection_update_event_loop_info (struct MHD_Connection *connection)
or if we do nothing, we would just timeout
on the connection (if a timeout is even set!).
Solution: we kill the connection with an error */
transmit_error_response (request,
Solution: we kill the connection with an error */transmit_error_response (request,
MHD_SC_APPLICATION_HUNG_CONNECTION_CLOSED,
MHD_HTTP_INTERNAL_SERVER_ERROR,
INTERNAL_ERROR);
@@ -3675,10 +3675,8 @@ MHD_connection_call_handlers_ (struct MHD_Connection *con,
immediately.
As writeability of socket was not checked and it may have
some data pending in system buffers, use this optimization
only for non-blocking sockets. */
/* No need to check 'ret' as connection is always in
* MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */
else if (on_fasttrack &&
only for non-blocking sockets. *//* No need to check 'ret' as connection is always in
* MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */else if (on_fasttrack &&
con->sk_nonblck)
{
if (MHD_REQUEST_HEADERS_SENDING == con->request.state)
@@ -3722,4 +3720,5 @@ MHD_connection_call_handlers_ (struct MHD_Connection *con,
return ret;
}
/* end of connection_call_handlers.c */
+4 -2
View File
@@ -59,6 +59,8 @@ connection_cleanup_upgraded (struct MHD_Connection *connection)
connection->request.urh = NULL;
free (urh);
}
#endif /* UPGRADE_SUPPORT */
@@ -129,8 +131,7 @@ MHD_connection_cleanup_ (struct MHD_Daemon *daemon)
this is not true as if we fail to do manually remove it,
we are still seeing an event for this fd in epoll,
causing grief (use-after-free...) --- at least on my
system. */
if (0 != epoll_ctl (daemon->epoll_fd,
system. */if (0 != epoll_ctl (daemon->epoll_fd,
EPOLL_CTL_DEL,
pos->socket_fd,
NULL))
@@ -155,4 +156,5 @@ MHD_connection_cleanup_ (struct MHD_Daemon *daemon)
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
}
/* end of connection_cleanup.c */
+2 -2
View File
@@ -48,8 +48,7 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection)
* and do not shutdown TCP socket. This give more
* chances to send TLS closure data to remote side.
* Closure of TLS layer will be interpreted by
* remote side as end of transmission. */
if (NULL != (tls = daemon->tls_api))
* remote side as end of transmission. */if (NULL != (tls = daemon->tls_api))
{
if (MHD_YES !=
tls->shutdown_connection (tls->cls,
@@ -100,4 +99,5 @@ MHD_connection_close_ (struct MHD_Connection *connection,
MHD_CONNECTION_NOTIFY_CLOSED);
}
/* end of connection_close.c */
+3 -2
View File
@@ -87,8 +87,9 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection)
* used with MHD_UPGRADE_ACTION_CLOSE. They will be
* closed by MHD_cleanup_upgraded_connection_() during
* connection's final cleanup.
*/
}
*/}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/
/* end of connection_finish_forward.c */
+1
View File
@@ -107,4 +107,5 @@ MHD_connection_get_information_sz (struct MHD_Connection *connection,
#undef CHECK_SIZE
}
/* end of connection_info.c */
+1
View File
@@ -114,4 +114,5 @@ MHD_update_last_activity_ (struct MHD_Connection *connection)
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
}
/* end of connection_options.c */
@@ -61,4 +61,5 @@ MHD_connection_update_last_activity_ (struct MHD_Connection *connection)
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
}
/* end of connection_update_last_activity.c */
+1
View File
@@ -233,4 +233,5 @@ MHD_daemon_close_all_connections_ (struct MHD_Daemon *daemon)
MHD_connection_cleanup_ (daemon);
}
/* end of daemon_close_all_connections.c */
+1
View File
@@ -199,4 +199,5 @@ MHD_daemon_destroy (struct MHD_Daemon *daemon)
free (daemon);
}
/* end of daemon_destroy.c */
+5 -2
View File
@@ -199,6 +199,8 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
return MHD_SC_OK;
}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -488,8 +490,7 @@ MHD_daemon_epoll_ (struct MHD_Daemon *daemon,
here.
Connections with custom timeouts must all be looked at, as we
do not bother to sort that (presumably very short) list. */
prev = daemon->manual_timeout_tail;
do not bother to sort that (presumably very short) list. */prev = daemon->manual_timeout_tail;
while (NULL != (pos = prev))
{
prev = pos->prevX;
@@ -509,6 +510,8 @@ MHD_daemon_epoll_ (struct MHD_Daemon *daemon,
}
return MHD_SC_OK;
}
#endif
/* end of daemon_epoll.c */
+1
View File
@@ -123,4 +123,5 @@ MHD_daemon_get_timeout (struct MHD_Daemon *daemon,
return MHD_SC_OK;
}
/* end of daemon_get_timeout.c */
+1
View File
@@ -102,4 +102,5 @@ MHD_daemon_get_information_sz (struct MHD_Daemon *daemon,
#undef CHECK_SIZE
}
/* end of daemon_info.c */
+1
View File
@@ -299,4 +299,5 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
MHD_ip_count_unlock (daemon);
}
/* end of daemon_ip_limit.c */
+6
View File
@@ -125,6 +125,8 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh,
if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR))
urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY;
}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -429,6 +431,8 @@ MHD_daemon_poll_listen_socket_ (struct MHD_Daemon *daemon,
(void) MHD_accept_connection_ (daemon);
return MHD_SC_OK;
}
#endif
@@ -516,6 +520,8 @@ MHD_daemon_upgrade_connection_with_poll_ (struct MHD_Connection *con)
MHD_upgrade_response_handle_process_ (urh);
}
}
#endif
#endif
+2
View File
@@ -65,6 +65,7 @@ enum MHD_StatusCode
MHD_daemon_poll_ (struct MHD_Daemon *daemon,
bool may_block)
MHD_NONNULL (1);
#endif
@@ -79,6 +80,7 @@ MHD_NONNULL (1);
void
MHD_daemon_upgrade_connection_with_poll_ (struct MHD_Connection *con)
MHD_NONNULL (1);
#endif
#endif
+2 -3
View File
@@ -121,9 +121,8 @@ MHD_daemon_quiesce (struct MHD_Daemon *daemon)
to be sure that the threads have stopped using the listen
socket, otherwise there is still the possibility of a race
between a thread accept()ing and the caller closing and
re-binding the socket. */
return listen_socket;
re-binding the socket. */return listen_socket;
}
/* end of daemon_quiesce.c */
+1
View File
@@ -79,4 +79,5 @@ MHD_daemon_run (struct MHD_Daemon *daemon)
}
}
/* end of daemon_run.c */
+8
View File
@@ -160,6 +160,8 @@ urh_to_fdset (struct MHD_UpgradeResponseHandle *urh,
return res;
}
#endif
@@ -392,6 +394,8 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh,
urh->mhd.celi |= MHD_EPOLL_STATE_ERROR;
}
}
#endif
@@ -575,6 +579,8 @@ MHD_daemon_upgrade_connection_with_select_ (struct MHD_Connection *con)
MHD_upgrade_response_handle_process_ (urh);
}
}
#endif
@@ -742,6 +748,8 @@ MHD_daemon_select_ (struct MHD_Daemon *daemon,
#if defined(MHD_WINSOCK_SOCKETS)
}
}
#endif /* MHD_WINSOCK_SOCKETS */
}
/* Stop listening if we are at the configured connection limit */
+1
View File
@@ -50,6 +50,7 @@ MHD_NONNULL (1);
void
MHD_daemon_upgrade_connection_with_select_ (struct MHD_Connection *con)
MHD_NONNULL (1);
#endif
#endif
+2
View File
@@ -603,6 +603,8 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
}
return MHD_SC_OK;
}
#endif
+3
View File
@@ -121,6 +121,7 @@ MHD_fini (void)
MHD_monotonic_sec_counter_finish ();
}
#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
_SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini);
@@ -143,4 +144,6 @@ MHD_check_global_init_ (void)
MHD_mutex_unlock_chk_ (&global_init_mutex_);
#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */
}
#endif
+1
View File
@@ -39,6 +39,7 @@
*/
void
MHD_check_global_init_ (void);
#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
+5
View File
@@ -80,6 +80,8 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state)
return "unrecognized connection state";
}
}
#endif
#endif
@@ -107,6 +109,8 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
va);
va_end (va);
}
#endif
@@ -280,4 +284,5 @@ MHD_parse_arguments_ (struct MHD_Request *request,
return true;
}
/* end of internal.c */
+1 -7
View File
@@ -87,6 +87,7 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
enum MHD_StatusCode sc,
const char *format,
...);
#endif
@@ -147,7 +148,6 @@ extern void *mhd_panic_cls;
#endif /* ! MHD_STATICSTR_LEN_ */
/**
* Ability to use same connection for next request
*/
@@ -1692,7 +1692,6 @@ struct MHD_Response
};
/**
* Callback invoked when iterating over @a key / @a value
* argument pairs during parsing.
@@ -1733,7 +1732,6 @@ MHD_parse_arguments_ (struct MHD_Request *request,
unsigned int *num_headers);
/**
* Insert an element at the head of a DLL. Assumes that head, tail and
* element are structs with prev and next fields.
@@ -1777,7 +1775,6 @@ MHD_parse_arguments_ (struct MHD_Request *request,
(element)->prev = NULL; } while (0)
/**
* Insert an element at the head of a XDLL. Assumes that head, tail and
* element are structs with prevX and nextX fields.
@@ -1860,7 +1857,6 @@ MHD_parse_arguments_ (struct MHD_Request *request,
(element)->prevE = NULL; } while (0)
/**
* Error code similar to EGAIN or EINTR
*/
@@ -1893,6 +1889,4 @@ MHD_parse_arguments_ (struct MHD_Request *request,
#define MHD_ERR_INVAL_ (-3078)
#endif
+4
View File
@@ -59,6 +59,7 @@ MHD_MD5Init (struct MD5Context *ctx)
ctx->state[3] = 0x10325476;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
@@ -103,6 +104,7 @@ MHD_MD5Update (struct MD5Context *ctx, const unsigned char *input, size_t len)
memcpy (ctx->buffer + have, input, len);
}
/*
* Pad pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
@@ -128,6 +130,7 @@ MD5Pad (struct MD5Context *ctx)
MHD_MD5Update (ctx, count, 8);
}
/*
* Final wrapup--call MD5Pad, fill in digest and zero out ctx.
*/
@@ -261,4 +264,5 @@ MD5Transform (uint32_t state[4], const uint8_t block[MD5_BLOCK_SIZE])
state[3] += d;
}
/* end of md5.c */
+1 -1
View File
@@ -123,7 +123,7 @@
defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__)
/* x86 family is little endian */
#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN
#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
/* Looks like we are on ARM/MIPS in big endian mode */
#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN
+7 -3
View File
@@ -79,6 +79,7 @@ W32_snprintf (char *__restrict s,
return ret;
}
#endif /* HAVE_SNPRINTF */
#endif /* _WIN32 && !__CYGWIN__ */
@@ -93,16 +94,17 @@ W32_snprintf (char *__restrict s,
#endif /* __GNUC__ >= 5 */
void *MHD_calloc_ (size_t nelem, size_t elsize)
void *
MHD_calloc_ (size_t nelem, size_t elsize)
{
size_t alloc_size;
void *ptr;
#ifdef MHD_HAVE_NUL_OVERFLOW
if (__builtin_mul_overflow (nelem, elsize, &alloc_size) ||(0 == alloc_size))
if (__builtin_mul_overflow (nelem, elsize, &alloc_size) || (0 == alloc_size))
return NULL;
#else /* ! MHD_HAVE_NUL_OVERFLOW */
alloc_size = nelem * elsize;
if ((0 == alloc_size)||(elsize != alloc_size / nelem))
if ((0 == alloc_size) || (elsize != alloc_size / nelem))
return NULL;
#endif /* ! MHD_HAVE_NUL_OVERFLOW */
ptr = malloc (alloc_size);
@@ -111,4 +113,6 @@ void *MHD_calloc_ (size_t nelem, size_t elsize)
memset (ptr, 0, alloc_size);
return ptr;
}
#endif /* ! HAVE_CALLOC */
+2
View File
@@ -51,6 +51,7 @@
/* Emulate snprintf function on W32 */
int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
...);
#define MHD_snprintf_ W32_snprintf
#else /* ! _WIN32 || __CYGWIN__ */
#error \
@@ -84,6 +85,7 @@ int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
* MHD_calloc_ is platform-independent calloc()
*/
void *MHD_calloc_ (size_t nelem, size_t elsize);
#endif /* ! HAVE_CALLOC */
#endif /* MHD_COMPAT_H */
+2
View File
@@ -65,6 +65,8 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc)
}
return ! 0;
}
#endif /* ! HAVE_PIPE2_FUNC */
#endif /* !_WIN32 || __CYGWIN__ */
#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */
+1
View File
@@ -242,6 +242,7 @@ static const uint64_t _MHD_itc_wr_data = 1;
*/
int
MHD_itc_nonblocking_ (struct MHD_itc_ itc);
#endif /* ! HAVE_PIPE2_FUNC */
-1
View File
@@ -94,7 +94,6 @@ static int64_t perf_start;
#endif /* _WIN32 */
/**
* Type of monotonic clock source
*/
+3 -1
View File
@@ -37,7 +37,8 @@
* @param err the WinSock error code.
* @return pointer to string description of specified WinSock error.
*/
const char*MHD_W32_strerror_winsock_ (int err)
const char*
MHD_W32_strerror_winsock_ (int err)
{
switch (err)
{
@@ -358,6 +359,7 @@ MHD_W32_socket_pair_ (SOCKET sockets_pair[2], int non_blk)
return 0;
}
#endif /* MHD_WINSOCK_SOCKETS */
+1
View File
@@ -534,6 +534,7 @@ typedef int MHD_SCKT_SEND_SIZE_;
* @return pointer to string description of specified WinSock error.
*/
const char*MHD_W32_strerror_winsock_ (int err);
#endif /* MHD_WINSOCK_SOCKETS */
/* MHD_socket_last_strerr_ is description string of specified socket error code */
+31 -12
View File
@@ -63,6 +63,8 @@ isasciilower (char c)
{
return (c >= 'a') && (c <= 'z');
}
#endif /* Disable unused functions. */
@@ -91,6 +93,8 @@ isasciialpha (char c)
{
return isasciilower (c) || isasciiupper (c);
}
#endif /* Disable unused functions. */
@@ -106,6 +110,7 @@ isasciidigit (char c)
return (c >= '0') && (c <= '9');
}
#if 0 /* Disable unused functions. */
/**
* Check whether character is hexadecimal digit in US-ASCII
@@ -133,6 +138,8 @@ isasciialnum (char c)
{
return isasciialpha (c) || isasciidigit (c);
}
#endif /* Disable unused functions. */
@@ -167,6 +174,8 @@ toasciiupper (char c)
{
return isasciilower (c) ? (c - 'a' + 'A') : c;
}
#endif /* Disable unused functions. */
@@ -185,6 +194,8 @@ todigitvalue (char c)
return -1;
}
#endif /* MHD_FAVOR_SMALL_CODE */
@@ -206,6 +217,8 @@ toxdigitvalue (char c)
return -1;
}
#else /* !INLINE_FUNC */
@@ -345,6 +358,8 @@ MHD_str_equal_caseless_ (const char *str1,
}
return 0 == (*str2);
}
#endif /* ! MHD_FAVOR_SMALL_CODE */
@@ -427,7 +442,7 @@ MHD_str_has_token_caseless_ (const char *str,
while (' ' == *str || '\t' == *str)
str++;
/* End of (sub)string? */
if ((0 == *str) ||(',' == *str) )
if ((0 == *str) || (',' == *str) )
return true;
/* Unmatched chars at end of substring. */
break;
@@ -440,6 +455,7 @@ MHD_str_has_token_caseless_ (const char *str,
return false;
}
#ifndef MHD_FAVOR_SMALL_CODE
/* Use individual function for each case */
@@ -554,8 +570,8 @@ MHD_strx_to_uint32_ (const char *str,
while (digit >= 0)
{
if ( (res < (UINT32_MAX / 16)) ||
((res == (UINT32_MAX / 16)) &&( (uint32_t) digit <= (UINT32_MAX
% 16)) ) )
((res == (UINT32_MAX / 16)) && ( (uint32_t) digit <= (UINT32_MAX
% 16)) ) )
{
res *= 16;
res += digit;
@@ -601,8 +617,8 @@ MHD_strx_to_uint32_n_ (const char *str,
while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
{
if ( (res > (UINT32_MAX / 16)) ||
((res == (UINT32_MAX / 16)) &&( (uint32_t) digit > (UINT32_MAX
% 16)) ) )
((res == (UINT32_MAX / 16)) && ( (uint32_t) digit > (UINT32_MAX
% 16)) ) )
return 0;
res *= 16;
@@ -641,8 +657,8 @@ MHD_strx_to_uint64_ (const char *str,
while (digit >= 0)
{
if ( (res < (UINT64_MAX / 16)) ||
((res == (UINT64_MAX / 16)) &&( (uint64_t) digit <= (UINT64_MAX
% 16)) ) )
((res == (UINT64_MAX / 16)) && ( (uint64_t) digit <= (UINT64_MAX
% 16)) ) )
{
res *= 16;
res += digit;
@@ -688,8 +704,8 @@ MHD_strx_to_uint64_n_ (const char *str,
while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
{
if ( (res > (UINT64_MAX / 16)) ||
((res == (UINT64_MAX / 16)) &&( (uint64_t) digit > (UINT64_MAX
% 16)) ) )
((res == (UINT64_MAX / 16)) && ( (uint64_t) digit > (UINT64_MAX
% 16)) ) )
return 0;
res *= 16;
@@ -702,6 +718,7 @@ MHD_strx_to_uint64_n_ (const char *str,
return i;
}
#else /* MHD_FAVOR_SMALL_CODE */
/**
@@ -738,8 +755,8 @@ MHD_str_to_uvalue_n_ (const char *str,
int (*const dfunc)(char) = (base == 16) ?
toxdigitvalue : todigitvalue;
if ( ! str || ! out_val ||
((base != 16)&&(base != 10)) )
if (! str || ! out_val ||
((base != 16) && (base != 10)) )
return 0;
res = 0;
@@ -747,7 +764,7 @@ MHD_str_to_uvalue_n_ (const char *str,
while (maxlen > i && 0 <= (digit = dfunc (str[i])))
{
if ( ((max_v_div_b) < res) ||
(( (max_v_div_b) == res) &&( (max_v_mod_b) < (uint64_t) digit) ) )
(( (max_v_div_b) == res) && ( (max_v_mod_b) < (uint64_t) digit) ) )
return 0;
res *= base;
@@ -766,4 +783,6 @@ MHD_str_to_uvalue_n_ (const char *str,
}
return i;
}
#endif /* MHD_FAVOR_SMALL_CODE */
+1
View File
@@ -60,6 +60,7 @@
int
MHD_str_equal_caseless_ (const char *str1,
const char *str2);
#else /* MHD_FAVOR_SMALL_CODE */
/* Reuse MHD_str_equal_caseless_n_() to reduce size */
#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \
+7 -5
View File
@@ -80,8 +80,7 @@ MHD_set_thread_name_ (const MHD_thread_ID_ thread_id,
* third argument is single argument for printf;
* OSF1 use 3 arguments too, but last one always must be zero (NULL).
* MHD doesn't use '%' in thread names, so both form are used in same way.
*/
return ! pthread_setname_np (thread_id, thread_name, 0);
*/return ! pthread_setname_np (thread_id, thread_name, 0);
#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */
}
@@ -235,6 +234,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
#endif
}
#ifdef MHD_USE_THREAD_NAME_
#ifndef MHD_USE_THREAD_ATTR_SETNAME
@@ -276,6 +276,8 @@ named_thread_starter (void *data)
return thr_func (arg);
}
#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
@@ -308,14 +310,13 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
* third argument is single argument for printf;
* OSF1 use 3 arguments too, but last one always must be zero (NULL).
* MHD doesn't use '%' in thread names, so both form are used in same way.
*/
res = pthread_attr_setname_np (&attr, thread_name, 0);
*/res = pthread_attr_setname_np (&attr, thread_name, 0);
#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI)
res = pthread_attr_setname_np (&attr, thread_name);
#else
#error No pthread_attr_setname_np() function.
#endif
if ((res == 0) &&(0 != stack_size) )
if ((res == 0) && (0 != stack_size) )
res = pthread_attr_setstacksize (&attr,
stack_size);
if (0 == res)
@@ -362,4 +363,5 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
}
#endif /* MHD_USE_THREAD_NAME_ */
+1
View File
@@ -256,4 +256,5 @@ MHD_response_get_header (struct MHD_Response *response,
return NULL;
}
/* end of response.c */
+1
View File
@@ -91,4 +91,5 @@ MHD_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
#endif
}
/* end of response_for_upgrade.c */
+1
View File
@@ -85,4 +85,5 @@ MHD_response_from_buffer (enum MHD_HTTP_StatusCode sc,
return response;
}
/* end of response_from_buffer.c */
+1
View File
@@ -207,4 +207,5 @@ MHD_response_from_fd (enum MHD_HTTP_StatusCode sc,
return response;
}
/* end of response_from_fd.c */
+2 -1
View File
@@ -102,7 +102,7 @@ tdelete (const void *__restrict vkey,
node_t *r;
int cmp;
if ((rootp == NULL)||((p = *rootp) == NULL))
if ((rootp == NULL) || ((p = *rootp) == NULL))
return NULL;
while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0)
@@ -140,4 +140,5 @@ tdelete (const void *__restrict vkey,
return p;
}
/* end of tsearch.c */
+5 -7
View File
@@ -85,8 +85,7 @@ MHD_upgrade_response_handle_process_ (struct MHD_UpgradeResponseHandle *urh)
* check for any pending data even if socket is not marked
* as 'ready' (signal may arrive after poll()/select()).
* Socketpair for forwarding is always in non-blocking mode
* so no risk that recv() will block the thread. */
if (0 != urh->out_buffer_size)
* so no risk that recv() will block the thread. */if (0 != urh->out_buffer_size)
urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
/* Discard any data received form remote. */
urh->in_buffer_used = 0;
@@ -102,11 +101,8 @@ MHD_upgrade_response_handle_process_ (struct MHD_UpgradeResponseHandle *urh)
* fail after remote disconnect was detected) may discard data in system
* buffers received by system but not yet read by recv().
* So, before trying send() on any socket, recv() must be performed at first
* otherwise last part of incoming data may be lost. */
/* If disconnect or error was detected - try to read from socket
* to dry data possibly pending is system buffers. */
if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
* otherwise last part of incoming data may be lost. *//* If disconnect or error was detected - try to read from socket
* to dry data possibly pending is system buffers. */if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
urh->app.celi |= MHD_EPOLL_STATE_READ_READY;
if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi))
urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
@@ -392,6 +388,8 @@ MHD_upgrade_response_handle_process_ (struct MHD_UpgradeResponseHandle *urh)
urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY;
}
}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
/* end of upgrade_process.c */
+1 -1
View File
@@ -46,7 +46,7 @@ MHD_get_version (void)
(((int) MHD_VERSION >> 24) & 0xFF),
(((int) MHD_VERSION >> 16) & 0xFF),
(((int) MHD_VERSION >> 8) & 0xFF));
if ((0 >= res)||(sizeof(ver) <= res))
if ((0 >= res) || (sizeof(ver) <= res))
return "0.0.0"; /* Can't return real version*/
}
return ver;
+2 -1
View File
@@ -143,7 +143,7 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
hlen,
"Basic realm=\"%s\"",
realm);
if ((res > 0)&&((size_t) res < hlen))
if ((res > 0) && ((size_t) res < hlen))
ret = MHD_add_response_header (response,
MHD_HTTP_HEADER_WWW_AUTHENTICATE,
header);
@@ -167,4 +167,5 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
return ret;
}
/* end of basicauth.c */
+19 -17
View File
@@ -175,6 +175,8 @@ MHD_conn_init_static_ (void)
}
#endif /* SF_FLAGS */
}
#endif /* HAVE_FREEBSD_SENDFILE */
/**
* Callback for receiving data from the socket.
@@ -634,10 +636,12 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection,
{
struct MHD_HTTP_Header *pos;
if ((NULL == connection)||(NULL == header)||(0 == header[0])||(NULL ==
token) ||(0 ==
token
[0]) )
if ((NULL == connection) || (NULL == header) || (0 == header[0]) || (NULL ==
token) ||
(0 ==
token
[
0]) )
return false;
for (pos = connection->headers_received; NULL != pos; pos = pos->next)
@@ -721,8 +725,7 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection)
* and do not shutdown TCP socket. This give more
* chances to send TLS closure data to remote side.
* Closure of TLS layer will be interpreted by
* remote side as end of transmission. */
if (0 != (daemon->options & MHD_USE_TLS))
* remote side as end of transmission. */if (0 != (daemon->options & MHD_USE_TLS))
{
if (! MHD_tls_connection_shutdown (connection))
shutdown (connection->socket_fd,
@@ -829,8 +832,9 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection)
* used with MHD_UPGRADE_ACTION_CLOSE. They will be
* closed by MHD_cleanup_upgraded_connection_() during
* connection's final cleanup.
*/
}
*/}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/
@@ -999,7 +1003,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
= (size_t) (connection->response_write_position - response->data_start);
/* buffer already ready, use what is there for the chunk */
ret = response->data_size - data_write_offset;
if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2 )
if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2)
ret = connection->write_buffer_size - sizeof (cbuf) - 2;
memcpy (&connection->write_buffer[sizeof (cbuf)],
&response->data[data_write_offset],
@@ -1454,8 +1458,7 @@ build_header_response (struct MHD_Connection *connection)
Note that the change from 'SHOULD NOT' to 'MUST NOT' is
a recent development of the HTTP 1.1 specification.
*/
content_length_len
*/content_length_len
= MHD_snprintf_ (content_length_buf,
sizeof (content_length_buf),
MHD_HTTP_HEADER_CONTENT_LENGTH ": "
@@ -1788,8 +1791,7 @@ MHD_connection_update_event_loop_info (struct MHD_Connection *connection)
or if we do nothing, we would just timeout
on the connection (if a timeout is even
set!).
Solution: we kill the connection with an error */
transmit_error_response (connection,
Solution: we kill the connection with an error */transmit_error_response (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
INTERNAL_ERROR);
continue;
@@ -2559,8 +2561,7 @@ process_header_line (struct MHD_Connection *connection,
header at the beginning of the while
loop since we need to be able to inspect
the *next* header line (in case it starts
with a space...) */
connection->last = line;
with a space...) */connection->last = line;
connection->colon = colon;
return MHD_YES;
}
@@ -2607,8 +2608,7 @@ process_broken_line (struct MHD_Connection *connection,
adjacency); also, in the case where these are not adjacent
(not sure how it can happen!), we would want to allocate from
the end of the pool, so as to not destroy the read-buffer's
ability to grow nicely. */
last = MHD_pool_reallocate (connection->pool,
ability to grow nicely. */last = MHD_pool_reallocate (connection->pool,
last,
last_len + 1,
last_len + tmp_len + 1);
@@ -3804,6 +3804,8 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection)
}
return MHD_YES;
}
#endif
+3
View File
@@ -68,6 +68,7 @@
*/
void
MHD_conn_init_static_ (void);
#endif /* HAVE_FREEBSD_SENDFILE */
@@ -152,6 +153,7 @@ MHD_connection_close_ (struct MHD_Connection *connection,
*/
void
MHD_connection_finish_forward_ (struct MHD_Connection *connection);
#else /* ! HTTPS_SUPPORT */
#define MHD_connection_finish_forward_(conn) (void) conn
#endif /* ! HTTPS_SUPPORT */
@@ -168,6 +170,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection);
*/
int
MHD_connection_epoll_update_ (struct MHD_Connection *connection);
#endif
/**
+1
View File
@@ -226,4 +226,5 @@ MHD_tls_connection_shutdown (struct MHD_Connection *connection)
return false;
}
/* end of connection_https.c */
+1
View File
@@ -74,6 +74,7 @@ ssize_t
send_tls_adapter (struct MHD_Connection *connection,
const void *other,
size_t i);
#endif /* HTTPS_SUPPORT */
#endif
+48 -23
View File
@@ -216,6 +216,8 @@ MHD_check_global_init_ (void)
#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */
#endif
}
#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
@@ -654,6 +656,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
return -1;
}
/**
* Initialize security aspects of the HTTPS daemon
*
@@ -684,6 +687,8 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
return -1;
}
}
#endif /* HTTPS_SUPPORT */
@@ -858,6 +863,7 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh,
}
}
#ifdef HAVE_POLL
/**
@@ -950,6 +956,8 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh,
if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR))
urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY;
}
#endif /* HAVE_POLL */
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -1236,10 +1244,8 @@ call_handlers (struct MHD_Connection *con,
immediately.
As writeability of socket was not checked and it may have
some data pending in system buffers, use this optimization
only for non-blocking sockets. */
/* No need to check 'ret' as connection is always in
* MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */
else if (on_fasttrack && con->sk_nonblck)
only for non-blocking sockets. *//* No need to check 'ret' as connection is always in
* MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */else if (on_fasttrack && con->sk_nonblck)
{
if (MHD_CONNECTION_HEADERS_SENDING == con->state)
{
@@ -1312,6 +1318,8 @@ cleanup_upgraded_connection (struct MHD_Connection *connection)
connection->urh = NULL;
free (urh);
}
#endif /* UPGRADE_SUPPORT */
@@ -1371,8 +1379,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
* check for any pending data even if socket is not marked
* as 'ready' (signal may arrive after poll()/select()).
* Socketpair for forwarding is always in non-blocking mode
* so no risk that recv() will block the thread. */
if (0 != urh->out_buffer_size)
* so no risk that recv() will block the thread. */if (0 != urh->out_buffer_size)
urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
/* Discard any data received form remote. */
urh->in_buffer_used = 0;
@@ -1388,11 +1395,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
* fail after remote disconnect was detected) may discard data in system
* buffers received by system but not yet read by recv().
* So, before trying send() on any socket, recv() must be performed at first
* otherwise last part of incoming data may be lost. */
/* If disconnect or error was detected - try to read from socket
* to dry data possibly pending is system buffers. */
if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
* otherwise last part of incoming data may be lost. *//* If disconnect or error was detected - try to read from socket
* to dry data possibly pending is system buffers. */if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
urh->app.celi |= MHD_EPOLL_STATE_READ_READY;
if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi))
urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
@@ -1669,6 +1673,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY;
}
}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
@@ -1823,6 +1829,8 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
/* Do not set 'urh->clean_ready' yet as 'urh' will be used
* in connection thread for a little while. */
}
#endif /* UPGRADE_SUPPORT */
@@ -2182,7 +2190,7 @@ thread_main_handle_connection (void *data)
MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN :
MHD_REQUEST_TERMINATED_WITH_ERROR);
MHD_connection_handle_idle (con);
exit:
exit:
if (NULL != con->response)
{
MHD_destroy_response (con->response);
@@ -2208,6 +2216,8 @@ thread_main_handle_connection (void *data)
}
return (MHD_THRD_RTRN_TYPE_) 0;
}
#endif
@@ -2248,6 +2258,8 @@ MHD_tls_push_func_ (gnutls_transport_ptr_t trnsp,
#endif /* (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) */
return MHD_send_ ((MHD_socket) (intptr_t) (trnsp), data, data_size);
}
#endif /* MHD_TLSLIB_DONT_SUPPRESS_SIGPIPE */
@@ -2327,6 +2339,8 @@ psk_gnutls_adapter (gnutls_session_t session,
return -1;
#endif
}
#endif /* HTTPS_SUPPORT */
@@ -2742,7 +2756,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
#endif
}
return MHD_YES;
cleanup:
cleanup:
if (NULL != daemon->notify_connection)
daemon->notify_connection (daemon->notify_connection_cls,
connection,
@@ -3223,7 +3237,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
{
MHD_socket_close_chk_ (s);
}
if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
if (MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
{
/* system/process out of resources */
if (0 == daemon->connections)
@@ -3375,8 +3389,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
this is not true as if we fail to do manually remove it,
we are still seeing an event for this fd in epoll,
causing grief (use-after-free...) --- at least on my
system. */
if (0 != epoll_ctl (daemon->epoll_fd,
system. */if (0 != epoll_ctl (daemon->epoll_fd,
EPOLL_CTL_DEL,
pos->socket_fd,
NULL))
@@ -3632,7 +3645,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
if (0 != (daemon->options
& (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) )
return MHD_NO;
if ((NULL == read_fd_set)||(NULL == write_fd_set))
if ((NULL == read_fd_set) || (NULL == write_fd_set))
return MHD_NO;
if (NULL == except_fd_set)
{ /* Workaround to maintain backward compatibility. */
@@ -3770,6 +3783,8 @@ MHD_select (struct MHD_Daemon *daemon,
#if defined(MHD_WINSOCK_SOCKETS)
}
}
#endif /* MHD_WINSOCK_SOCKETS */
}
/* Stop listening if we are at the configured connection limit */
@@ -4130,6 +4145,8 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
(void) MHD_accept_connection (daemon);
return MHD_YES;
}
#endif
@@ -4319,6 +4336,8 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
return MHD_YES;
}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -4607,8 +4626,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
here.
Connections with custom timeouts must all be looked at, as we
do not bother to sort that (presumably very short) list. */
prev = daemon->manual_timeout_tail;
do not bother to sort that (presumably very short) list. */prev = daemon->manual_timeout_tail;
while (NULL != (pos = prev))
{
prev = pos->prevX;
@@ -4628,6 +4646,8 @@ MHD_epoll (struct MHD_Daemon *daemon,
}
return MHD_YES;
}
#endif
@@ -4759,6 +4779,8 @@ MHD_polling_thread (void *cls)
return (MHD_THRD_RTRN_TYPE_) 0;
}
#endif
@@ -5644,6 +5666,8 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
}
return MHD_YES;
}
#endif
@@ -6553,7 +6577,7 @@ MHD_start_daemon_va (unsigned int flags,
return daemon;
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
thread_failed:
thread_failed:
/* If no worker threads created, then shut down normally. Calling
MHD_stop_daemon (as we do below) doesn't work here since it
assumes a 0-sized thread pool means we had been in the default
@@ -6577,7 +6601,7 @@ MHD_start_daemon_va (unsigned int flags,
return NULL;
#endif
free_and_fail:
free_and_fail:
/* clean up basic memory state in 'daemon' and return NULL to
indicate failure */
#ifdef EPOLL_SUPPORT
@@ -7053,7 +7077,7 @@ MHD_get_version (void)
(((int) MHD_VERSION >> 24) & 0xFF),
(((int) MHD_VERSION >> 16) & 0xFF),
(((int) MHD_VERSION >> 8) & 0xFF));
if ((0 >= res)||(sizeof(ver) <= res))
if ((0 >= res) || (sizeof(ver) <= res))
return "0.0.0"; /* Can't return real version*/
}
return ver;
@@ -7301,7 +7325,7 @@ MHD_init (void)
if (0 != WSAStartup (MAKEWORD (2, 2), &wsd))
MHD_PANIC (_ ("Failed to initialize winsock\n"));
mhd_winsock_inited_ = 1;
if ((2 != LOBYTE (wsd.wVersion))&&(2 != HIBYTE (wsd.wVersion)))
if ((2 != LOBYTE (wsd.wVersion)) && (2 != HIBYTE (wsd.wVersion)))
MHD_PANIC (_ ("Winsock version 2.2 is not available\n"));
#endif /* MHD_WINSOCK_SOCKETS */
#ifdef HTTPS_SUPPORT
@@ -7346,6 +7370,7 @@ MHD_fini (void)
MHD_monotonic_sec_counter_finish ();
}
#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
_SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini);
#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */
+6 -13
View File
@@ -555,8 +555,7 @@ check_nonce_nc (struct MHD_Connection *connection,
* Look for the nonce, if it does exist and its corresponding
* nonce counter is less than the current nonce counter by 1,
* then only increase the nonce counter by one.
*/
nn = &daemon->nnc[off];
*/nn = &daemon->nnc[off];
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
MHD_mutex_lock_chk_ (&daemon->nnc_lock);
#endif
@@ -938,8 +937,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
large, but of course in theory the
#MHD_OPTION_CONNECTION_MEMORY_LIMIT might be very large
and would thus permit sending a >32k authorization
header value. */
return MHD_NO;
header value. */return MHD_NO;
}
if (TIMESTAMP_BIN_SIZE * 2 !=
MHD_strx_to_uint32_n_ (nonce + len - TIMESTAMP_BIN_SIZE * 2,
@@ -957,8 +955,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
* First level vetting for the nonce validity: if the timestamp
* attached to the nonce exceeds `nonce_timeout', then the nonce is
* invalid.
*/
if ( (t > nonce_time + nonce_timeout) ||
*/if ( (t > nonce_time + nonce_timeout) ||
(nonce_time + nonce_timeout < nonce_time) )
{
/* too old */
@@ -981,9 +978,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
* able to generate a "sane" nonce, which if he does
* not, the nonce fabrication process going to be
* very hard to achieve.
*/
if (0 != strcmp (nonce,
*/if (0 != strcmp (nonce,
noncehashexp))
{
return MHD_INVALID_NONCE;
@@ -1003,7 +998,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
(0 == (len = lookup_sub_value (nc,
sizeof (nc),
header,
"nc")) ) ||
"nc")) ) ||
(0 == lookup_sub_value (response,
sizeof (response),
header,
@@ -1030,8 +1025,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
* Checking if that combination of nonce and nc is sound
* and not a replay attack attempt. Also adds the nonce
* to the nonce-nc map if it does not exist there.
*/
if (MHD_YES !=
*/if (MHD_YES !=
check_nonce_nc (connection,
nonce,
nci))
@@ -1219,7 +1213,6 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
} while (0)
/**
* Authenticates the authorization header sent by the client.
*
+5
View File
@@ -81,6 +81,8 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state)
return "unrecognized connection state";
}
}
#endif
#endif
@@ -105,6 +107,8 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
va);
va_end (va);
}
#endif
@@ -288,4 +292,5 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
return MHD_YES;
}
/* end of internal.c */
+2 -1
View File
@@ -255,6 +255,7 @@ void
MHD_DLOG (const struct MHD_Daemon *daemon,
const char *format,
...);
#endif
@@ -562,6 +563,7 @@ enum MHD_TLS_CONN_STATE
#if DEBUG_STATES
const char *
MHD_state_to_string (enum MHD_CONNECTION_STATE state);
#endif
#endif
@@ -1802,7 +1804,6 @@ struct MHD_Daemon
(element)->prev = NULL; } while (0)
/**
* Insert an element at the head of a XDLL. Assumes that head, tail and
* element are structs with prevX and nextX fields.
+1
View File
@@ -46,6 +46,7 @@ MHD_MD5Init (void *ctx_)
ctx->state[3] = 0x10325476;
}
static void
MD5Transform (uint32_t state[4],
const uint8_t block[MD5_BLOCK_SIZE]);
+1
View File
@@ -100,6 +100,7 @@ MHD_init_mem_pools_ (void)
#endif /* _WIN32 */
}
/**
* Handle for a memory pool. Pools are not reentrant and must not be
* used by multiple threads.
+1 -1
View File
@@ -125,7 +125,7 @@
defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__)
/* x86 family is little endian */
#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN
#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
/* Looks like we are on ARM/MIPS in big endian mode */
#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN
+7 -3
View File
@@ -79,6 +79,7 @@ W32_snprintf (char *__restrict s,
return ret;
}
#endif /* HAVE_SNPRINTF */
#endif /* _WIN32 && !__CYGWIN__ */
@@ -93,16 +94,17 @@ W32_snprintf (char *__restrict s,
#endif /* __GNUC__ >= 5 */
void *MHD_calloc_ (size_t nelem, size_t elsize)
void *
MHD_calloc_ (size_t nelem, size_t elsize)
{
size_t alloc_size;
void *ptr;
#ifdef MHD_HAVE_NUL_OVERFLOW
if (__builtin_mul_overflow (nelem, elsize, &alloc_size) ||(0 == alloc_size))
if (__builtin_mul_overflow (nelem, elsize, &alloc_size) || (0 == alloc_size))
return NULL;
#else /* ! MHD_HAVE_NUL_OVERFLOW */
alloc_size = nelem * elsize;
if ((0 == alloc_size)||(elsize != alloc_size / nelem))
if ((0 == alloc_size) || (elsize != alloc_size / nelem))
return NULL;
#endif /* ! MHD_HAVE_NUL_OVERFLOW */
ptr = malloc (alloc_size);
@@ -111,4 +113,6 @@ void *MHD_calloc_ (size_t nelem, size_t elsize)
memset (ptr, 0, alloc_size);
return ptr;
}
#endif /* ! HAVE_CALLOC */
+2
View File
@@ -51,6 +51,7 @@
/* Emulate snprintf function on W32 */
int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
...);
#define MHD_snprintf_ W32_snprintf
#else /* ! _WIN32 || __CYGWIN__ */
#error \
@@ -84,6 +85,7 @@ int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
* MHD_calloc_ is platform-independent calloc()
*/
void *MHD_calloc_ (size_t nelem, size_t elsize);
#endif /* ! HAVE_CALLOC */
#endif /* MHD_COMPAT_H */
+2
View File
@@ -65,6 +65,8 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc)
}
return ! 0;
}
#endif /* ! HAVE_PIPE2_FUNC */
#endif /* !_WIN32 || __CYGWIN__ */
#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */
+1
View File
@@ -242,6 +242,7 @@ static const uint64_t _MHD_itc_wr_data = 1;
*/
int
MHD_itc_nonblocking_ (struct MHD_itc_ itc);
#endif /* ! HAVE_PIPE2_FUNC */
-1
View File
@@ -94,7 +94,6 @@ static int64_t perf_start;
#endif /* _WIN32 */
/**
* Type of monotonic clock source
*/
+4 -2
View File
@@ -448,6 +448,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
#endif
}
/**
* sendfile() chuck size
*/
@@ -561,8 +562,7 @@ MHD_send_sendfile_ (struct MHD_Connection *connection)
supported for FD or other 'unusual' errors occurred, so we should try
to fall back to 'SEND'; see also this thread for info on
odd libc/Linux behavior with sendfile:
http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */
connection->resp_sender = MHD_resp_sender_std;
http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */connection->resp_sender = MHD_resp_sender_std;
return MHD_ERR_AGAIN_;
#else /* HAVE_SOLARIS_SENDFILE */
if ( (EAFNOSUPPORT == err) ||
@@ -662,4 +662,6 @@ MHD_send_sendfile_ (struct MHD_Connection *connection)
return ret;
}
#endif /* _MHD_HAVE_SENDFILE */
+1
View File
@@ -94,6 +94,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
#if defined(_MHD_HAVE_SENDFILE)
ssize_t
MHD_send_sendfile_ (struct MHD_Connection *connection);
#endif
#endif /* MHD_SEND_H */
+4 -2
View File
@@ -37,7 +37,8 @@
* @param err the WinSock error code.
* @return pointer to string description of specified WinSock error.
*/
const char*MHD_W32_strerror_winsock_ (int err)
const char*
MHD_W32_strerror_winsock_ (int err)
{
switch (err)
{
@@ -358,6 +359,7 @@ MHD_W32_socket_pair_ (SOCKET sockets_pair[2], int non_blk)
return 0;
}
#endif /* MHD_WINSOCK_SOCKETS */
@@ -515,7 +517,7 @@ MHD_socket_cork_ (MHD_socket sock,
(const void *) (on ? &on_val : &off_val),
sizeof (off_val)))
return 0; /* failed */
#if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9
#if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9
/* FreeBSD do not need zero-send for flushing starting from version 9 */
return 1;
#elif defined(TCP_NOPUSH) && ! defined(TCP_CORK)
+1
View File
@@ -554,6 +554,7 @@ typedef int MHD_SCKT_SEND_SIZE_;
* @return pointer to string description of specified WinSock error.
*/
const char*MHD_W32_strerror_winsock_ (int err);
#endif /* MHD_WINSOCK_SOCKETS */
/* MHD_socket_last_strerr_ is description string of specified socket error code */
+31 -13
View File
@@ -63,6 +63,8 @@ isasciilower (char c)
{
return (c >= 'a') && (c <= 'z');
}
#endif /* Disable unused functions. */
@@ -91,6 +93,8 @@ isasciialpha (char c)
{
return isasciilower (c) || isasciiupper (c);
}
#endif /* Disable unused functions. */
@@ -106,6 +110,7 @@ isasciidigit (char c)
return (c >= '0') && (c <= '9');
}
#if 0 /* Disable unused functions. */
/**
* Check whether character is hexadecimal digit in US-ASCII
@@ -133,6 +138,8 @@ isasciialnum (char c)
{
return isasciialpha (c) || isasciidigit (c);
}
#endif /* Disable unused functions. */
@@ -167,6 +174,8 @@ toasciiupper (char c)
{
return isasciilower (c) ? (c - 'a' + 'A') : c;
}
#endif /* Disable unused functions. */
@@ -185,6 +194,8 @@ todigitvalue (char c)
return -1;
}
#endif /* MHD_FAVOR_SMALL_CODE */
@@ -206,6 +217,8 @@ toxdigitvalue (char c)
return -1;
}
#else /* !INLINE_FUNC */
@@ -345,6 +358,8 @@ MHD_str_equal_caseless_ (const char *str1,
}
return 0 == (*str2);
}
#endif /* ! MHD_FAVOR_SMALL_CODE */
@@ -408,7 +423,6 @@ MHD_str_equal_caseless_bin_n_ (const char *const str1,
}
/**
* Check whether @a str has case-insensitive @a token.
* Token could be surrounded by spaces and tabs and delimited by comma.
@@ -456,7 +470,7 @@ MHD_str_has_token_caseless_ (const char *str,
while (' ' == *str || '\t' == *str)
str++;
/* End of (sub)string? */
if ((0 == *str) ||(',' == *str) )
if ((0 == *str) || (',' == *str) )
return true;
/* Unmatched chars at end of substring. */
break;
@@ -469,6 +483,7 @@ MHD_str_has_token_caseless_ (const char *str,
return false;
}
#ifndef MHD_FAVOR_SMALL_CODE
/* Use individual function for each case */
@@ -583,8 +598,8 @@ MHD_strx_to_uint32_ (const char *str,
while (digit >= 0)
{
if ( (res < (UINT32_MAX / 16)) ||
((res == (UINT32_MAX / 16)) &&( (uint32_t) digit <= (UINT32_MAX
% 16)) ) )
((res == (UINT32_MAX / 16)) && ( (uint32_t) digit <= (UINT32_MAX
% 16)) ) )
{
res *= 16;
res += digit;
@@ -630,8 +645,8 @@ MHD_strx_to_uint32_n_ (const char *str,
while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
{
if ( (res > (UINT32_MAX / 16)) ||
((res == (UINT32_MAX / 16)) &&( (uint32_t) digit > (UINT32_MAX
% 16)) ) )
((res == (UINT32_MAX / 16)) && ( (uint32_t) digit > (UINT32_MAX
% 16)) ) )
return 0;
res *= 16;
@@ -670,8 +685,8 @@ MHD_strx_to_uint64_ (const char *str,
while (digit >= 0)
{
if ( (res < (UINT64_MAX / 16)) ||
((res == (UINT64_MAX / 16)) &&( (uint64_t) digit <= (UINT64_MAX
% 16)) ) )
((res == (UINT64_MAX / 16)) && ( (uint64_t) digit <= (UINT64_MAX
% 16)) ) )
{
res *= 16;
res += digit;
@@ -717,8 +732,8 @@ MHD_strx_to_uint64_n_ (const char *str,
while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
{
if ( (res > (UINT64_MAX / 16)) ||
((res == (UINT64_MAX / 16)) &&( (uint64_t) digit > (UINT64_MAX
% 16)) ) )
((res == (UINT64_MAX / 16)) && ( (uint64_t) digit > (UINT64_MAX
% 16)) ) )
return 0;
res *= 16;
@@ -731,6 +746,7 @@ MHD_strx_to_uint64_n_ (const char *str,
return i;
}
#else /* MHD_FAVOR_SMALL_CODE */
/**
@@ -767,8 +783,8 @@ MHD_str_to_uvalue_n_ (const char *str,
int (*const dfunc)(char) = (base == 16) ?
toxdigitvalue : todigitvalue;
if ( ! str || ! out_val ||
((base != 16)&&(base != 10)) )
if (! str || ! out_val ||
((base != 16) && (base != 10)) )
return 0;
res = 0;
@@ -776,7 +792,7 @@ MHD_str_to_uvalue_n_ (const char *str,
while (maxlen > i && 0 <= (digit = dfunc (str[i])))
{
if ( ((max_v_div_b) < res) ||
(( (max_v_div_b) == res) &&( (max_v_mod_b) < (uint64_t) digit) ) )
(( (max_v_div_b) == res) && ( (max_v_mod_b) < (uint64_t) digit) ) )
return 0;
res *= base;
@@ -795,4 +811,6 @@ MHD_str_to_uvalue_n_ (const char *str,
}
return i;
}
#endif /* MHD_FAVOR_SMALL_CODE */
+1
View File
@@ -60,6 +60,7 @@
int
MHD_str_equal_caseless_ (const char *str1,
const char *str2);
#else /* MHD_FAVOR_SMALL_CODE */
/* Reuse MHD_str_equal_caseless_n_() to reduce size */
#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \
+7 -5
View File
@@ -80,8 +80,7 @@ MHD_set_thread_name_ (const MHD_thread_ID_ thread_id,
* third argument is single argument for printf;
* OSF1 use 3 arguments too, but last one always must be zero (NULL).
* MHD doesn't use '%' in thread names, so both form are used in same way.
*/
return ! pthread_setname_np (thread_id, thread_name, 0);
*/return ! pthread_setname_np (thread_id, thread_name, 0);
#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */
}
@@ -235,6 +234,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
#endif
}
#ifdef MHD_USE_THREAD_NAME_
#ifndef MHD_USE_THREAD_ATTR_SETNAME
@@ -276,6 +276,8 @@ named_thread_starter (void *data)
return thr_func (arg);
}
#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
@@ -308,8 +310,7 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
* third argument is single argument for printf;
* OSF1 use 3 arguments too, but last one always must be zero (NULL).
* MHD doesn't use '%' in thread names, so both form are used in same way.
*/
res = pthread_attr_setname_np (&attr,
*/res = pthread_attr_setname_np (&attr,
thread_name,
0);
#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI)
@@ -318,7 +319,7 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
#else
#error No pthread_attr_setname_np() function.
#endif
if ((res == 0) &&(0 != stack_size) )
if ((res == 0) && (0 != stack_size) )
res = pthread_attr_setstacksize (&attr,
stack_size);
if (0 == res)
@@ -365,4 +366,5 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
}
#endif /* MHD_USE_THREAD_NAME_ */
+2 -2
View File
@@ -1013,8 +1013,7 @@ post_process_multipart (struct MHD_PostProcessor *pp,
* > generally be left blank, and implementations must ignore
* > anything that appears before the first boundary delimiter
* > line or after the last one.
*/
(void) find_boundary (pp,
*/(void) find_boundary (pp,
pp->boundary,
pp->blen,
&ioff,
@@ -1290,4 +1289,5 @@ MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
return ret;
}
/* end of postprocessor.c */
+3
View File
@@ -541,6 +541,7 @@ free_callback (void *cls)
response->fd = -1;
}
#undef MHD_create_response_from_fd_at_offset
/**
@@ -1195,6 +1196,8 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
}
return response;
}
#endif /* UPGRADE_SUPPORT */
+2
View File
@@ -62,6 +62,7 @@ MHD_SHA256_init (void *ctx_)
ctx->count = 0;
}
/**
* Number of bytes in single SHA-256 word
* used to process data
@@ -246,6 +247,7 @@ sha256_transform (uint32_t H[_SHA256_DIGEST_LENGTH],
H[7] += h;
}
/**
* Process portion of bytes.
*
+2 -1
View File
@@ -64,6 +64,7 @@ has_in_name (const char *prog_name, const char *marker)
return strstr (prog_name + name_pos, marker) != (char*) 0;
}
/**
* Check whether one of strings in array is equal to @a param.
* String @a argv[0] is ignored.
@@ -83,7 +84,7 @@ has_param (int argc, char *const argv[], const char *param)
for (i = 1; i < argc; i++)
{
if (argv[i] &&(strcmp (argv[i], param) == 0) )
if (argv[i] && (strcmp (argv[i], param) == 0) )
return ! 0;
}
+26 -9
View File
@@ -28,7 +28,8 @@
#include "microhttpd.h"
#include "mhd_str.h"
static int expect_result (int code, const char*expected)
static int
expect_result (int code, const char*expected)
{
const char*const reason = MHD_get_reason_phrase_for (code);
if (MHD_str_equal_caseless_ (reason, expected))
@@ -39,12 +40,16 @@ static int expect_result (int code, const char*expected)
return 1;
}
static int expect_absent (int code)
static int
expect_absent (int code)
{
return expect_result (code, "unknown");
}
static int test_absent_codes (void)
static int
test_absent_codes (void)
{
int errcount = 0;
errcount += expect_absent (0);
@@ -58,7 +63,9 @@ static int test_absent_codes (void)
return errcount;
}
static int test_1xx (void)
static int
test_1xx (void)
{
int errcount = 0;
errcount += expect_result (MHD_HTTP_CONTINUE, "continue");
@@ -68,7 +75,9 @@ static int test_1xx (void)
return errcount;
}
static int test_2xx (void)
static int
test_2xx (void)
{
int errcount = 0;
errcount += expect_result (MHD_HTTP_OK, "ok");
@@ -80,7 +89,9 @@ static int test_2xx (void)
return errcount;
}
static int test_3xx (void)
static int
test_3xx (void)
{
int errcount = 0;
errcount += expect_result (MHD_HTTP_MULTIPLE_CHOICES, "multiple choices");
@@ -91,7 +102,9 @@ static int test_3xx (void)
return errcount;
}
static int test_4xx (void)
static int
test_4xx (void)
{
int errcount = 0;
errcount += expect_result (MHD_HTTP_BAD_REQUEST, "bad request");
@@ -108,7 +121,9 @@ static int test_4xx (void)
return errcount;
}
static int test_5xx (void)
static int
test_5xx (void)
{
int errcount = 0;
errcount += expect_result (MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -123,7 +138,9 @@ static int test_5xx (void)
return errcount;
}
int main (int argc, char *argv[])
int
main (int argc, char *argv[])
{
int errcount = 0;
(void) argc; (void) argv; /* Unused. Silent compiler warning. */

Some files were not shown because too many files have changed in this diff Show More