[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] [PATCH] code style: remove tabs from source code
From: |
Moritz Warning |
Subject: |
[libmicrohttpd] [PATCH] code style: remove tabs from source code |
Date: |
Wed, 24 Jan 2018 14:23:31 +0100 |
Signed-off-by: Moritz Warning <address@hidden>
---
The code contains a lot of lines with spaces mixed with tabs.
This patch replaces all tabs with spaces in order to improve the code style.
---
src/examples/authorization_example.c | 10 +-
src/examples/benchmark.c | 32 +-
src/examples/benchmark_https.c | 28 +-
src/examples/chunked_example.c | 8 +-
src/examples/demo.c | 396 +++----
src/examples/demo_https.c | 398 +++----
src/examples/digest_auth_example.c | 56 +-
src/examples/dual_stack_example.c | 12 +-
src/examples/fileserver_example.c | 14 +-
src/examples/fileserver_example_dirs.c | 74 +-
src/examples/fileserver_example_external_select.c | 16 +-
src/examples/https_fileserver_example.c | 14 +-
src/examples/minimal_example.c | 14 +-
src/examples/msgs_i18n.c | 38 +-
src/examples/post_example.c | 302 ++---
src/examples/querystring_example.c | 2 +-
src/examples/refuse_post_example.c | 8 +-
src/examples/upgrade_example.c | 4 +-
src/include/microhttpd.h | 130 +--
src/include/microhttpd2.h | 198 ++--
src/microhttpd/basicauth.c | 38 +-
src/microhttpd/connection.c | 478 ++++----
src/microhttpd/connection_https.c | 24 +-
src/microhttpd/daemon.c | 1246 ++++++++++-----------
src/microhttpd/digestauth.c | 280 ++---
src/microhttpd/internal.c | 152 +--
src/microhttpd/internal.h | 16 +-
src/microhttpd/md5.c | 36 +-
src/microhttpd/md5.h | 14 +-
src/microhttpd/memorypool.c | 12 +-
src/microhttpd/memorypool.h | 12 +-
src/microhttpd/postprocessor.c | 50 +-
src/microhttpd/response.c | 66 +-
src/microhttpd/test_upgrade.c | 18 +-
src/microhttpd/tsearch.c | 60 +-
src/microhttpd/tsearch.h | 8 +-
src/testcurl/gauger.h | 10 +-
src/testcurl/https/test_empty_response.c | 4 +-
src/testcurl/https/test_https_get.c | 4 +-
src/testcurl/https/test_https_get_select.c | 6 +-
src/testcurl/https/test_https_multi_daemon.c | 6 +-
src/testcurl/https/test_https_session_info.c | 8 +-
src/testcurl/https/test_tls_authentication.c | 4 +-
src/testcurl/https/test_tls_extensions.c | 6 +-
src/testcurl/https/test_tls_options.c | 30 +-
src/testcurl/https/tls_test_common.c | 30 +-
src/testcurl/https/tls_test_common.h | 2 +-
src/testcurl/perf_get.c | 246 ++--
src/testcurl/perf_get_concurrent.c | 42 +-
src/testcurl/test_callback.c | 96 +-
src/testcurl/test_concurrent_stop.c | 8 +-
src/testcurl/test_delete.c | 2 +-
src/testcurl/test_digestauth.c | 30 +-
src/testcurl/test_digestauth_with_arguments.c | 70 +-
src/testcurl/test_get.c | 8 +-
src/testcurl/test_get_response_cleanup.c | 18 +-
src/testcurl/test_get_sendfile.c | 10 +-
src/testcurl/test_iplimit.c | 6 +-
src/testcurl/test_large_put.c | 12 +-
src/testcurl/test_long_header.c | 12 +-
src/testcurl/test_parse_cookies.c | 4 +-
src/testcurl/test_post.c | 48 +-
src/testcurl/test_post_loop.c | 74 +-
src/testcurl/test_postform.c | 26 +-
src/testcurl/test_process_arguments.c | 8 +-
src/testcurl/test_process_headers.c | 4 +-
src/testcurl/test_put.c | 2 +-
src/testcurl/test_put_chunked.c | 4 +-
src/testcurl/test_quiesce.c | 6 +-
src/testcurl/test_termination.c | 2 +-
src/testcurl/test_timeout.c | 36 +-
src/testcurl/test_urlparse.c | 16 +-
src/testzzuf/test_get.c | 4 +-
src/testzzuf/test_long_header.c | 4 +-
src/testzzuf/test_post.c | 22 +-
src/testzzuf/test_post_form.c | 22 +-
src/testzzuf/test_put.c | 4 +-
src/testzzuf/test_put_chunked.c | 4 +-
src/testzzuf/test_put_large.c | 8 +-
79 files changed, 2616 insertions(+), 2616 deletions(-)
diff --git a/src/examples/authorization_example.c
b/src/examples/authorization_example.c
index d8a88203..e6496304 100644
--- a/src/examples/authorization_example.c
+++ b/src/examples/authorization_example.c
@@ -78,15 +78,15 @@ ahc_echo (void *cls,
if (fail)
{
response = MHD_create_response_from_buffer (strlen (DENIED),
- (void *) DENIED,
- MHD_RESPMEM_PERSISTENT);
+ (void *) DENIED,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_basic_auth_fail_response
(connection,"TestRealm",response);
}
else
{
response = MHD_create_response_from_buffer (strlen (me),
- (void *) me,
- MHD_RESPMEM_PERSISTENT);
+ (void *) me,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
}
if (NULL != user)
@@ -109,7 +109,7 @@ main (int argc, char *const *argv)
(UINT16_MAX < port) )
{
fprintf (stderr,
- "%s PORT\n", argv[0]);
+ "%s PORT\n", argv[0]);
return 1;
}
diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c
index 9512b9bf..fc80c4b9 100644
--- a/src/examples/benchmark.c
+++ b/src/examples/benchmark.c
@@ -62,9 +62,9 @@ static struct MHD_Response *response;
*/
static void
completed_callback (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct timeval *tv = *con_cls;
struct timeval tve;
@@ -94,7 +94,7 @@ completed_callback (void *cls,
static void *
uri_logger_cb (void *cls,
- const char *uri)
+ const char *uri)
{
struct timeval *tv = malloc (sizeof (struct timeval));
(void)cls; /* Unused. Silent compiler warning. */
@@ -139,26 +139,26 @@ main (int argc, char *const *argv)
return 1;
}
response = MHD_create_response_from_buffer (strlen (PAGE),
- (void *) PAGE,
- MHD_RESPMEM_PERSISTENT);
+ (void *) PAGE,
+ MHD_RESPMEM_PERSISTENT);
#if 0
(void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONNECTION,
- "close");
+ MHD_HTTP_HEADER_CONNECTION,
+ "close");
#endif
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_SUPPRESS_DATE_NO_CLOCK
#ifdef EPOLL_SUPPORT
- | MHD_USE_EPOLL | MHD_USE_TURBO
+ | MHD_USE_EPOLL | MHD_USE_TURBO
#endif
- ,
+ ,
atoi (argv[1]),
NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
- MHD_OPTION_THREAD_POOL_SIZE, (unsigned int)
NUMBER_OF_THREADS,
- MHD_OPTION_URI_LOG_CALLBACK, &uri_logger_cb, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_callback, NULL,
- MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 1000,
- MHD_OPTION_END);
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
+ MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS,
+ MHD_OPTION_URI_LOG_CALLBACK, &uri_logger_cb, NULL,
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_callback, NULL,
+ MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 1000,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
(void) getc (stdin);
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index 87a79717..dd684bf3 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -62,9 +62,9 @@ static struct MHD_Response *response;
*/
static void
completed_callback (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct timeval *tv = *con_cls;
struct timeval tve;
@@ -94,7 +94,7 @@ completed_callback (void *cls,
static void *
uri_logger_cb (void *cls,
- const char *uri)
+ const char *uri)
{
struct timeval *tv = malloc (sizeof (struct timeval));
(void)cls; /* Unused. Silent compiler warning. */
@@ -190,23 +190,23 @@ main (int argc, char *const *argv)
return 1;
}
response = MHD_create_response_from_buffer (strlen (PAGE),
- (void *) PAGE,
- MHD_RESPMEM_PERSISTENT);
+ (void *) PAGE,
+ MHD_RESPMEM_PERSISTENT);
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS
#ifdef EPOLL_SUPPORT
- | MHD_USE_EPOLL | MHD_USE_TURBO
+ | MHD_USE_EPOLL | MHD_USE_TURBO
#endif
- ,
+ ,
atoi (argv[1]),
NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
- MHD_OPTION_THREAD_POOL_SIZE, (unsigned int)
NUMBER_OF_THREADS,
- MHD_OPTION_URI_LOG_CALLBACK, &uri_logger_cb, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_callback, NULL,
- MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 1000,
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
+ MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS,
+ MHD_OPTION_URI_LOG_CALLBACK, &uri_logger_cb, NULL,
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_callback, NULL,
+ MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 1000,
MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem,
MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem,
- MHD_OPTION_END);
+ MHD_OPTION_END);
if (d == NULL)
return 1;
(void) getc (stdin);
diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c
index 26dacd3b..7bf46801 100644
--- a/src/examples/chunked_example.c
+++ b/src/examples/chunked_example.c
@@ -165,13 +165,13 @@ main (int argc, char *const *argv)
d = MHD_start_daemon (/* MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG, */
MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG,
/* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
| MHD_USE_POLL, */
- /* MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */
- /* MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */
+ /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG | MHD_USE_POLL, */
+ /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG, */
(uint16_t) port,
NULL, NULL,
&ahc_echo, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
- MHD_OPTION_END);
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
+ MHD_OPTION_END);
if (NULL == d)
return 1;
(void) getc (stdin);
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 6c9ad049..80b33030 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -204,8 +204,8 @@ static void
mark_as_html (struct MHD_Response *response)
{
(void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- "text/html");
+ MHD_HTTP_HEADER_CONTENT_TYPE,
+ "text/html");
}
@@ -258,7 +258,7 @@ struct ResponseDataContext
*/
static int
list_directory (struct ResponseDataContext *rdc,
- const char *dirname)
+ const char *dirname)
{
char fullname[PATH_MAX];
struct stat sbuf;
@@ -270,32 +270,32 @@ list_directory (struct ResponseDataContext *rdc,
while (NULL != (de = readdir (dir)))
{
if ('.' == de->d_name[0])
- continue;
+ continue;
if (sizeof (fullname) <= (unsigned int)
- snprintf (fullname, sizeof (fullname),
- "%s/%s",
- dirname, de->d_name))
- continue; /* ugh, file too long? how can this be!? */
+ snprintf (fullname, sizeof (fullname),
+ "%s/%s",
+ dirname, de->d_name))
+ continue; /* ugh, file too long? how can this be!? */
if (0 != stat (fullname, &sbuf))
- continue; /* ugh, failed to 'stat' */
+ continue; /* ugh, failed to 'stat' */
if (! S_ISREG (sbuf.st_mode))
- continue; /* not a regular file, skip */
+ continue; /* not a regular file, skip */
if (rdc->off + 1024 > rdc->buf_len)
- {
- void *r;
-
- if ( (2 * rdc->buf_len + 1024) < rdc->buf_len)
- break; /* more than SIZE_T _index_ size? Too big for us */
- rdc->buf_len = 2 * rdc->buf_len + 1024;
- if (NULL == (r = realloc (rdc->buf, rdc->buf_len)))
- break; /* out of memory */
- rdc->buf = r;
- }
+ {
+ void *r;
+
+ if ( (2 * rdc->buf_len + 1024) < rdc->buf_len)
+ break; /* more than SIZE_T _index_ size? Too big for us */
+ rdc->buf_len = 2 * rdc->buf_len + 1024;
+ if (NULL == (r = realloc (rdc->buf, rdc->buf_len)))
+ break; /* out of memory */
+ rdc->buf = r;
+ }
rdc->off += snprintf (&rdc->buf[rdc->off],
- rdc->buf_len - rdc->off,
- "<li><a href=\"/%s\">%s</a></li>\n",
- fullname,
- de->d_name);
+ rdc->buf_len - rdc->off,
+ "<li><a href=\"/%s\">%s</a></li>\n",
+ fullname,
+ de->d_name);
}
(void) closedir (dir);
return MHD_YES;
@@ -325,60 +325,60 @@ update_directory ()
return;
}
rdc.off = snprintf (rdc.buf, rdc.buf_len,
- "%s",
- INDEX_PAGE_HEADER);
+ "%s",
+ INDEX_PAGE_HEADER);
for (language_idx = 0; NULL != languages[language_idx].dirname;
language_idx++)
{
language = &languages[language_idx];
if (0 != stat (language->dirname, &sbuf))
- continue; /* empty */
+ continue; /* empty */
/* we ensured always +1k room, filenames are ~256 bytes,
- so there is always still enough space for the header
- without need for an additional reallocation check. */
+ so there is always still enough space for the header
+ without need for an additional reallocation check. */
rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
- "<h2>%s</h2>\n",
- language->longname);
+ "<h2>%s</h2>\n",
+ language->longname);
for (category_idx = 0; NULL != categories[category_idx]; category_idx++)
- {
- category = categories[category_idx];
- snprintf (dir_name, sizeof (dir_name),
- "%s/%s",
- language->dirname,
- category);
- if (0 != stat (dir_name, &sbuf))
- continue; /* empty */
-
- /* we ensured always +1k room, filenames are ~256 bytes,
- so there is always still enough space for the header
- without need for an additional reallocation check. */
- rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
- "<h3>%s</h3>\n",
- category);
-
- if (MHD_NO == list_directory (&rdc, dir_name))
- {
- free (rdc.buf);
- update_cached_response (NULL);
- return;
- }
- }
+ {
+ category = categories[category_idx];
+ snprintf (dir_name, sizeof (dir_name),
+ "%s/%s",
+ language->dirname,
+ category);
+ if (0 != stat (dir_name, &sbuf))
+ continue; /* empty */
+
+ /* we ensured always +1k room, filenames are ~256 bytes,
+ so there is always still enough space for the header
+ without need for an additional reallocation check. */
+ rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
+ "<h3>%s</h3>\n",
+ category);
+
+ if (MHD_NO == list_directory (&rdc, dir_name))
+ {
+ free (rdc.buf);
+ update_cached_response (NULL);
+ return;
+ }
+ }
}
/* we ensured always +1k room, filenames are ~256 bytes,
so there is always still enough space for the footer
without need for a final reallocation check. */
rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
- "%s",
- INDEX_PAGE_FOOTER);
+ "%s",
+ INDEX_PAGE_FOOTER);
initial_allocation = rdc.buf_len; /* remember for next time */
response = MHD_create_response_from_buffer (rdc.off,
- rdc.buf,
- MHD_RESPMEM_MUST_FREE);
+ rdc.buf,
+ MHD_RESPMEM_MUST_FREE);
mark_as_html (response);
#if FORCE_CLOSE
(void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONNECTION,
- "close");
+ MHD_HTTP_HEADER_CONNECTION,
+ "close");
#endif
update_cached_response (response);
}
@@ -437,8 +437,8 @@ struct UploadContext
*/
static int
do_append (char **ret,
- const char *data,
- size_t size)
+ const char *data,
+ size_t size)
{
char *buf;
size_t old_len;
@@ -481,14 +481,14 @@ do_append (char **ret,
*/
static int
process_upload_data (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)
+ 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)
{
struct UploadContext *uc = cls;
int i;
@@ -504,8 +504,8 @@ process_upload_data (void *cls,
if (0 != strcmp (key, "upload"))
{
fprintf (stderr,
- "Ignoring unexpected form value `%s'\n",
- key);
+ "Ignoring unexpected form value `%s'\n",
+ key);
return MHD_YES; /* ignore */
}
if (NULL == filename)
@@ -517,8 +517,8 @@ process_upload_data (void *cls,
(NULL == uc->language) )
{
fprintf (stderr,
- "Missing form data for upload `%s'\n",
- filename);
+ "Missing form data for upload `%s'\n",
+ filename);
uc->response = request_refused_response;
return MHD_NO;
}
@@ -527,12 +527,12 @@ process_upload_data (void *cls,
char fn[PATH_MAX];
if ( (NULL != strstr (filename, "..")) ||
- (NULL != strchr (filename, '/')) ||
- (NULL != strchr (filename, '\\')) )
- {
- uc->response = request_refused_response;
- return MHD_NO;
- }
+ (NULL != strchr (filename, '/')) ||
+ (NULL != strchr (filename, '\\')) )
+ {
+ uc->response = request_refused_response;
+ return MHD_NO;
+ }
/* create directories -- if they don't exist already */
#ifdef WINDOWS
(void) mkdir (uc->language);
@@ -540,9 +540,9 @@ process_upload_data (void *cls,
(void) mkdir (uc->language, S_IRWXU);
#endif
snprintf (fn, sizeof (fn),
- "%s/%s",
- uc->language,
- uc->category);
+ "%s/%s",
+ uc->language,
+ uc->category);
#ifdef WINDOWS
(void) mkdir (fn);
#else
@@ -550,29 +550,29 @@ process_upload_data (void *cls,
#endif
/* open file */
snprintf (fn, sizeof (fn),
- "%s/%s/%s",
- uc->language,
- uc->category,
- filename);
+ "%s/%s/%s",
+ uc->language,
+ uc->category,
+ filename);
for (i=strlen (fn)-1;i>=0;i--)
- if (! isprint ((unsigned char) fn[i]))
- fn[i] = '_';
+ if (! isprint ((unsigned char) fn[i]))
+ fn[i] = '_';
uc->fd = open (fn,
- O_CREAT | O_EXCL
+ O_CREAT | O_EXCL
#if O_LARGEFILE
- | O_LARGEFILE
+ | O_LARGEFILE
#endif
- | O_WRONLY,
- S_IRUSR | S_IWUSR);
+ | O_WRONLY,
+ S_IRUSR | S_IWUSR);
if (-1 == uc->fd)
- {
- fprintf (stderr,
- "Error opening file `%s' for upload: %s\n",
- fn,
- strerror (errno));
- uc->response = request_refused_response;
- return MHD_NO;
- }
+ {
+ fprintf (stderr,
+ "Error opening file `%s' for upload: %s\n",
+ fn,
+ strerror (errno));
+ uc->response = request_refused_response;
+ return MHD_NO;
+ }
uc->filename = strdup (fn);
}
if ( (0 != size) &&
@@ -580,18 +580,18 @@ process_upload_data (void *cls,
{
/* write failed; likely: disk full */
fprintf (stderr,
- "Error writing to file `%s': %s\n",
- uc->filename,
- strerror (errno));
+ "Error writing to file `%s': %s\n",
+ uc->filename,
+ strerror (errno));
uc->response = internal_error_response;
(void) close (uc->fd);
uc->fd = -1;
if (NULL != uc->filename)
- {
- unlink (uc->filename);
- free (uc->filename);
- uc->filename = NULL;
- }
+ {
+ unlink (uc->filename);
+ free (uc->filename);
+ uc->filename = NULL;
+ }
return MHD_NO;
}
return MHD_YES;
@@ -611,9 +611,9 @@ process_upload_data (void *cls,
*/
static void
response_completed_callback (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct UploadContext *uc = *con_cls;
(void)cls; /* Unused. Silent compiler warning. */
@@ -632,10 +632,10 @@ response_completed_callback (void *cls,
(void) close (uc->fd);
if (NULL != uc->filename)
{
- fprintf (stderr,
- "Upload of file `%s' failed (incomplete or aborted), removing
file.\n",
- uc->filename);
- (void) unlink (uc->filename);
+ fprintf (stderr,
+ "Upload of file `%s' failed (incomplete or aborted), removing file.\n",
+ uc->filename);
+ (void) unlink (uc->filename);
}
}
if (NULL != uc->filename)
@@ -658,12 +658,12 @@ return_directory_response (struct MHD_Connection
*connection)
(void) pthread_mutex_lock (&mutex);
if (NULL == cached_directory_response)
ret = MHD_queue_response (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- internal_error_response);
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ internal_error_response);
else
ret = MHD_queue_response (connection,
- MHD_HTTP_OK,
- cached_directory_response);
+ MHD_HTTP_OK,
+ cached_directory_response);
(void) pthread_mutex_unlock (&mutex);
return ret;
}
@@ -684,12 +684,12 @@ return_directory_response (struct MHD_Connection
*connection)
*/
static int
generate_page (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 **ptr)
+ struct MHD_Connection *connection,
+ const char *url,
+ const char *method,
+ const char *version,
+ const char *upload_data,
+ size_t *upload_data_size, void **ptr)
{
struct MHD_Response *response;
int ret;
@@ -712,7 +712,7 @@ generate_page (void *cls,
return MHD_NO; /* unexpected method (we're not polite...) */
fd = -1;
if ( (NULL == strstr (&url[1], "..")) &&
- ('/' != url[1]) )
+ ('/' != url[1]) )
{
fd = open (&url[1], O_RDONLY);
if ( (-1 != fd) &&
@@ -724,35 +724,35 @@ generate_page (void *cls,
}
}
if (-1 == fd)
- return MHD_queue_response (connection,
- MHD_HTTP_NOT_FOUND,
- file_not_found_response);
+ return MHD_queue_response (connection,
+ MHD_HTTP_NOT_FOUND,
+ file_not_found_response);
#ifdef MHD_HAVE_LIBMAGIC
/* read beginning of the file to determine mime type */
got = read (fd, file_data, sizeof (file_data));
(void) lseek (fd, 0, SEEK_SET);
if (-1 != got)
- mime = magic_buffer (magic, file_data, got);
+ mime = magic_buffer (magic, file_data, got);
else
#endif /* MHD_HAVE_LIBMAGIC */
- mime = NULL;
+ mime = NULL;
if (NULL == (response = MHD_create_response_from_fd (buf.st_size,
- fd)))
- {
- /* internal error (i.e. out of memory) */
- (void) close (fd);
- return MHD_NO;
- }
+ fd)))
+ {
+ /* internal error (i.e. out of memory) */
+ (void) close (fd);
+ return MHD_NO;
+ }
/* add mime type if we had one */
if (NULL != mime)
- (void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- mime);
+ (void) MHD_add_response_header (response,
+ MHD_HTTP_HEADER_CONTENT_TYPE,
+ mime);
ret = MHD_queue_response (connection,
- MHD_HTTP_OK,
- response);
+ MHD_HTTP_OK,
+ response);
MHD_destroy_response (response);
return ret;
}
@@ -763,52 +763,52 @@ generate_page (void *cls,
struct UploadContext *uc = *ptr;
if (NULL == uc)
- {
- if (NULL == (uc = malloc (sizeof (struct UploadContext))))
- return MHD_NO; /* out of memory, close connection */
- memset (uc, 0, sizeof (struct UploadContext));
+ {
+ if (NULL == (uc = malloc (sizeof (struct UploadContext))))
+ return MHD_NO; /* out of memory, close connection */
+ memset (uc, 0, sizeof (struct UploadContext));
uc->fd = -1;
- uc->connection = connection;
- uc->pp = MHD_create_post_processor (connection,
- 64 * 1024 /* buffer size */,
- &process_upload_data, uc);
- if (NULL == uc->pp)
- {
- /* out of memory, close connection */
- free (uc);
- return MHD_NO;
- }
- *ptr = uc;
- return MHD_YES;
- }
+ uc->connection = connection;
+ uc->pp = MHD_create_post_processor (connection,
+ 64 * 1024 /* buffer size */,
+ &process_upload_data, uc);
+ if (NULL == uc->pp)
+ {
+ /* out of memory, close connection */
+ free (uc);
+ return MHD_NO;
+ }
+ *ptr = uc;
+ return MHD_YES;
+ }
if (0 != *upload_data_size)
- {
- if (NULL == uc->response)
- (void) MHD_post_process (uc->pp,
- upload_data,
- *upload_data_size);
- *upload_data_size = 0;
- return MHD_YES;
- }
+ {
+ if (NULL == uc->response)
+ (void) MHD_post_process (uc->pp,
+ upload_data,
+ *upload_data_size);
+ *upload_data_size = 0;
+ return MHD_YES;
+ }
/* end of upload, finish it! */
MHD_destroy_post_processor (uc->pp);
uc->pp = NULL;
if (-1 != uc->fd)
- {
- close (uc->fd);
- uc->fd = -1;
- }
+ {
+ close (uc->fd);
+ uc->fd = -1;
+ }
if (NULL != uc->response)
- {
- return MHD_queue_response (connection,
- MHD_HTTP_FORBIDDEN,
- uc->response);
- }
+ {
+ return MHD_queue_response (connection,
+ MHD_HTTP_FORBIDDEN,
+ uc->response);
+ }
else
- {
- update_directory ();
- return return_directory_response (connection);
- }
+ {
+ update_directory ();
+ return return_directory_response (connection);
+ }
}
if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
(0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) )
@@ -818,8 +818,8 @@ generate_page (void *cls,
/* unexpected request, refuse */
return MHD_queue_response (connection,
- MHD_HTTP_FORBIDDEN,
- request_refused_response);
+ MHD_HTTP_FORBIDDEN,
+ request_refused_response);
}
@@ -832,7 +832,7 @@ generate_page (void *cls,
static void
catcher (int sig)
{
- (void)sig; /* Unused. Silent compiler warning. */
+ (void)sig; /* Unused. Silent compiler warning. */
/* do nothing */
}
@@ -880,7 +880,7 @@ main (int argc, char *const *argv)
(UINT16_MAX < port) )
{
fprintf (stderr,
- "%s PORT\n", argv[0]);
+ "%s PORT\n", argv[0]);
return 1;
}
#ifndef MINGW
@@ -893,30 +893,30 @@ main (int argc, char *const *argv)
(void) pthread_mutex_init (&mutex, NULL);
file_not_found_response = MHD_create_response_from_buffer (strlen
(FILE_NOT_FOUND_PAGE),
- (void *)
FILE_NOT_FOUND_PAGE,
-
MHD_RESPMEM_PERSISTENT);
+ (void *) FILE_NOT_FOUND_PAGE,
+ MHD_RESPMEM_PERSISTENT);
mark_as_html (file_not_found_response);
request_refused_response = MHD_create_response_from_buffer (strlen
(REQUEST_REFUSED_PAGE),
- (void *)
REQUEST_REFUSED_PAGE,
-
MHD_RESPMEM_PERSISTENT);
+ (void *) REQUEST_REFUSED_PAGE,
+ MHD_RESPMEM_PERSISTENT);
mark_as_html (request_refused_response);
internal_error_response = MHD_create_response_from_buffer (strlen
(INTERNAL_ERROR_PAGE),
- (void *)
INTERNAL_ERROR_PAGE,
-
MHD_RESPMEM_PERSISTENT);
+ (void *) INTERNAL_ERROR_PAGE,
+ MHD_RESPMEM_PERSISTENT);
mark_as_html (internal_error_response);
update_directory ();
d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG,
port,
NULL, NULL,
- &generate_page, NULL,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 *
1024),
+ &generate_page, NULL,
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 * 1024),
#if PRODUCTION
- MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64),
+ MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64),
#endif
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /*
seconds */),
- MHD_OPTION_THREAD_POOL_SIZE, (unsigned int)
NUMBER_OF_THREADS,
- MHD_OPTION_NOTIFY_COMPLETED,
&response_completed_callback, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /* seconds */),
+ MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS,
+ MHD_OPTION_NOTIFY_COMPLETED, &response_completed_callback, NULL,
+ MHD_OPTION_END);
if (NULL == d)
return 1;
fprintf (stderr, "HTTP server running. Press ENTER to stop the server\n");
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 806464a2..46cd2d0e 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -205,8 +205,8 @@ static void
mark_as_html (struct MHD_Response *response)
{
(void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- "text/html");
+ MHD_HTTP_HEADER_CONTENT_TYPE,
+ "text/html");
}
@@ -259,7 +259,7 @@ struct ResponseDataContext
*/
static int
list_directory (struct ResponseDataContext *rdc,
- const char *dirname)
+ const char *dirname)
{
char fullname[PATH_MAX];
struct stat sbuf;
@@ -271,32 +271,32 @@ list_directory (struct ResponseDataContext *rdc,
while (NULL != (de = readdir (dir)))
{
if ('.' == de->d_name[0])
- continue;
+ continue;
if (sizeof (fullname) <= (size_t)
- snprintf (fullname, sizeof (fullname),
- "%s/%s",
- dirname, de->d_name))
- continue; /* ugh, file too long? how can this be!? */
+ snprintf (fullname, sizeof (fullname),
+ "%s/%s",
+ dirname, de->d_name))
+ continue; /* ugh, file too long? how can this be!? */
if (0 != stat (fullname, &sbuf))
- continue; /* ugh, failed to 'stat' */
+ continue; /* ugh, failed to 'stat' */
if (! S_ISREG (sbuf.st_mode))
- continue; /* not a regular file, skip */
+ continue; /* not a regular file, skip */
if (rdc->off + 1024 > rdc->buf_len)
- {
- void *r;
-
- if ( (2 * rdc->buf_len + 1024) < rdc->buf_len)
- break; /* more than SIZE_T _index_ size? Too big for us */
- rdc->buf_len = 2 * rdc->buf_len + 1024;
- if (NULL == (r = realloc (rdc->buf, rdc->buf_len)))
- break; /* out of memory */
- rdc->buf = r;
- }
+ {
+ void *r;
+
+ if ( (2 * rdc->buf_len + 1024) < rdc->buf_len)
+ break; /* more than SIZE_T _index_ size? Too big for us */
+ rdc->buf_len = 2 * rdc->buf_len + 1024;
+ if (NULL == (r = realloc (rdc->buf, rdc->buf_len)))
+ break; /* out of memory */
+ rdc->buf = r;
+ }
rdc->off += snprintf (&rdc->buf[rdc->off],
- rdc->buf_len - rdc->off,
- "<li><a href=\"/%s\">%s</a></li>\n",
- fullname,
- de->d_name);
+ rdc->buf_len - rdc->off,
+ "<li><a href=\"/%s\">%s</a></li>\n",
+ fullname,
+ de->d_name);
}
(void) closedir (dir);
return MHD_YES;
@@ -326,60 +326,60 @@ update_directory ()
return;
}
rdc.off = snprintf (rdc.buf, rdc.buf_len,
- "%s",
- INDEX_PAGE_HEADER);
+ "%s",
+ INDEX_PAGE_HEADER);
for (language_idx = 0; NULL != languages[language_idx].dirname;
language_idx++)
{
language = &languages[language_idx];
if (0 != stat (language->dirname, &sbuf))
- continue; /* empty */
+ continue; /* empty */
/* we ensured always +1k room, filenames are ~256 bytes,
- so there is always still enough space for the header
- without need for an additional reallocation check. */
+ so there is always still enough space for the header
+ without need for an additional reallocation check. */
rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
- "<h2>%s</h2>\n",
- language->longname);
+ "<h2>%s</h2>\n",
+ language->longname);
for (category_idx = 0; NULL != categories[category_idx]; category_idx++)
- {
- category = categories[category_idx];
- snprintf (dir_name, sizeof (dir_name),
- "%s/%s",
- language->dirname,
- category);
- if (0 != stat (dir_name, &sbuf))
- continue; /* empty */
-
- /* we ensured always +1k room, filenames are ~256 bytes,
- so there is always still enough space for the header
- without need for an additional reallocation check. */
- rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
- "<h3>%s</h3>\n",
- category);
-
- if (MHD_NO == list_directory (&rdc, dir_name))
- {
- free (rdc.buf);
- update_cached_response (NULL);
- return;
- }
- }
+ {
+ category = categories[category_idx];
+ snprintf (dir_name, sizeof (dir_name),
+ "%s/%s",
+ language->dirname,
+ category);
+ if (0 != stat (dir_name, &sbuf))
+ continue; /* empty */
+
+ /* we ensured always +1k room, filenames are ~256 bytes,
+ so there is always still enough space for the header
+ without need for an additional reallocation check. */
+ rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
+ "<h3>%s</h3>\n",
+ category);
+
+ if (MHD_NO == list_directory (&rdc, dir_name))
+ {
+ free (rdc.buf);
+ update_cached_response (NULL);
+ return;
+ }
+ }
}
/* we ensured always +1k room, filenames are ~256 bytes,
so there is always still enough space for the footer
without need for a final reallocation check. */
rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off,
- "%s",
- INDEX_PAGE_FOOTER);
+ "%s",
+ INDEX_PAGE_FOOTER);
initial_allocation = rdc.buf_len; /* remember for next time */
response = MHD_create_response_from_buffer (rdc.off,
- rdc.buf,
- MHD_RESPMEM_MUST_FREE);
+ rdc.buf,
+ MHD_RESPMEM_MUST_FREE);
mark_as_html (response);
#if FORCE_CLOSE
(void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONNECTION,
- "close");
+ MHD_HTTP_HEADER_CONNECTION,
+ "close");
#endif
update_cached_response (response);
}
@@ -438,8 +438,8 @@ struct UploadContext
*/
static int
do_append (char **ret,
- const char *data,
- size_t size)
+ const char *data,
+ size_t size)
{
char *buf;
size_t old_len;
@@ -482,14 +482,14 @@ do_append (char **ret,
*/
static int
process_upload_data (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)
+ 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)
{
struct UploadContext *uc = cls;
int i;
@@ -505,8 +505,8 @@ process_upload_data (void *cls,
if (0 != strcmp (key, "upload"))
{
fprintf (stderr,
- "Ignoring unexpected form value `%s'\n",
- key);
+ "Ignoring unexpected form value `%s'\n",
+ key);
return MHD_YES; /* ignore */
}
if (NULL == filename)
@@ -518,8 +518,8 @@ process_upload_data (void *cls,
(NULL == uc->language) )
{
fprintf (stderr,
- "Missing form data for upload `%s'\n",
- filename);
+ "Missing form data for upload `%s'\n",
+ filename);
uc->response = request_refused_response;
return MHD_NO;
}
@@ -528,12 +528,12 @@ process_upload_data (void *cls,
char fn[PATH_MAX];
if ( (NULL != strstr (filename, "..")) ||
- (NULL != strchr (filename, '/')) ||
- (NULL != strchr (filename, '\\')) )
- {
- uc->response = request_refused_response;
- return MHD_NO;
- }
+ (NULL != strchr (filename, '/')) ||
+ (NULL != strchr (filename, '\\')) )
+ {
+ uc->response = request_refused_response;
+ return MHD_NO;
+ }
/* create directories -- if they don't exist already */
#ifdef WINDOWS
(void) mkdir (uc->language);
@@ -541,9 +541,9 @@ process_upload_data (void *cls,
(void) mkdir (uc->language, S_IRWXU);
#endif
snprintf (fn, sizeof (fn),
- "%s/%s",
- uc->language,
- uc->category);
+ "%s/%s",
+ uc->language,
+ uc->category);
#ifdef WINDOWS
(void) mkdir (fn);
#else
@@ -551,29 +551,29 @@ process_upload_data (void *cls,
#endif
/* open file */
snprintf (fn, sizeof (fn),
- "%s/%s/%s",
- uc->language,
- uc->category,
- filename);
+ "%s/%s/%s",
+ uc->language,
+ uc->category,
+ filename);
for (i=strlen (fn)-1;i>=0;i--)
- if (! isprint ((int) fn[i]))
- fn[i] = '_';
+ if (! isprint ((int) fn[i]))
+ fn[i] = '_';
uc->fd = open (fn,
- O_CREAT | O_EXCL
+ O_CREAT | O_EXCL
#if O_LARGEFILE
- | O_LARGEFILE
+ | O_LARGEFILE
#endif
- | O_WRONLY,
- S_IRUSR | S_IWUSR);
+ | O_WRONLY,
+ S_IRUSR | S_IWUSR);
if (-1 == uc->fd)
- {
- fprintf (stderr,
- "Error opening file `%s' for upload: %s\n",
- fn,
- strerror (errno));
- uc->response = request_refused_response;
- return MHD_NO;
- }
+ {
+ fprintf (stderr,
+ "Error opening file `%s' for upload: %s\n",
+ fn,
+ strerror (errno));
+ uc->response = request_refused_response;
+ return MHD_NO;
+ }
uc->filename = strdup (fn);
}
if ( (0 != size) &&
@@ -581,18 +581,18 @@ process_upload_data (void *cls,
{
/* write failed; likely: disk full */
fprintf (stderr,
- "Error writing to file `%s': %s\n",
- uc->filename,
- strerror (errno));
+ "Error writing to file `%s': %s\n",
+ uc->filename,
+ strerror (errno));
uc->response = internal_error_response;
close (uc->fd);
uc->fd = -1;
if (NULL != uc->filename)
- {
- unlink (uc->filename);
- free (uc->filename);
- uc->filename = NULL;
- }
+ {
+ unlink (uc->filename);
+ free (uc->filename);
+ uc->filename = NULL;
+ }
return MHD_NO;
}
return MHD_YES;
@@ -612,9 +612,9 @@ process_upload_data (void *cls,
*/
static void
response_completed_callback (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct UploadContext *uc = *con_cls;
(void)cls; /* Unused. Silent compiler warning. */
@@ -633,10 +633,10 @@ response_completed_callback (void *cls,
(void) close (uc->fd);
if (NULL != uc->filename)
{
- fprintf (stderr,
- "Upload of file `%s' failed (incomplete or aborted), removing
file.\n",
- uc->filename);
- (void) unlink (uc->filename);
+ fprintf (stderr,
+ "Upload of file `%s' failed (incomplete or aborted), removing file.\n",
+ uc->filename);
+ (void) unlink (uc->filename);
}
}
if (NULL != uc->filename)
@@ -659,12 +659,12 @@ return_directory_response (struct MHD_Connection
*connection)
(void) pthread_mutex_lock (&mutex);
if (NULL == cached_directory_response)
ret = MHD_queue_response (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- internal_error_response);
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ internal_error_response);
else
ret = MHD_queue_response (connection,
- MHD_HTTP_OK,
- cached_directory_response);
+ MHD_HTTP_OK,
+ cached_directory_response);
(void) pthread_mutex_unlock (&mutex);
return ret;
}
@@ -685,12 +685,12 @@ return_directory_response (struct MHD_Connection
*connection)
*/
static int
generate_page (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 **ptr)
+ struct MHD_Connection *connection,
+ const char *url,
+ const char *method,
+ const char *version,
+ const char *upload_data,
+ size_t *upload_data_size, void **ptr)
{
struct MHD_Response *response;
int ret;
@@ -709,10 +709,10 @@ generate_page (void *cls,
const char *mime;
if (0 != strcmp (method, MHD_HTTP_METHOD_GET))
- return MHD_NO; /* unexpected method (we're not polite...) */
+ return MHD_NO; /* unexpected method (we're not polite...) */
fd = -1;
if ( (NULL == strstr (&url[1], "..")) &&
- ('/' != url[1]) )
+ ('/' != url[1]) )
{
fd = open (&url[1], O_RDONLY);
if ( (-1 != fd) &&
@@ -724,35 +724,35 @@ generate_page (void *cls,
}
}
if (-1 == fd)
- return MHD_queue_response (connection,
- MHD_HTTP_NOT_FOUND,
- file_not_found_response);
+ return MHD_queue_response (connection,
+ MHD_HTTP_NOT_FOUND,
+ file_not_found_response);
#ifdef MHD_HAVE_LIBMAGIC
/* read beginning of the file to determine mime type */
got = read (fd, file_data, sizeof (file_data));
(void) lseek (fd, 0, SEEK_SET);
if (-1 != got)
- mime = magic_buffer (magic, file_data, got);
+ mime = magic_buffer (magic, file_data, got);
else
#endif /* MHD_HAVE_LIBMAGIC */
- mime = NULL;
+ mime = NULL;
if (NULL == (response = MHD_create_response_from_fd (buf.st_size,
- fd)))
- {
- /* internal error (i.e. out of memory) */
- (void) close (fd);
- return MHD_NO;
- }
+ fd)))
+ {
+ /* internal error (i.e. out of memory) */
+ (void) close (fd);
+ return MHD_NO;
+ }
/* add mime type if we had one */
if (NULL != mime)
- (void) MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- mime);
+ (void) MHD_add_response_header (response,
+ MHD_HTTP_HEADER_CONTENT_TYPE,
+ mime);
ret = MHD_queue_response (connection,
- MHD_HTTP_OK,
- response);
+ MHD_HTTP_OK,
+ response);
MHD_destroy_response (response);
return ret;
}
@@ -763,52 +763,52 @@ generate_page (void *cls,
struct UploadContext *uc = *ptr;
if (NULL == uc)
- {
- if (NULL == (uc = malloc (sizeof (struct UploadContext))))
- return MHD_NO; /* out of memory, close connection */
- memset (uc, 0, sizeof (struct UploadContext));
+ {
+ if (NULL == (uc = malloc (sizeof (struct UploadContext))))
+ return MHD_NO; /* out of memory, close connection */
+ memset (uc, 0, sizeof (struct UploadContext));
uc->fd = -1;
- uc->connection = connection;
- uc->pp = MHD_create_post_processor (connection,
- 64 * 1024 /* buffer size */,
- &process_upload_data, uc);
- if (NULL == uc->pp)
- {
- /* out of memory, close connection */
- free (uc);
- return MHD_NO;
- }
- *ptr = uc;
- return MHD_YES;
- }
+ uc->connection = connection;
+ uc->pp = MHD_create_post_processor (connection,
+ 64 * 1024 /* buffer size */,
+ &process_upload_data, uc);
+ if (NULL == uc->pp)
+ {
+ /* out of memory, close connection */
+ free (uc);
+ return MHD_NO;
+ }
+ *ptr = uc;
+ return MHD_YES;
+ }
if (0 != *upload_data_size)
- {
- if (NULL == uc->response)
- (void) MHD_post_process (uc->pp,
- upload_data,
- *upload_data_size);
- *upload_data_size = 0;
- return MHD_YES;
- }
+ {
+ if (NULL == uc->response)
+ (void) MHD_post_process (uc->pp,
+ upload_data,
+ *upload_data_size);
+ *upload_data_size = 0;
+ return MHD_YES;
+ }
/* end of upload, finish it! */
MHD_destroy_post_processor (uc->pp);
uc->pp = NULL;
if (-1 != uc->fd)
- {
- close (uc->fd);
- uc->fd = -1;
- }
+ {
+ close (uc->fd);
+ uc->fd = -1;
+ }
if (NULL != uc->response)
- {
- return MHD_queue_response (connection,
- MHD_HTTP_FORBIDDEN,
- uc->response);
- }
+ {
+ return MHD_queue_response (connection,
+ MHD_HTTP_FORBIDDEN,
+ uc->response);
+ }
else
- {
- update_directory ();
- return return_directory_response (connection);
- }
+ {
+ update_directory ();
+ return return_directory_response (connection);
+ }
}
if (0 == strcmp (method, MHD_HTTP_METHOD_GET))
{
@@ -817,8 +817,8 @@ generate_page (void *cls,
/* unexpected request, refuse */
return MHD_queue_response (connection,
- MHD_HTTP_FORBIDDEN,
- request_refused_response);
+ MHD_HTTP_FORBIDDEN,
+ request_refused_response);
}
@@ -831,7 +831,7 @@ generate_page (void *cls,
static void
catcher (int sig)
{
- (void)sig; /* Unused. Silent compiler warning. */
+ (void)sig; /* Unused. Silent compiler warning. */
/* do nothing */
}
@@ -929,7 +929,7 @@ main (int argc, char *const *argv)
(UINT16_MAX < port) )
{
fprintf (stderr,
- "%s PORT\n", argv[0]);
+ "%s PORT\n", argv[0]);
return 1;
}
#ifndef MINGW
@@ -942,32 +942,32 @@ main (int argc, char *const *argv)
(void) pthread_mutex_init (&mutex, NULL);
file_not_found_response = MHD_create_response_from_buffer (strlen
(FILE_NOT_FOUND_PAGE),
- (void *)
FILE_NOT_FOUND_PAGE,
-
MHD_RESPMEM_PERSISTENT);
+ (void *) FILE_NOT_FOUND_PAGE,
+ MHD_RESPMEM_PERSISTENT);
mark_as_html (file_not_found_response);
request_refused_response = MHD_create_response_from_buffer (strlen
(REQUEST_REFUSED_PAGE),
- (void *)
REQUEST_REFUSED_PAGE,
-
MHD_RESPMEM_PERSISTENT);
+ (void *) REQUEST_REFUSED_PAGE,
+ MHD_RESPMEM_PERSISTENT);
mark_as_html (request_refused_response);
internal_error_response = MHD_create_response_from_buffer (strlen
(INTERNAL_ERROR_PAGE),
- (void *)
INTERNAL_ERROR_PAGE,
-
MHD_RESPMEM_PERSISTENT);
+ (void *) INTERNAL_ERROR_PAGE,
+ MHD_RESPMEM_PERSISTENT);
mark_as_html (internal_error_response);
update_directory ();
d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG | MHD_USE_TLS,
port,
NULL, NULL,
- &generate_page, NULL,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 *
1024),
+ &generate_page, NULL,
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 * 1024),
#if PRODUCTION
- MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64),
+ MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64),
#endif
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /*
seconds */),
- MHD_OPTION_THREAD_POOL_SIZE, (unsigned int)
NUMBER_OF_THREADS,
- MHD_OPTION_NOTIFY_COMPLETED,
&response_completed_callback, NULL,
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /* seconds */),
+ MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS,
+ MHD_OPTION_NOTIFY_COMPLETED, &response_completed_callback, NULL,
MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem,
MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem,
- MHD_OPTION_END);
+ MHD_OPTION_END);
if (NULL == d)
return 1;
fprintf (stderr, "HTTP server running. Press ENTER to stop the server\n");
diff --git a/src/examples/digest_auth_example.c
b/src/examples/digest_auth_example.c
index 889967fb..42dc66ae 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -57,37 +57,37 @@ ahc_echo (void *cls,
if (NULL == username)
{
response = MHD_create_response_from_buffer(strlen (DENIED),
- DENIED,
- MHD_RESPMEM_PERSISTENT);
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_auth_fail_response(connection, realm,
- MY_OPAQUE_STR,
- response,
- MHD_NO);
+ MY_OPAQUE_STR,
+ response,
+ MHD_NO);
MHD_destroy_response(response);
return ret;
}
ret = MHD_digest_auth_check(connection, realm,
- username,
- password,
- 300);
+ username,
+ password,
+ 300);
MHD_free (username);
if ( (ret == MHD_INVALID_NONCE) ||
(ret == MHD_NO) )
{
response = MHD_create_response_from_buffer(strlen (DENIED),
- DENIED,
- MHD_RESPMEM_PERSISTENT);
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
- return MHD_NO;
+ return MHD_NO;
ret = MHD_queue_auth_fail_response(connection, realm,
- MY_OPAQUE_STR,
- response,
- (ret == MHD_INVALID_NONCE) ? MHD_YES :
MHD_NO);
+ MY_OPAQUE_STR,
+ response,
+ (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO);
MHD_destroy_response(response);
return ret;
}
response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
- MHD_RESPMEM_PERSISTENT);
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
return ret;
@@ -112,8 +112,8 @@ main (int argc, char *const *argv)
if (-1 == fd)
{
fprintf (stderr, "Failed to open `%s': %s\n",
- "/dev/urandom",
- strerror (errno));
+ "/dev/urandom",
+ strerror (errno));
return 1;
}
off = 0;
@@ -121,23 +121,23 @@ main (int argc, char *const *argv)
{
len = read(fd, rnd, 8);
if (len == -1)
- {
- fprintf (stderr, "Failed to read `%s': %s\n",
- "/dev/urandom",
- strerror (errno));
- (void) close (fd);
- return 1;
- }
+ {
+ fprintf (stderr, "Failed to read `%s': %s\n",
+ "/dev/urandom",
+ strerror (errno));
+ (void) close (fd);
+ return 1;
+ }
off += len;
}
(void) close(fd);
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
atoi (argv[1]),
NULL, NULL, &ahc_echo, PAGE,
- MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof(rnd), rnd,
- MHD_OPTION_NONCE_NC_SIZE, 300,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
- MHD_OPTION_END);
+ MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof(rnd), rnd,
+ MHD_OPTION_NONCE_NC_SIZE, 300,
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
(void) getc (stdin);
diff --git a/src/examples/dual_stack_example.c
b/src/examples/dual_stack_example.c
index 31b25438..ba326dde 100644
--- a/src/examples/dual_stack_example.c
+++ b/src/examples/dual_stack_example.c
@@ -54,8 +54,8 @@ ahc_echo (void *cls,
}
*ptr = NULL; /* reset when done */
response = MHD_create_response_from_buffer (strlen (me),
- (void *) me,
- MHD_RESPMEM_PERSISTENT);
+ (void *) me,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -73,10 +73,10 @@ main (int argc, char *const *argv)
return 1;
}
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG |
MHD_USE_DUAL_STACK,
- atoi (argv[1]),
- NULL, NULL, &ahc_echo, PAGE,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
- MHD_OPTION_END);
+ atoi (argv[1]),
+ NULL, NULL, &ahc_echo, PAGE,
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
+ MHD_OPTION_END);
(void) getc (stdin);
MHD_stop_daemon (d);
return 0;
diff --git a/src/examples/fileserver_example.c
b/src/examples/fileserver_example.c
index b8935fa1..f8bf5126 100644
--- a/src/examples/fileserver_example.c
+++ b/src/examples/fileserver_example.c
@@ -47,7 +47,7 @@ ahc_echo (void *cls,
const char *method,
const char *version,
const char *upload_data,
- size_t *upload_data_size, void **ptr)
+ size_t *upload_data_size, void **ptr)
{
static int aptr;
struct MHD_Response *response;
@@ -91,8 +91,8 @@ ahc_echo (void *cls,
if (-1 == fd)
{
response = MHD_create_response_from_buffer (strlen (PAGE),
- (void *) PAGE,
- MHD_RESPMEM_PERSISTENT);
+ (void *) PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
MHD_destroy_response (response);
}
@@ -100,11 +100,11 @@ ahc_echo (void *cls,
{
response = MHD_create_response_from_fd64 (buf.st_size, fd);
if (NULL == response)
- {
- if (0 != close (fd))
+ {
+ if (0 != close (fd))
abort ();
- return MHD_NO;
- }
+ return MHD_NO;
+ }
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
}
diff --git a/src/examples/fileserver_example_dirs.c
b/src/examples/fileserver_example_dirs.c
index 8c37f219..37829380 100644
--- a/src/examples/fileserver_example_dirs.c
+++ b/src/examples/fileserver_example_dirs.c
@@ -74,9 +74,9 @@ dir_reader (void *cls, uint64_t pos, char *buf, size_t max)
return MHD_CONTENT_READER_END_OF_STREAM;
} while (e->d_name[0] == '.');
return snprintf (buf, max,
- "<a href=\"/%s\">%s</a><br>",
- e->d_name,
- e->d_name);
+ "<a href=\"/%s\">%s</a><br>",
+ e->d_name,
+ e->d_name);
}
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
const char *method,
const char *version,
const char *upload_data,
- size_t *upload_data_size, void **ptr)
+ size_t *upload_data_size, void **ptr)
{
static int aptr;
struct MHD_Response *response;
@@ -134,38 +134,38 @@ ahc_echo (void *cls,
{
dir = opendir (".");
if (NULL == dir)
- {
- /* most likely cause: more concurrent requests than
- available file descriptors / 2 */
- snprintf (emsg,
- sizeof (emsg),
- "Failed to open directory `.': %s\n",
- strerror (errno));
- response = MHD_create_response_from_buffer (strlen (emsg),
- emsg,
- MHD_RESPMEM_MUST_COPY);
- if (NULL == response)
- return MHD_NO;
- ret = MHD_queue_response (connection,
+ {
+ /* most likely cause: more concurrent requests than
+ available file descriptors / 2 */
+ snprintf (emsg,
+ sizeof (emsg),
+ "Failed to open directory `.': %s\n",
+ strerror (errno));
+ response = MHD_create_response_from_buffer (strlen (emsg),
+ emsg,
+ MHD_RESPMEM_MUST_COPY);
+ if (NULL == response)
+ return MHD_NO;
+ ret = MHD_queue_response (connection,
MHD_HTTP_SERVICE_UNAVAILABLE,
response);
- MHD_destroy_response (response);
- }
+ MHD_destroy_response (response);
+ }
else
- {
- response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN,
- 32 * 1024,
- &dir_reader,
- dir,
- &dir_free_callback);
- if (NULL == response)
- {
- closedir (dir);
- return MHD_NO;
- }
- ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
- MHD_destroy_response (response);
- }
+ {
+ response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN,
+ 32 * 1024,
+ &dir_reader,
+ dir,
+ &dir_free_callback);
+ if (NULL == response)
+ {
+ closedir (dir);
+ return MHD_NO;
+ }
+ ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
+ MHD_destroy_response (response);
+ }
}
else
{
@@ -174,10 +174,10 @@ ahc_echo (void *cls,
file,
&file_free_callback);
if (NULL == response)
- {
- fclose (file);
- return MHD_NO;
- }
+ {
+ fclose (file);
+ return MHD_NO;
+ }
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
}
diff --git a/src/examples/fileserver_example_external_select.c
b/src/examples/fileserver_example_external_select.c
index 6aea6dbf..4fad9050 100644
--- a/src/examples/fileserver_example_external_select.c
+++ b/src/examples/fileserver_example_external_select.c
@@ -54,7 +54,7 @@ ahc_echo (void *cls,
const char *method,
const char *version,
const char *upload_data,
- size_t *upload_data_size, void **ptr)
+ size_t *upload_data_size, void **ptr)
{
static int aptr;
struct MHD_Response *response;
@@ -98,8 +98,8 @@ ahc_echo (void *cls,
if (NULL == file)
{
response = MHD_create_response_from_buffer (strlen (PAGE),
- (void *) PAGE,
- MHD_RESPMEM_PERSISTENT);
+ (void *) PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
MHD_destroy_response (response);
}
@@ -110,10 +110,10 @@ ahc_echo (void *cls,
file,
&free_callback);
if (NULL == response)
- {
- fclose (file);
- return MHD_NO;
- }
+ {
+ fclose (file);
+ return MHD_NO;
+ }
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
}
@@ -154,7 +154,7 @@ main (int argc, char *const *argv)
FD_ZERO (&ws);
FD_ZERO (&es);
if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
- break; /* fatal internal error */
+ break; /* fatal internal error */
if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
{
if (((MHD_UNSIGNED_LONG_LONG)tv.tv_sec) < mhd_timeout / 1000LL)
diff --git a/src/examples/https_fileserver_example.c
b/src/examples/https_fileserver_example.c
index e48a1502..3d4f9990 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -117,7 +117,7 @@ http_ahc (void *cls,
const char *method,
const char *version,
const char *upload_data,
- size_t *upload_data_size, void **ptr)
+ size_t *upload_data_size, void **ptr)
{
static int aptr;
struct MHD_Response *response;
@@ -161,8 +161,8 @@ http_ahc (void *cls,
if (NULL == file)
{
response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE),
- (void *) EMPTY_PAGE,
- MHD_RESPMEM_PERSISTENT);
+ (void *) EMPTY_PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
MHD_destroy_response (response);
}
@@ -172,10 +172,10 @@ http_ahc (void *cls,
&file_reader, file,
&file_free_callback);
if (NULL == response)
- {
- fclose (file);
- return MHD_NO;
- }
+ {
+ fclose (file);
+ return MHD_NO;
+ }
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
}
diff --git a/src/examples/minimal_example.c b/src/examples/minimal_example.c
index 4cf6401a..0beeb5d5 100644
--- a/src/examples/minimal_example.c
+++ b/src/examples/minimal_example.c
@@ -54,8 +54,8 @@ ahc_echo (void *cls,
}
*ptr = NULL; /* reset when done */
response = MHD_create_response_from_buffer (strlen (me),
- (void *) me,
- MHD_RESPMEM_PERSISTENT);
+ (void *) me,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -74,13 +74,13 @@ main (int argc, char *const *argv)
d = MHD_start_daemon (/* MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG, */
MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG,
/* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
| MHD_USE_POLL, */
- /* MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */
- /* MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */
+ /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG | MHD_USE_POLL, */
+ /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD |
MHD_USE_ERROR_LOG, */
atoi (argv[1]),
NULL, NULL, &ahc_echo, PAGE,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
- MHD_OPTION_STRICT_FOR_CLIENT, (int) 1,
- MHD_OPTION_END);
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
+ MHD_OPTION_STRICT_FOR_CLIENT, (int) 1,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
(void) getc (stdin);
diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c
index 2d8eb566..35c22acf 100755
--- a/src/examples/msgs_i18n.c
+++ b/src/examples/msgs_i18n.c
@@ -45,13 +45,13 @@
static int
ahc_echo (void *cls,
- struct MHD_Connection *cnc,
- const char *url,
- const char *mt,
- const char *ver,
- const char *upd,
- size_t *upsz,
- void **ptr)
+ struct MHD_Connection *cnc,
+ const char *url,
+ const char *mt,
+ const char *ver,
+ const char *upd,
+ size_t *upsz,
+ void **ptr)
{
return MHD_NO;
}
@@ -59,15 +59,15 @@ ahc_echo (void *cls,
static void
error_handler (void *cls,
- const char *fm,
- va_list ap)
+ const char *fm,
+ va_list ap)
{
/* Here we do the translation using GNU gettext.
As the error message is from libmicrohttpd, we specify
"libmicrohttpd" as the translation domain here. */
vprintf (dgettext ("libmicrohttpd",
- fm),
- ap);
+ fm),
+ ap);
}
@@ -82,14 +82,14 @@ main (int argc,
needs to be adapted to match
where the MHD PO files are installed. */
bindtextdomain ("libmicrohttpd",
- "locale");
+ "locale");
MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_FEATURE_MESSAGES |
MHD_USE_ERROR_LOG,
- 8080,
- NULL, NULL,
- &ahc_echo, NULL,
- MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL,
- 99999 /* invalid option, to raise the error
- "Invalid option ..." which we are going
- to translate */);
+ 8080,
+ NULL, NULL,
+ &ahc_echo, NULL,
+ MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL,
+ 99999 /* invalid option, to raise the error
+ "Invalid option ..." which we are going
+ to translate */);
return 1; /* This program won't "succeed"... */
}
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 6c9a3f4b..6f5de41a 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -150,23 +150,23 @@ get_session (struct MHD_Connection *connection)
const char *cookie;
cookie = MHD_lookup_connection_value (connection,
- MHD_COOKIE_KIND,
- COOKIE_NAME);
+ MHD_COOKIE_KIND,
+ COOKIE_NAME);
if (cookie != NULL)
{
/* find existing session */
ret = sessions;
while (NULL != ret)
- {
- if (0 == strcmp (cookie, ret->sid))
- break;
- ret = ret->next;
- }
+ {
+ if (0 == strcmp (cookie, ret->sid))
+ break;
+ ret = ret->next;
+ }
if (NULL != ret)
- {
- ret->rc++;
- return ret;
- }
+ {
+ ret->rc++;
+ return ret;
+ }
}
/* create fresh session */
ret = calloc (1, sizeof (struct Session));
@@ -178,12 +178,12 @@ get_session (struct MHD_Connection *connection)
/* not a super-secure way to generate a random session ID,
but should do for a simple example... */
snprintf (ret->sid,
- sizeof (ret->sid),
- "%X%X%X%X",
- (unsigned int) rand (),
- (unsigned int) rand (),
- (unsigned int) rand (),
- (unsigned int) rand ());
+ sizeof (ret->sid),
+ "%X%X%X%X",
+ (unsigned int) rand (),
+ (unsigned int) rand (),
+ (unsigned int) rand (),
+ (unsigned int) rand ());
ret->rc++;
ret->start = time (NULL);
ret->next = sessions;
@@ -202,9 +202,9 @@ get_session (struct MHD_Connection *connection)
* @param MHD_YES on success, MHD_NO on failure
*/
typedef int (*PageHandler)(const void *cls,
- const char *mime,
- struct Session *session,
- struct MHD_Connection *connection);
+ const char *mime,
+ struct Session *session,
+ struct MHD_Connection *connection);
/**
@@ -242,21 +242,21 @@ struct Page
*/
static void
add_session_cookie (struct Session *session,
- struct MHD_Response *response)
+ struct MHD_Response *response)
{
char cstr[256];
snprintf (cstr,
- sizeof (cstr),
- "%s=%s",
- COOKIE_NAME,
- session->sid);
+ sizeof (cstr),
+ "%s=%s",
+ COOKIE_NAME,
+ session->sid);
if (MHD_NO ==
MHD_add_response_header (response,
- MHD_HTTP_HEADER_SET_COOKIE,
- cstr))
+ MHD_HTTP_HEADER_SET_COOKIE,
+ cstr))
{
fprintf (stderr,
- "Failed to set session cookie header!\n");
+ "Failed to set session cookie header!\n");
}
}
@@ -272,9 +272,9 @@ add_session_cookie (struct Session *session,
*/
static int
serve_simple_form (const void *cls,
- const char *mime,
- struct Session *session,
- struct MHD_Connection *connection)
+ const char *mime,
+ struct Session *session,
+ struct MHD_Connection *connection)
{
int ret;
const char *form = cls;
@@ -282,17 +282,17 @@ serve_simple_form (const void *cls,
/* return static form */
response = MHD_create_response_from_buffer (strlen (form),
- (void *) form,
- MHD_RESPMEM_PERSISTENT);
+ (void *) form,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
return MHD_NO;
add_session_cookie (session, response);
MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_ENCODING,
- mime);
+ MHD_HTTP_HEADER_CONTENT_ENCODING,
+ mime);
ret = MHD_queue_response (connection,
- MHD_HTTP_OK,
- response);
+ MHD_HTTP_OK,
+ response);
MHD_destroy_response (response);
return ret;
}
@@ -308,9 +308,9 @@ serve_simple_form (const void *cls,
*/
static int
fill_v1_form (const void *cls,
- const char *mime,
- struct Session *session,
- struct MHD_Connection *connection)
+ const char *mime,
+ struct Session *session,
+ struct MHD_Connection *connection)
{
int ret;
size_t slen;
@@ -323,13 +323,13 @@ fill_v1_form (const void *cls,
if (NULL == reply)
return MHD_NO;
snprintf (reply,
- slen + 1,
- MAIN_PAGE,
- session->value_1);
+ slen + 1,
+ MAIN_PAGE,
+ session->value_1);
/* return static form */
response = MHD_create_response_from_buffer (slen,
- (void *) reply,
- MHD_RESPMEM_MUST_FREE);
+ (void *) reply,
+ MHD_RESPMEM_MUST_FREE);
if (NULL == response)
{
free (reply);
@@ -337,11 +337,11 @@ fill_v1_form (const void *cls,
}
add_session_cookie (session, response);
MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_ENCODING,
- mime);
+ MHD_HTTP_HEADER_CONTENT_ENCODING,
+ mime);
ret = MHD_queue_response (connection,
- MHD_HTTP_OK,
- response);
+ MHD_HTTP_OK,
+ response);
MHD_destroy_response (response);
return ret;
}
@@ -357,9 +357,9 @@ fill_v1_form (const void *cls,
*/
static int
fill_v1_v2_form (const void *cls,
- const char *mime,
- struct Session *session,
- struct MHD_Connection *connection)
+ const char *mime,
+ struct Session *session,
+ struct MHD_Connection *connection)
{
int ret;
char *reply;
@@ -372,14 +372,14 @@ fill_v1_v2_form (const void *cls,
if (NULL == reply)
return MHD_NO;
snprintf (reply,
- slen + 1,
- SECOND_PAGE,
- session->value_1,
+ slen + 1,
+ SECOND_PAGE,
+ session->value_1,
session->value_2);
/* return static form */
response = MHD_create_response_from_buffer (slen,
- (void *) reply,
- MHD_RESPMEM_MUST_FREE);
+ (void *) reply,
+ MHD_RESPMEM_MUST_FREE);
if (NULL == response)
{
free (reply);
@@ -387,11 +387,11 @@ fill_v1_v2_form (const void *cls,
}
add_session_cookie (session, response);
MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_ENCODING,
- mime);
+ MHD_HTTP_HEADER_CONTENT_ENCODING,
+ mime);
ret = MHD_queue_response (connection,
- MHD_HTTP_OK,
- response);
+ MHD_HTTP_OK,
+ response);
MHD_destroy_response (response);
return ret;
}
@@ -407,9 +407,9 @@ fill_v1_v2_form (const void *cls,
*/
static int
not_found_page (const void *cls,
- const char *mime,
- struct Session *session,
- struct MHD_Connection *connection)
+ const char *mime,
+ struct Session *session,
+ struct MHD_Connection *connection)
{
int ret;
struct MHD_Response *response;
@@ -418,16 +418,16 @@ not_found_page (const void *cls,
/* unsupported HTTP method */
response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR),
- (void *) NOT_FOUND_ERROR,
- MHD_RESPMEM_PERSISTENT);
+ (void *) NOT_FOUND_ERROR,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
return MHD_NO;
ret = MHD_queue_response (connection,
- MHD_HTTP_NOT_FOUND,
- response);
+ MHD_HTTP_NOT_FOUND,
+ response);
MHD_add_response_header (response,
- MHD_HTTP_HEADER_CONTENT_ENCODING,
- mime);
+ MHD_HTTP_HEADER_CONTENT_ENCODING,
+ mime);
MHD_destroy_response (response);
return ret;
}
@@ -468,12 +468,12 @@ static struct Page pages[] =
*/
static int
post_iterator (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)
+ 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)
{
struct Request *request = cls;
struct Session *session = request->session;
@@ -485,29 +485,29 @@ post_iterator (void *cls,
if (0 == strcmp ("DONE", key))
{
fprintf (stdout,
- "Session `%s' submitted `%s', `%s'\n",
- session->sid,
- session->value_1,
- session->value_2);
+ "Session `%s' submitted `%s', `%s'\n",
+ session->sid,
+ session->value_1,
+ session->value_2);
return MHD_YES;
}
if (0 == strcmp ("v1", key))
{
if (size + off >= sizeof(session->value_1))
- size = sizeof (session->value_1) - off - 1;
+ size = sizeof (session->value_1) - off - 1;
memcpy (&session->value_1[off],
- data,
- size);
+ data,
+ size);
session->value_1[size+off] = '\0';
return MHD_YES;
}
if (0 == strcmp ("v2", key))
{
if (size + off >= sizeof(session->value_2))
- size = sizeof (session->value_2) - off - 1;
+ size = sizeof (session->value_2) - off - 1;
memcpy (&session->value_2[off],
- data,
- size);
+ data,
+ size);
session->value_2[size+off] = '\0';
return MHD_YES;
}
@@ -553,13 +553,13 @@ post_iterator (void *cls,
*/
static int
create_response (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 **ptr)
+ struct MHD_Connection *connection,
+ const char *url,
+ const char *method,
+ const char *version,
+ const char *upload_data,
+ size_t *upload_data_size,
+ void **ptr)
{
struct MHD_Response *response;
struct Request *request;
@@ -574,33 +574,33 @@ create_response (void *cls,
{
request = calloc (1, sizeof (struct Request));
if (NULL == request)
- {
- fprintf (stderr, "calloc error: %s\n", strerror (errno));
- return MHD_NO;
- }
+ {
+ fprintf (stderr, "calloc error: %s\n", strerror (errno));
+ return MHD_NO;
+ }
*ptr = request;
if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
- {
- request->pp = MHD_create_post_processor (connection, 1024,
- &post_iterator, request);
- if (NULL == request->pp)
- {
- fprintf (stderr, "Failed to setup post processor for `%s'\n",
- url);
- return MHD_NO; /* internal error */
- }
- }
+ {
+ request->pp = MHD_create_post_processor (connection, 1024,
+ &post_iterator, request);
+ if (NULL == request->pp)
+ {
+ fprintf (stderr, "Failed to setup post processor for `%s'\n",
+ url);
+ return MHD_NO; /* internal error */
+ }
+ }
return MHD_YES;
}
if (NULL == request->session)
{
request->session = get_session (connection);
if (NULL == request->session)
- {
- fprintf (stderr, "Failed to setup session for `%s'\n",
- url);
- return MHD_NO; /* internal error */
- }
+ {
+ fprintf (stderr, "Failed to setup session for `%s'\n",
+ url);
+ return MHD_NO; /* internal error */
+ }
}
session = request->session;
session->start = time (NULL);
@@ -608,19 +608,19 @@ create_response (void *cls,
{
/* evaluate POST data */
MHD_post_process (request->pp,
- upload_data,
- *upload_data_size);
+ upload_data,
+ *upload_data_size);
if (0 != *upload_data_size)
- {
- *upload_data_size = 0;
- return MHD_YES;
- }
+ {
+ *upload_data_size = 0;
+ return MHD_YES;
+ }
/* done with POST data, serve response */
MHD_destroy_post_processor (request->pp);
request->pp = NULL;
method = MHD_HTTP_METHOD_GET; /* fake 'GET' */
if (NULL != request->post_url)
- url = request->post_url;
+ url = request->post_url;
}
if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
@@ -629,23 +629,23 @@ create_response (void *cls,
/* find out which page to serve */
i=0;
while ( (pages[i].url != NULL) &&
- (0 != strcmp (pages[i].url, url)) )
- i++;
+ (0 != strcmp (pages[i].url, url)) )
+ i++;
ret = pages[i].handler (pages[i].handler_cls,
- pages[i].mime,
- session, connection);
+ pages[i].mime,
+ session, connection);
if (ret != MHD_YES)
- fprintf (stderr, "Failed to create page for `%s'\n",
- url);
+ fprintf (stderr, "Failed to create page for `%s'\n",
+ url);
return ret;
}
/* unsupported HTTP method */
response = MHD_create_response_from_buffer (strlen (METHOD_ERROR),
- (void *) METHOD_ERROR,
- MHD_RESPMEM_PERSISTENT);
+ (void *) METHOD_ERROR,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection,
- MHD_HTTP_NOT_ACCEPTABLE,
- response);
+ MHD_HTTP_NOT_ACCEPTABLE,
+ response);
MHD_destroy_response (response);
return ret;
}
@@ -662,9 +662,9 @@ create_response (void *cls,
*/
static void
request_completed_callback (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct Request *request = *con_cls;
(void)cls; /* Unused. Silent compiler warning. */
@@ -700,14 +700,14 @@ expire_sessions ()
{
next = pos->next;
if (now - pos->start > 60 * 60)
- {
- /* expire sessions after 1h */
- if (NULL == prev)
- sessions = pos->next;
- else
- prev->next = next;
- free (pos);
- }
+ {
+ /* expire sessions after 1h */
+ if (NULL == prev)
+ sessions = pos->next;
+ else
+ prev->next = next;
+ free (pos);
+ }
else
prev = pos;
pos = next;
@@ -741,10 +741,10 @@ main (int argc, char *const *argv)
d = MHD_start_daemon (MHD_USE_ERROR_LOG,
atoi (argv[1]),
NULL, NULL,
- &create_response, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
- MHD_OPTION_NOTIFY_COMPLETED,
&request_completed_callback, NULL,
- MHD_OPTION_END);
+ &create_response, NULL,
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
+ MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL,
+ MHD_OPTION_END);
if (NULL == d)
return 1;
while (1)
@@ -755,15 +755,15 @@ main (int argc, char *const *argv)
FD_ZERO (&ws);
FD_ZERO (&es);
if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
- break; /* fatal internal error */
+ break; /* fatal internal error */
if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
- {
- tv.tv_sec = mhd_timeout / 1000;
- tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
- tvp = &tv;
- }
+ {
+ tv.tv_sec = mhd_timeout / 1000;
+ tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
+ tvp = &tv;
+ }
else
- tvp = NULL;
+ tvp = NULL;
if (-1 == select (max + 1, &rs, &ws, &es, tvp))
{
if (EINTR != errno)
diff --git a/src/examples/querystring_example.c
b/src/examples/querystring_example.c
index 3d91bcea..43872cb5 100644
--- a/src/examples/querystring_example.c
+++ b/src/examples/querystring_example.c
@@ -62,7 +62,7 @@ ahc_echo (void *cls,
return MHD_NO;
sprintf (me, fmt, "q", val);
response = MHD_create_response_from_buffer (strlen (me), me,
- MHD_RESPMEM_MUST_FREE);
+ MHD_RESPMEM_MUST_FREE);
if (response == NULL)
{
free (me);
diff --git a/src/examples/refuse_post_example.c
b/src/examples/refuse_post_example.c
index dad3beb1..88432f0c 100644
--- a/src/examples/refuse_post_example.c
+++ b/src/examples/refuse_post_example.c
@@ -62,8 +62,8 @@ ahc_echo (void *cls,
if (0 == strcmp (method, "POST"))
{
response = MHD_create_response_from_buffer (strlen (BUSYPAGE),
- (void *) BUSYPAGE,
- MHD_RESPMEM_PERSISTENT);
+ (void *) BUSYPAGE,
+ MHD_RESPMEM_PERSISTENT);
ret =
MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE,
response);
@@ -74,8 +74,8 @@ ahc_echo (void *cls,
*ptr = NULL; /* reset when done */
response = MHD_create_response_from_buffer (strlen (me),
- (void *) me,
- MHD_RESPMEM_PERSISTENT);
+ (void *) me,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
diff --git a/src/examples/upgrade_example.c b/src/examples/upgrade_example.c
index 73cfafb2..3572d663 100644
--- a/src/examples/upgrade_example.c
+++ b/src/examples/upgrade_example.c
@@ -296,8 +296,8 @@ main (int argc,
atoi (argv[1]),
NULL, NULL,
&ahc_echo, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
- MHD_OPTION_END);
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
(void) getc (stdin);
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 0ce62d42..a1b412d4 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -212,8 +212,8 @@ typedef SOCKET MHD_socket;
#elif defined(__clang__) || defined (__GNUC_PATCHLEVEL__)
/* clang or GCC since 3.0 */
#define _MHD_GCC_PRAG(x) _Pragma (#x)
-#if (defined(__clang__) && (__clang_major__+0 >= 5 || \
- (!defined(__apple_build_version__) &&
(__clang_major__+0 > 3 || (__clang_major__+0 == 3 && __clang_minor__ >= 3)))))
|| \
+#if (defined(__clang__) && (__clang_major__+0 >= 5 || \
+ (!defined(__apple_build_version__) && (__clang_major__+0 > 3 ||
(__clang_major__+0 == 3 && __clang_minor__ >= 3))))) || \
__GNUC__+0 > 4 || (__GNUC__+0 == 4 && __GNUC_MINOR__+0 >= 8)
/* clang >= 3.3 (or XCode's clang >= 5.0) or
GCC >= 4.8 */
@@ -2118,10 +2118,10 @@ typedef int
*/
_MHD_EXTERN struct MHD_Daemon *
MHD_start_daemon_va (unsigned int flags,
- uint16_t port,
- MHD_AcceptPolicyCallback apc, void *apc_cls,
- MHD_AccessHandlerCallback dh, void *dh_cls,
- va_list ap);
+ uint16_t port,
+ MHD_AcceptPolicyCallback apc, void *apc_cls,
+ MHD_AccessHandlerCallback dh, void *dh_cls,
+ va_list ap);
/**
@@ -2146,10 +2146,10 @@ MHD_start_daemon_va (unsigned int flags,
*/
_MHD_EXTERN struct MHD_Daemon *
MHD_start_daemon (unsigned int flags,
- uint16_t port,
- MHD_AcceptPolicyCallback apc, void *apc_cls,
- MHD_AccessHandlerCallback dh, void *dh_cls,
- ...);
+ uint16_t port,
+ MHD_AcceptPolicyCallback apc, void *apc_cls,
+ MHD_AccessHandlerCallback dh, void *dh_cls,
+ ...);
/**
@@ -2214,9 +2214,9 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
*/
_MHD_EXTERN int
MHD_add_connection (struct MHD_Daemon *daemon,
- MHD_socket client_socket,
- const struct sockaddr *addr,
- socklen_t addrlen);
+ MHD_socket client_socket,
+ const struct sockaddr *addr,
+ socklen_t addrlen);
/**
@@ -2252,8 +2252,8 @@ _MHD_EXTERN int
MHD_get_fdset (struct MHD_Daemon *daemon,
fd_set *read_fd_set,
fd_set *write_fd_set,
- fd_set *except_fd_set,
- MHD_socket *max_fd);
+ fd_set *except_fd_set,
+ MHD_socket *max_fd);
/**
@@ -2290,11 +2290,11 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN int
MHD_get_fdset2 (struct MHD_Daemon *daemon,
- fd_set *read_fd_set,
- fd_set *write_fd_set,
- fd_set *except_fd_set,
- MHD_socket *max_fd,
- unsigned int fd_setsize);
+ fd_set *read_fd_set,
+ fd_set *write_fd_set,
+ fd_set *except_fd_set,
+ MHD_socket *max_fd,
+ unsigned int fd_setsize);
/**
@@ -2345,7 +2345,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN int
MHD_get_timeout (struct MHD_Daemon *daemon,
- MHD_UNSIGNED_LONG_LONG *timeout);
+ MHD_UNSIGNED_LONG_LONG *timeout);
/**
@@ -2396,9 +2396,9 @@ MHD_run (struct MHD_Daemon *daemon);
*/
_MHD_EXTERN 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);
+ const fd_set *read_fd_set,
+ const fd_set *write_fd_set,
+ const fd_set *except_fd_set);
@@ -2453,7 +2453,7 @@ _MHD_EXTERN int
MHD_set_connection_value (struct MHD_Connection *connection,
enum MHD_ValueKind kind,
const char *key,
- const char *value);
+ const char *value);
/**
@@ -2501,8 +2501,8 @@ MHD_http_unescape (char *val);
*/
_MHD_EXTERN const char *
MHD_lookup_connection_value (struct MHD_Connection *connection,
- enum MHD_ValueKind kind,
- const char *key);
+ enum MHD_ValueKind kind,
+ const char *key);
/**
@@ -2519,7 +2519,7 @@ MHD_lookup_connection_value (struct MHD_Connection
*connection,
_MHD_EXTERN int
MHD_queue_response (struct MHD_Connection *connection,
unsigned int status_code,
- struct MHD_Response *response);
+ struct MHD_Response *response);
/**
@@ -2636,9 +2636,9 @@ MHD_set_response_options (struct MHD_Response *response,
*/
_MHD_EXTERN struct MHD_Response *
MHD_create_response_from_callback (uint64_t size,
- size_t block_size,
- MHD_ContentReaderCallback crc, void *crc_cls,
- MHD_ContentReaderFreeCallback crfc);
+ size_t block_size,
+ MHD_ContentReaderCallback crc, void *crc_cls,
+ MHD_ContentReaderFreeCallback crfc);
/**
@@ -2658,9 +2658,9 @@ MHD_create_response_from_callback (uint64_t size,
_MHD_DEPR_FUNC("MHD_create_response_from_data() is deprecated, use
MHD_create_response_from_buffer()") \
_MHD_EXTERN struct MHD_Response *
MHD_create_response_from_data (size_t size,
- void *data,
- int must_free,
- int must_copy);
+ void *data,
+ int must_free,
+ int must_copy);
/**
@@ -2711,8 +2711,8 @@ enum MHD_ResponseMemoryMode
*/
_MHD_EXTERN struct MHD_Response *
MHD_create_response_from_buffer (size_t size,
- void *buffer,
- enum MHD_ResponseMemoryMode mode);
+ void *buffer,
+ enum MHD_ResponseMemoryMode mode);
/**
@@ -2935,7 +2935,7 @@ typedef void
*/
_MHD_EXTERN struct MHD_Response *
MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
- void *upgrade_handler_cls);
+ void *upgrade_handler_cls);
/**
@@ -2964,7 +2964,7 @@ MHD_destroy_response (struct MHD_Response *response);
_MHD_EXTERN int
MHD_add_response_header (struct MHD_Response *response,
const char *header,
- const char *content);
+ const char *content);
/**
@@ -2979,7 +2979,7 @@ MHD_add_response_header (struct MHD_Response *response,
_MHD_EXTERN int
MHD_add_response_footer (struct MHD_Response *response,
const char *footer,
- const char *content);
+ const char *content);
/**
@@ -2994,7 +2994,7 @@ MHD_add_response_footer (struct MHD_Response *response,
_MHD_EXTERN int
MHD_del_response_header (struct MHD_Response *response,
const char *header,
- const char *content);
+ const char *content);
/**
@@ -3022,7 +3022,7 @@ MHD_get_response_headers (struct MHD_Response *response,
*/
_MHD_EXTERN const char *
MHD_get_response_header (struct MHD_Response *response,
- const char *key);
+ const char *key);
/* ********************** PostProcessor functions ********************** */
@@ -3054,8 +3054,8 @@ MHD_get_response_header (struct MHD_Response *response,
*/
_MHD_EXTERN struct MHD_PostProcessor *
MHD_create_post_processor (struct MHD_Connection *connection,
- size_t buffer_size,
- MHD_PostDataIterator iter, void *iter_cls);
+ size_t buffer_size,
+ MHD_PostDataIterator iter, void *iter_cls);
/**
@@ -3106,7 +3106,7 @@ MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
*
* @param connection The MHD connection structure
* @return NULL if no username could be found, a pointer
- * to the username if found, free using #MHD_free().
+ * to the username if found, free using #MHD_free().
* @ingroup authentication
*/
_MHD_EXTERN char *
@@ -3133,17 +3133,17 @@ MHD_free (void *ptr);
* @param username The username needs to be authenticated
* @param password The password used in the authentication
* @param nonce_timeout The amount of time for a nonce to be
- * invalid in seconds
+ * invalid in seconds
* @return #MHD_YES if authenticated, #MHD_NO if not,
- * #MHD_INVALID_NONCE if nonce is invalid
+ * #MHD_INVALID_NONCE if nonce is invalid
* @ingroup authentication
*/
_MHD_EXTERN int
MHD_digest_auth_check (struct MHD_Connection *connection,
- const char *realm,
- const char *username,
- const char *password,
- unsigned int nonce_timeout);
+ const char *realm,
+ const char *username,
+ const char *password,
+ unsigned int nonce_timeout);
/**
@@ -3156,16 +3156,16 @@ MHD_digest_auth_check (struct MHD_Connection
*connection,
* body; note that this function will set the "WWW Authenticate"
* header and that the caller should not do this
* @param signal_stale #MHD_YES if the nonce is invalid to add
- * 'stale=true' to the authentication header
+ * 'stale=true' to the authentication header
* @return #MHD_YES on success, #MHD_NO otherwise
* @ingroup authentication
*/
_MHD_EXTERN int
MHD_queue_auth_fail_response (struct MHD_Connection *connection,
- const char *realm,
- const char *opaque,
- struct MHD_Response *response,
- int signal_stale);
+ const char *realm,
+ const char *opaque,
+ struct MHD_Response *response,
+ int signal_stale);
/**
@@ -3174,12 +3174,12 @@ MHD_queue_auth_fail_response (struct MHD_Connection
*connection,
* @param connection The MHD connection structure
* @param[out] password a pointer for the password, free using #MHD_free().
* @return NULL if no username could be found, a pointer
- * to the username if found, free using #MHD_free().
+ * to the username if found, free using #MHD_free().
* @ingroup authentication
*/
_MHD_EXTERN char *
MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
- char** password);
+ char** password);
/**
@@ -3196,8 +3196,8 @@ MHD_basic_auth_get_username_password (struct
MHD_Connection *connection,
*/
_MHD_EXTERN int
MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
- const char *realm,
- struct MHD_Response *response);
+ const char *realm,
+ struct MHD_Response *response);
/* ********************** generic query functions ********************** */
@@ -3214,8 +3214,8 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection
*connection,
*/
_MHD_EXTERN const union MHD_ConnectionInfo *
MHD_get_connection_info (struct MHD_Connection *connection,
- enum MHD_ConnectionInfoType info_type,
- ...);
+ enum MHD_ConnectionInfoType info_type,
+ ...);
/**
@@ -3248,8 +3248,8 @@ enum MHD_CONNECTION_OPTION
*/
_MHD_EXTERN int
MHD_set_connection_option (struct MHD_Connection *connection,
- enum MHD_CONNECTION_OPTION option,
- ...);
+ enum MHD_CONNECTION_OPTION option,
+ ...);
/**
@@ -3312,8 +3312,8 @@ union MHD_DaemonInfo
*/
_MHD_EXTERN const union MHD_DaemonInfo *
MHD_get_daemon_info (struct MHD_Daemon *daemon,
- enum MHD_DaemonInfoType info_type,
- ...);
+ enum MHD_DaemonInfoType info_type,
+ ...);
/**
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index d4330c32..eb1a86ae 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -391,9 +391,9 @@ enum MHD_Method
*/
typedef struct MHD_Action *
(*MHD_RequestCallback) (void *cls,
- struct MHD_Request *request,
- const char *url,
- enum MHD_Method method);
+ struct MHD_Request *request,
+ const char *url,
+ enum MHD_Method method);
/**
@@ -406,7 +406,7 @@ typedef struct MHD_Action *
*/
struct MHD_Daemon *
MHD_daemon_create (MHD_RequestCallback cb,
- void *cb_cls);
+ void *cb_cls);
/**
@@ -469,9 +469,9 @@ MHD_daemon_destroy (struct MHD_Daemon *daemon);
*/
typedef void
(*MHD_LoggingCallback)(void *cls,
- enum MHD_StatusCode sc,
- const char *fm,
- va_list ap);
+ enum MHD_StatusCode sc,
+ const char *fm,
+ va_list ap);
/**
@@ -485,8 +485,8 @@ typedef void
*/
_MHD_EXTERN void
MHD_daemon_set_logger (struct MHD_Daemon *daemon,
- MHD_LoggingCallback logger,
- void *logger_cls);
+ MHD_LoggingCallback logger,
+ void *logger_cls);
/**
@@ -609,8 +609,8 @@ enum MHD_FastOpenMethod
*/
_MHD_EXTERN enum MHD_Bool
MHD_daemon_tcp_fastopen (struct MHD_Daemon *daemon,
- enum MHD_FastOpenMethod fom,
- unsigned int queue_length);
+ enum MHD_FastOpenMethod fom,
+ unsigned int queue_length);
/**
@@ -656,8 +656,8 @@ enum MHD_AddressFamily
*/
_MHD_EXTERN void
MHD_daemon_bind_port (struct MHD_Daemon *daemon,
- enum MHD_AddressFamily af,
- uint16_t port);
+ enum MHD_AddressFamily af,
+ uint16_t port);
/**
@@ -671,8 +671,8 @@ MHD_daemon_bind_port (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN void
MHD_daemon_bind_socket_address (struct MHD_Daemon *daemon,
- const struct sockaddr *sa,
- size_t sa_lem);
+ const struct sockaddr *sa,
+ size_t sa_lem);
/**
@@ -684,7 +684,7 @@ MHD_daemon_bind_socket_address (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN void
MHD_daemon_listen_queue (struct MHD_Daemon *daemon,
- int listen_backlog);
+ int listen_backlog);
/**
@@ -717,7 +717,7 @@ MHD_daemon_listen_allow_address_reuse (struct MHD_Daemon
*daemon);
*/
_MHD_EXTERN void
MHD_daemon_listen_socket (struct MHD_Daemon *daemon,
- MHD_socket listen_socket);
+ MHD_socket listen_socket);
/**
@@ -757,7 +757,7 @@ enum MHD_EventLoopSyscall
*/
_MHD_EXTERN enum MHD_Bool
MHD_daemon_event_loop (struct MHD_Daemon *daemon,
- enum MHD_EventLoopSyscall els);
+ enum MHD_EventLoopSyscall els);
/**
@@ -801,7 +801,7 @@ enum MHD_ProtocolStrictLevel
*/
_MHD_EXTERN void
MHD_daemon_protocol_strict_level (struct MHD_Daemon *daemon,
- enum MHD_ProtocolStrictLevel sl);
+ enum MHD_ProtocolStrictLevel sl);
/**
@@ -821,8 +821,8 @@ MHD_daemon_protocol_strict_level (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN enum MHD_StatusCode
MHD_daemon_set_tls_backend (struct MHD_Daemon *daemon,
- const char *tls_backend,
- const char *ciphers);
+ const char *tls_backend,
+ const char *ciphers);
/**
@@ -839,9 +839,9 @@ MHD_daemon_set_tls_backend (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN enum MHD_StatusCode
MHD_daemon_tls_key_and_cert_from_memory (struct MHD_Daemon *daemon,
- const char *mem_key,
- const char *mem_cert,
- const char *pass);
+ const char *mem_key,
+ const char *mem_cert,
+ const char *pass);
/**
@@ -854,7 +854,7 @@ MHD_daemon_tls_key_and_cert_from_memory (struct MHD_Daemon
*daemon,
*/
_MHD_EXTERN enum MHD_StatusCode
MHD_daemon_tls_mem_dhparams (struct MHD_Daemon *daemon,
- const char *dh);
+ const char *dh);
/**
@@ -867,7 +867,7 @@ _MHD_EXTERN enum MHD_StatusCode
*/
_MHD_EXTERN enum MHD_StatusCode
MHD_daemon_tls_mem_trust (struct MHD_Daemon *daemon,
- const char *mem_trust);
+ const char *mem_trust);
/**
@@ -879,7 +879,7 @@ MHD_daemon_tls_mem_trust (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN enum MHD_StatusCode
MHD_daemon_gnutls_credentials (struct MHD_Daemon *daemon,
- int gnutls_credentials);
+ int gnutls_credentials);
/**
@@ -900,7 +900,7 @@ MHD_daemon_gnutls_credentials (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN void
MHD_daemon_gnutls_key_and_cert_from_callback (struct MHD_Daemon *daemon,
- void *cb);
+ void *cb);
/**
@@ -958,7 +958,7 @@ enum MHD_ThreadingModel
*/
_MHD_EXTERN void
MHD_daemon_threading_model (struct MHD_Daemon *daemon,
- enum MHD_ThreadingModel tm);
+ enum MHD_ThreadingModel tm);
/**
@@ -987,8 +987,8 @@ typedef enum MHD_Bool
*/
_MHD_EXTERN void
MHD_daemon_accept_policy (struct MHD_Daemon *daemon,
- MHD_AcceptPolicyCallback apc,
- void *apc_cls);
+ MHD_AcceptPolicyCallback apc,
+ void *apc_cls);
/**
@@ -1003,8 +1003,8 @@ MHD_daemon_accept_policy (struct MHD_Daemon *daemon,
*/
typedef void *
(MHD_EarlyUriLogCallback)(void *cls,
- const char *uri,
- struct MHD_Request *request);
+ const char *uri,
+ struct MHD_Request *request);
/**
@@ -1018,8 +1018,8 @@ typedef void *
*/
_MHD_EXTERN void
MHD_daemon_set_early_uri_logger (struct MHD_Daemon *daemon,
- MHD_EarlyUriLogCallback cb,
- void *cb_cls);
+ MHD_EarlyUriLogCallback cb,
+ void *cb_cls);
/**
@@ -1043,8 +1043,8 @@ MHD_daemon_set_early_uri_logger (struct MHD_Daemon
*daemon,
*/
typedef void
(*MHD_ConnectionCompletedCallback) (void *cls,
- struct MHD_Connection *connection,
- enum MHD_ConnectionNotificationCode toe);
+ struct MHD_Connection *connection,
+ enum MHD_ConnectionNotificationCode toe);
/**
@@ -1059,8 +1059,8 @@ typedef void
*/
_MHD_EXTERN void
MHD_daemon_set_notify_connection (struct MHD_Daemon *daemon,
- MHD_NotifyConnectionCallback ncc,
- void *ncc_cls);
+ MHD_NotifyConnectionCallback ncc,
+ void *ncc_cls);
/**
@@ -1076,8 +1076,8 @@ MHD_daemon_set_notify_connection (struct MHD_Daemon
*daemon,
*/
_MHD_EXTERN void
MHD_daemon_connection_memory_limit (struct MHD_Daemon *daemon,
- size_t memory_limit_b,
- size_t memory_increment_b);
+ size_t memory_limit_b,
+ size_t memory_increment_b);
/**
@@ -1090,7 +1090,7 @@ MHD_daemon_connection_memory_limit (struct MHD_Daemon
*daemon,
*/
_MHD_EXTERN void
MHD_daemon_thread_stack_size (struct MHD_Daemon *daemon,
- size_t stack_limit_b);
+ size_t stack_limit_b);
/**
@@ -1110,8 +1110,8 @@ MHD_daemon_thread_stack_size (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN void
MHD_daemon_connection_limits (struct MHD_Daemon *daemon,
- unsigned int global_connection_limit,
- unsigned int ip_connection_limit);
+ unsigned int global_connection_limit,
+ unsigned int ip_connection_limit);
/**
@@ -1124,7 +1124,7 @@ MHD_daemon_connection_limits (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN void
MHD_daemon_connection_default_timeout (struct MHD_Daemon *daemon,
- unsigned int timeout_s);
+ unsigned int timeout_s);
/**
@@ -1141,8 +1141,8 @@ MHD_daemon_connection_default_timeout (struct MHD_Daemon
*daemon,
*/
typedef size_t
MHD_UnescapeCallback (void *cls,
- struct MHD_Request *req,
- char *s);
+ struct MHD_Request *req,
+ char *s);
/**
@@ -1158,8 +1158,8 @@ MHD_UnescapeCallback (void *cls,
*/
_MHD_EXTERN void
MHD_daemon_unescape_cb (struct MHD_Daemon *daemon,
- MHD_UnescapeCallback unescape_cb,
- void *unescape_cb_cls);
+ MHD_UnescapeCallback unescape_cb,
+ void *unescape_cb_cls);
/**
@@ -1173,8 +1173,8 @@ MHD_daemon_unescape_cb (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN void
MHD_daemon_digest_auth_random (struct MHD_Daemon *daemon,
- size_t buf_size,
- const void *buf);
+ size_t buf_size,
+ const void *buf);
/**
@@ -1186,7 +1186,7 @@ MHD_daemon_digest_auth_random (struct MHD_Daemon *daemon,
*/
_MHD_EXTERN void
MHD_daemon_digest_auth_nc_size (struct MHD_Daemon *daemon,
- size_t stack_limit_b);
+ size_t stack_limit_b);
/* ********************* connection options ************** */
@@ -1203,7 +1203,7 @@ MHD_daemon_digest_auth_nc_size (struct MHD_Daemon *daemon,
*/
struct MHD_ConnectionOption
MHD_connection_timeout (struct MHD_Connection *connection,
- unsigned int timeout_s);
+ unsigned int timeout_s);
/* **************** Request handling functions ***************** */
@@ -1221,9 +1221,9 @@ MHD_connection_timeout (struct MHD_Connection *connection,
*/
_MHD_EXTERN unsigned int
MHD_request_get_values (struct MHD_Request *request,
- enum MHD_ValueKind kind,
- MHD_KeyValueIterator iterator,
- void *iterator_cls);
+ enum MHD_ValueKind kind,
+ MHD_KeyValueIterator iterator,
+ void *iterator_cls);
/**
@@ -1253,9 +1253,9 @@ MHD_request_get_values (struct MHD_Request *request,
*/
_MHD_EXTERN enum MHD_Bool
MHD_request_set_value (struct MHD_Request *request,
- enum MHD_ValueKind kind,
- const char *key,
- const char *value);
+ enum MHD_ValueKind kind,
+ const char *key,
+ const char *value);
/**
@@ -1270,8 +1270,8 @@ MHD_request_set_value (struct MHD_Request *request,
*/
_MHD_EXTERN const char *
MHD_request_lookup_value (struct MHD_Request *request,
- enum MHD_ValueKind kind,
- const char *key);
+ enum MHD_ValueKind kind,
+ const char *key);
@@ -1445,7 +1445,7 @@ MHD_request_resume (struct MHD_Request *request);
*/
struct MHD_Action *
MHD_action_from_response (struct MHD_Response *response,
- enum MHD_bool destroy_after_use);
+ enum MHD_bool destroy_after_use);
/**
@@ -1472,8 +1472,8 @@ MHD_response_option_v10_only (struct MHD_Response
*response);
*/
typedef void
(*MHD_RequestTerminationCallback) (void *cls,
- enum MHD_RequestTerminationCode toe,
- void *request_context);
+ enum MHD_RequestTerminationCode toe,
+ void *request_context);
/**
@@ -1486,8 +1486,8 @@ typedef void
*/
void
MHD_response_option_termination_callback (struct MHD_Response *response,
- MHD_RequestTerminationCallback
termination_cb,
- void *termination_cb_cls);
+ MHD_RequestTerminationCallback termination_cb,
+ void *termination_cb_cls);
/**
@@ -1509,11 +1509,11 @@ MHD_response_option_termination_callback (struct
MHD_Response *response,
*/
_MHD_EXTERN struct MHD_Response *
MHD_response_from_callback (enum MHD_HTTP_StatusCode sc,
- uint64_t size,
- size_t block_size,
- MHD_ContentReaderCallback crc,
- void *crc_cls,
- MHD_ContentReaderFreeCallback crfc);
+ uint64_t size,
+ size_t block_size,
+ MHD_ContentReaderCallback crc,
+ void *crc_cls,
+ MHD_ContentReaderFreeCallback crfc);
/**
@@ -1566,9 +1566,9 @@ enum MHD_ResponseMemoryMode
*/
_MHD_EXTERN struct MHD_Response *
MHD_response_from_buffer (enum MHD_HTTP_StatusCode sc,
- size_t size,
- void *buffer,
- enum MHD_ResponseMemoryMode mode);
+ size_t size,
+ void *buffer,
+ enum MHD_ResponseMemoryMode mode);
/**
@@ -1591,9 +1591,9 @@ MHD_response_from_buffer (enum MHD_HTTP_StatusCode sc,
*/
_MHD_EXTERN struct MHD_Response *
MHD_response_from_fd (enum MHD_HTTP_StatusCode sc,
- int fd,
- uint64_t offset,
- uint64_t size);
+ int fd,
+ uint64_t offset,
+ uint64_t size);
/**
@@ -1637,8 +1637,8 @@ struct MHD_UpgradeResponseHandle;
*/
_MHD_EXTERN enum MHD_Bool
MHD_upgrade_operation (struct MHD_UpgradeResponseHandle *urh,
- enum MHD_UpgradeOperation operation,
- ...);
+ enum MHD_UpgradeOperation operation,
+ ...);
/**
@@ -1730,7 +1730,7 @@ typedef void
*/
_MHD_EXTERN struct MHD_Response *
MHD_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
- void *upgrade_handler_cls);
+ void *upgrade_handler_cls);
/**
@@ -1759,7 +1759,7 @@ MHD_response_queue_for_destroy (struct MHD_Response
*response);
_MHD_EXTERN enum MHD_Bool
MHD_response_add_header (struct MHD_Response *response,
const char *header,
- const char *content);
+ const char *content);
/**
@@ -1790,7 +1790,7 @@ MHD_response_add_trailer (struct MHD_Response *response,
_MHD_EXTERN enum MHD_Bool
MHD_response_del_header (struct MHD_Response *response,
const char *header,
- const char *content);
+ const char *content);
/**
@@ -1806,7 +1806,7 @@ MHD_response_del_header (struct MHD_Response *response,
_MHD_EXTERN unsigned int
MHD_response_get_headers (struct MHD_Response *response,
MHD_KeyValueIterator iterator,
- void *iterator_cls);
+ void *iterator_cls);
/**
@@ -1819,7 +1819,7 @@ MHD_response_get_headers (struct MHD_Response *response,
*/
_MHD_EXTERN const char *
MHD_response_get_header (struct MHD_Response *response,
- const char *key);
+ const char *key);
/* ************Upload and PostProcessor functions ********************** */
@@ -1853,8 +1853,8 @@ MHD_action_continue (void);
*/
typedef struct MHD_Action *
(*MHD_UploadCallback) (void *cls,
- const char *upload_data,
- size_t *upload_data_size);
+ const char *upload_data,
+ size_t *upload_data_size);
/**
@@ -1867,7 +1867,7 @@ typedef struct MHD_Action *
*/
_MHD_EXTERN struct MHD_Action *
MHD_action_process_upload (MHD_UploadCallback uc,
- void *uc_cls);
+ void *uc_cls);
/**
@@ -1931,8 +1931,8 @@ typedef struct MHD_Action *
*/
_MHD_EXTERN struct MHD_Action *
MHD_action_parse_post (size_t buffer_size,
- MHD_PostDataIterator iter,
- void *iter_cls);
+ MHD_PostDataIterator iter,
+ void *iter_cls);
@@ -2088,9 +2088,9 @@ union MHD_ConnectionInformation
*/
_MHD_EXTERN enum MHD_Bool
MHD_connection_get_information_sz (struct MHD_Connection *connection,
- enum MHD_ConnectionInformationType info_type,
- union MHD_ConnectionInformation
*return_value,
- size_t return_value_size);
+ enum MHD_ConnectionInformationType info_type,
+ union MHD_ConnectionInformation *return_value,
+ size_t return_value_size);
/**
@@ -2205,9 +2205,9 @@ enum MHD_RequestInformationType
*/
_MHD_EXTERN enum MHD_Bool
MHD_request_get_information_sz (struct MHD_Request *request,
- enum MHD_RequestInformationType info_type,
- union MHD_RequestInformation *return_value,
- size_t return_value_size);
+ enum MHD_RequestInformationType info_type,
+ union MHD_RequestInformation *return_value,
+ size_t return_value_size);
/**
@@ -2311,9 +2311,9 @@ union MHD_DaemonInformation
*/
_MHD_EXTERN enum MHD_Bool
MHD_daemon_get_information_sz (struct MHD_Daemon *daemon,
- enum MHD_DaemonInformationType info_type,
- union MHD_DaemonInformation *return_value,
- size_t return_value_size);
+ enum MHD_DaemonInformationType info_type,
+ union MHD_DaemonInformation *return_value,
+ size_t return_value_size);
/**
* Obtain information about the given daemon.
@@ -2329,4 +2329,4 @@ MHD_daemon_get_information_sz (struct MHD_Daemon *daemon,
#define MHD_daemon_get_information(daemon, \
info_type, \
return_value) \
- MHD_daemon_get_information_sz((daemon), (info_type), (return_value),
sizeof(union MHD_DaemonInformation));
+ MHD_daemon_get_information_sz((daemon), (info_type), (return_value),
sizeof(union MHD_DaemonInformation));
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index 4cb671e4..4906e627 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -31,7 +31,7 @@
/**
* Beginning string for any valid Basic authentication header.
*/
-#define _BASIC_BASE "Basic "
+#define _BASIC_BASE "Basic "
/**
@@ -40,12 +40,12 @@
* @param connection The MHD connection structure
* @param password a pointer for the password
* @return NULL if no username could be found, a pointer
- * to the username if found
+ * to the username if found
* @ingroup authentication
*/
char *
MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
- char** password)
+ char** password)
{
const char *header;
char *decode;
@@ -53,8 +53,8 @@ MHD_basic_auth_get_username_password (struct MHD_Connection
*connection,
char *user;
if ( (NULL == (header = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
-
MHD_HTTP_HEADER_AUTHORIZATION))) ||
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_AUTHORIZATION))) ||
(0 != strncmp (header,
_BASIC_BASE,
MHD_STATICSTR_LEN_ (_BASIC_BASE))) )
@@ -64,7 +64,7 @@ MHD_basic_auth_get_username_password (struct MHD_Connection
*connection,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
- _("Error decoding basic authentication\n"));
+ _("Error decoding basic authentication\n"));
#endif
return NULL;
}
@@ -74,7 +74,7 @@ MHD_basic_auth_get_username_password (struct MHD_Connection
*connection,
{
#ifdef HAVE_MESSAGES
MHD_DLOG(connection->daemon,
- _("Basic authentication doesn't contain ':' separator\n"));
+ _("Basic authentication doesn't contain ':' separator\n"));
#endif
free (decode);
return NULL;
@@ -89,15 +89,15 @@ MHD_basic_auth_get_username_password (struct MHD_Connection
*connection,
{
*password = strdup (separator + 1);
if (NULL == *password)
- {
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG(connection->daemon,
- _("Failed to allocate memory for password\n"));
+ MHD_DLOG(connection->daemon,
+ _("Failed to allocate memory for password\n"));
#endif
- free (decode);
- free (user);
- return NULL;
- }
+ free (decode);
+ free (user);
+ return NULL;
+ }
}
free (decode);
return user;
@@ -118,8 +118,8 @@ MHD_basic_auth_get_username_password (struct MHD_Connection
*connection,
*/
int
MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
- const char *realm,
- struct MHD_Response *response)
+ const char *realm,
+ struct MHD_Response *response)
{
int ret;
int res;
@@ -131,7 +131,7 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection
*connection,
{
#ifdef HAVE_MESSAGES
MHD_DLOG(connection->daemon,
- "Failed to allocate memory for auth header\n");
+ "Failed to allocate memory for auth header\n");
#endif /* HAVE_MESSAGES */
return MHD_NO;
}
@@ -149,8 +149,8 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection
*connection,
free(header);
if (MHD_YES == ret)
ret = MHD_queue_response (connection,
- MHD_HTTP_UNAUTHORIZED,
- response);
+ MHD_HTTP_UNAUTHORIZED,
+ response);
else
{
#ifdef HAVE_MESSAGES
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index a85e56ef..98ea8918 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -711,13 +711,13 @@ MHD_get_connection_values (struct MHD_Connection
*connection,
for (pos = connection->headers_received; NULL != pos; pos = pos->next)
if (0 != (pos->kind & kind))
{
- ret++;
- if ( (NULL != iterator) &&
+ ret++;
+ if ( (NULL != iterator) &&
(MHD_YES != iterator (iterator_cls,
pos->kind,
pos->header,
pos->value)) )
- return ret;
+ return ret;
}
return ret;
}
@@ -801,9 +801,9 @@ MHD_lookup_connection_value (struct MHD_Connection
*connection,
return NULL;
for (pos = connection->headers_received; NULL != pos; pos = pos->next)
if ((0 != (pos->kind & kind)) &&
- ( (key == pos->header) ||
- ( (NULL != pos->header) &&
- (NULL != key) &&
+ ( (key == pos->header) ||
+ ( (NULL != pos->header) &&
+ (NULL != key) &&
(MHD_str_equal_caseless_(key,
pos->header)))))
return pos->value;
@@ -875,16 +875,16 @@ need_100_continue (struct MHD_Connection *connection)
const char *expect;
return ( (NULL == connection->response) &&
- (NULL != connection->version) &&
+ (NULL != connection->version) &&
(MHD_str_equal_caseless_(connection->version,
- MHD_HTTP_VERSION_1_1)) &&
- (NULL != (expect = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
-
MHD_HTTP_HEADER_EXPECT))) &&
- (MHD_str_equal_caseless_(expect,
+ MHD_HTTP_VERSION_1_1)) &&
+ (NULL != (expect = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_EXPECT))) &&
+ (MHD_str_equal_caseless_(expect,
"100-continue")) &&
- (connection->continue_message_write_offset <
- MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE)) );
+ (connection->continue_message_write_offset <
+ MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE)) );
}
@@ -948,9 +948,9 @@ MHD_connection_close_ (struct MHD_Connection *connection,
if ( (NULL != daemon->notify_completed) &&
(connection->client_aware) )
daemon->notify_completed (daemon->notify_completed_cls,
- connection,
- &connection->client_context,
- termination_code);
+ connection,
+ &connection->client_context,
+ termination_code);
connection->client_aware = false;
}
@@ -991,8 +991,8 @@ MHD_connection_finish_forward_ (struct MHD_Connection
*connection)
if (urh->in_eready_list)
{
EDLL_remove (daemon->eready_urh_head,
- daemon->eready_urh_tail,
- urh);
+ daemon->eready_urh_tail,
+ urh);
urh->in_eready_list = false;
}
#endif /* EPOLL_SUPPORT */
@@ -1030,7 +1030,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection
*connection)
*/
static void
connection_close_error (struct MHD_Connection *connection,
- const char *emsg)
+ const char *emsg)
{
#ifdef HAVE_MESSAGES
if (NULL != emsg)
@@ -1080,9 +1080,9 @@ try_ready_normal_body (struct MHD_Connection *connection)
(connection->response_write_position == response->total_size) )
return MHD_YES; /* 0-byte response is always ready */
if ( (response->data_start <=
- connection->response_write_position) &&
+ connection->response_write_position) &&
(response->data_size + response->data_start >
- connection->response_write_position) )
+ connection->response_write_position) )
return MHD_YES; /* response already ready */
#if defined(_MHD_HAVE_SENDFILE)
if (MHD_resp_sender_sendfile == connection->resp_sender)
@@ -1105,11 +1105,11 @@ try_ready_normal_body (struct MHD_Connection
*connection)
response->total_size = connection->response_write_position;
MHD_mutex_unlock_chk_ (&response->mutex);
if ( ((ssize_t)MHD_CONTENT_READER_END_OF_STREAM) == ret)
- MHD_connection_close_ (connection,
+ MHD_connection_close_ (connection,
MHD_REQUEST_TERMINATED_COMPLETED_OK);
else
- CONNECTION_CLOSE_ERROR (connection,
- _("Closing connection (application reported
error generating data)\n"));
+ CONNECTION_CLOSE_ERROR (connection,
+ _("Closing connection (application reported error generating
data)\n"));
return MHD_NO;
}
response->data_start = connection->response_write_position;
@@ -1157,7 +1157,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
{
/* not enough memory */
CONNECTION_CLOSE_ERROR (connection,
- _("Closing connection (out of
memory)\n"));
+ _("Closing connection (out of memory)\n"));
return MHD_NO;
}
buf = MHD_pool_allocate (connection->pool,
@@ -1172,9 +1172,9 @@ try_ready_chunked_body (struct MHD_Connection *connection)
if (0 == response->total_size)
ret = 0; /* response must be empty, don't bother calling crc */
else if ( (response->data_start <=
- connection->response_write_position) &&
+ connection->response_write_position) &&
(response->data_start + response->data_size >
- connection->response_write_position) )
+ connection->response_write_position) )
{
/* difference between response_write_position and data_start is less
than data_size which is size_t type, no need to check for overflow */
@@ -1183,7 +1183,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
/* 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 )
- 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],
ret);
@@ -1201,7 +1201,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
/* error, close socket! */
response->total_size = connection->response_write_position;
CONNECTION_CLOSE_ERROR (connection,
- _("Closing connection (application error
generating response)\n"));
+ _("Closing connection (application error generating response)\n"));
return MHD_NO;
}
if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) ||
@@ -1306,7 +1306,7 @@ keepalive_possible (struct MHD_Connection *connection)
*/
static void
get_date_string (char *date,
- size_t date_len)
+ size_t date_len)
{
static const char *const days[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
@@ -1342,15 +1342,15 @@ get_date_string (char *date,
now = *pNow;
#endif
MHD_snprintf_ (date,
- date_len,
- "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n",
- days[now.tm_wday % 7],
- (unsigned int) now.tm_mday,
- mons[now.tm_mon % 12],
- (unsigned int) (1900 + now.tm_year),
- (unsigned int) now.tm_hour,
- (unsigned int) now.tm_min,
- (unsigned int) now.tm_sec);
+ date_len,
+ "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n",
+ days[now.tm_wday % 7],
+ (unsigned int) now.tm_mday,
+ mons[now.tm_mon % 12],
+ (unsigned int) (1900 + now.tm_year),
+ (unsigned int) now.tm_hour,
+ (unsigned int) now.tm_min,
+ (unsigned int) now.tm_sec);
}
@@ -1437,25 +1437,25 @@ build_header_response (struct MHD_Connection
*connection)
{
reason_phrase = MHD_get_reason_phrase_for (rc);
MHD_snprintf_ (code,
- sizeof (code),
- "%s %u %s\r\n",
- (0 != (connection->responseCode & MHD_ICY_FLAG))
- ? "ICY"
- : ( (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_0,
- connection->version))
- ? MHD_HTTP_VERSION_1_0
- : MHD_HTTP_VERSION_1_1),
- rc,
- reason_phrase);
+ sizeof (code),
+ "%s %u %s\r\n",
+ (0 != (connection->responseCode & MHD_ICY_FLAG))
+ ? "ICY"
+ : ( (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_0,
+ connection->version))
+ ? MHD_HTTP_VERSION_1_0
+ : MHD_HTTP_VERSION_1_1),
+ rc,
+ reason_phrase);
off = strlen (code);
/* estimate size */
size = off + 2; /* +2 for extra "\r\n" at the end */
kind = MHD_HEADER_KIND;
if ( (0 == (connection->daemon->options &
MHD_USE_SUPPRESS_DATE_NO_CLOCK)) &&
- (NULL == MHD_get_response_header (connection->response,
- MHD_HTTP_HEADER_DATE)) )
+ (NULL == MHD_get_response_header (connection->response,
+ MHD_HTTP_HEADER_DATE)) )
get_date_string (date,
- sizeof (date));
+ sizeof (date));
else
date[0] = '\0';
size += strlen (date);
@@ -1587,9 +1587,9 @@ build_header_response (struct MHD_Connection *connection)
*/
content_length_len
= MHD_snprintf_ (content_length_buf,
- sizeof (content_length_buf),
- MHD_HTTP_HEADER_CONTENT_LENGTH ": "
MHD_UNSIGNED_LONG_LONG_PRINTF "\r\n",
- (MHD_UNSIGNED_LONG_LONG)
connection->response->total_size);
+ sizeof (content_length_buf),
+ MHD_HTTP_HEADER_CONTENT_LENGTH ": " MHD_UNSIGNED_LONG_LONG_PRINTF
"\r\n",
+ (MHD_UNSIGNED_LONG_LONG) connection->response->total_size);
must_add_content_length = MHD_YES;
}
@@ -1689,7 +1689,7 @@ build_header_response (struct MHD_Connection *connection)
/* we must add the 'Content-Length' header */
memcpy (&data[off],
content_length_buf,
- content_length_len);
+ content_length_len);
off += content_length_len;
}
for (pos = connection->response->first_header; NULL != pos; pos = pos->next)
@@ -1744,14 +1744,14 @@ build_header_response (struct MHD_Connection
*connection)
static void
transmit_error_response (struct MHD_Connection *connection,
unsigned int status_code,
- const char *message)
+ const char *message)
{
struct MHD_Response *response;
if (NULL == connection->version)
{
/* we were unable to process the full header line, so we don't
- really know what version the client speaks; assume 1.0 */
+ really know what version the client speaks; assume 1.0 */
connection->version = MHD_HTTP_VERSION_1_0;
}
connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
@@ -1768,8 +1768,8 @@ transmit_error_response (struct MHD_Connection
*connection,
connection->response = NULL;
}
response = MHD_create_response_from_buffer (strlen (message),
- (void *) message,
- MHD_RESPMEM_PERSISTENT);
+ (void *) message,
+ MHD_RESPMEM_PERSISTENT);
MHD_queue_response (connection,
status_code,
response);
@@ -1781,7 +1781,7 @@ transmit_error_response (struct MHD_Connection
*connection,
{
/* oops - close! */
CONNECTION_CLOSE_ERROR (connection,
- _("Closing connection (failed to create response
header)\n"));
+ _("Closing connection (failed to create response header)\n"));
}
else
{
@@ -1839,7 +1839,7 @@ MHD_connection_update_event_loop_info (struct
MHD_Connection *connection)
/* while reading headers, we always grow the
read buffer if needed, no size-check required */
if ( (connection->read_buffer_offset ==
connection->read_buffer_size) &&
- (MHD_NO == try_grow_read_buffer (connection)) )
+ (MHD_NO == try_grow_read_buffer (connection)) )
{
transmit_error_response (connection,
(connection->url != NULL)
@@ -1848,10 +1848,10 @@ MHD_connection_update_event_loop_info (struct
MHD_Connection *connection)
REQUEST_TOO_BIG);
continue;
}
- if (! connection->read_closed)
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
- else
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
+ if (! connection->read_closed)
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
+ else
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
break;
case MHD_CONNECTION_HEADERS_RECEIVED:
mhd_assert (0);
@@ -1887,10 +1887,10 @@ MHD_connection_update_event_loop_info (struct
MHD_Connection *connection)
}
}
if ( (connection->read_buffer_offset < connection->read_buffer_size)
&&
- (! connection->read_closed) )
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
- else
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
+ (! connection->read_closed) )
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
+ else
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
break;
case MHD_CONNECTION_BODY_RECEIVED:
case MHD_CONNECTION_FOOTER_PART_RECEIVED:
@@ -1898,47 +1898,47 @@ MHD_connection_update_event_loop_info (struct
MHD_Connection *connection)
read buffer if needed, no size-check required */
if (connection->read_closed)
{
- CONNECTION_CLOSE_ERROR (connection,
- NULL);
+ CONNECTION_CLOSE_ERROR (connection,
+ NULL);
continue;
}
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
/* transition to FOOTERS_RECEIVED
happens in read handler */
break;
case MHD_CONNECTION_FOOTERS_RECEIVED:
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
break;
case MHD_CONNECTION_HEADERS_SENDING:
/* headers in buffer, keep writing */
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
break;
case MHD_CONNECTION_HEADERS_SENT:
mhd_assert (0);
break;
case MHD_CONNECTION_NORMAL_BODY_READY:
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
break;
case MHD_CONNECTION_NORMAL_BODY_UNREADY:
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
break;
case MHD_CONNECTION_CHUNKED_BODY_READY:
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
break;
case MHD_CONNECTION_CHUNKED_BODY_UNREADY:
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
break;
case MHD_CONNECTION_BODY_SENT:
mhd_assert (0);
break;
case MHD_CONNECTION_FOOTERS_SENDING:
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
break;
case MHD_CONNECTION_FOOTERS_SENT:
mhd_assert (0);
break;
case MHD_CONNECTION_CLOSED:
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP;
return; /* do nothing, not even reading */
case MHD_CONNECTION_IN_CLEANUP:
mhd_assert (0);
@@ -1989,15 +1989,15 @@ get_next_header_line (struct MHD_Connection *connection,
{
/* not found, consider growing... */
if ( (connection->read_buffer_offset == connection->read_buffer_size) &&
- (MHD_NO ==
- try_grow_read_buffer (connection)) )
- {
- transmit_error_response (connection,
- (NULL != connection->url)
- ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
- : MHD_HTTP_URI_TOO_LONG,
- REQUEST_TOO_BIG);
- }
+ (MHD_NO ==
+ try_grow_read_buffer (connection)) )
+ {
+ transmit_error_response (connection,
+ (NULL != connection->url)
+ ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
+ : MHD_HTTP_URI_TOO_LONG,
+ REQUEST_TOO_BIG);
+ }
if (line_len)
*line_len = 0;
return NULL;
@@ -2031,14 +2031,14 @@ get_next_header_line (struct MHD_Connection *connection,
static int
connection_add_header (struct MHD_Connection *connection,
const char *key,
- const char *value,
- enum MHD_ValueKind kind)
+ const char *value,
+ enum MHD_ValueKind kind)
{
if (MHD_NO ==
MHD_set_connection_value (connection,
- kind,
- key,
- value))
+ kind,
+ key,
+ value))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
@@ -2073,8 +2073,8 @@ parse_cookie_header (struct MHD_Connection *connection)
int quotes;
hdr = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_COOKIE);
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_COOKIE);
if (NULL == hdr)
return MHD_YES;
cpy = MHD_pool_allocate (connection->pool,
@@ -2154,10 +2154,10 @@ parse_cookie_header (struct MHD_Connection *connection)
equals++;
}
if (MHD_NO ==
- connection_add_header (connection,
- pos,
- equals,
- MHD_COOKIE_KIND))
+ connection_add_header (connection,
+ pos,
+ equals,
+ MHD_COOKIE_KIND))
return MHD_NO;
pos = semicolon;
}
@@ -2238,7 +2238,7 @@ parse_initial_message_line (struct MHD_Connection
*connection,
connection->client_aware = true;
connection->client_context
= daemon->uri_log_callback (daemon->uri_log_callback_cls,
- curi,
+ curi,
connection);
}
if (NULL != args)
@@ -2247,10 +2247,10 @@ parse_initial_message_line (struct MHD_Connection
*connection,
args++;
/* note that this call clobbers 'args' */
MHD_parse_arguments_ (connection,
- MHD_GET_ARGUMENT_KIND,
- args,
- &connection_add_header,
- &unused_num_headers);
+ MHD_GET_ARGUMENT_KIND,
+ args,
+ &connection_add_header,
+ &unused_num_headers);
}
if (NULL != uri)
daemon->unescape_callback (daemon->unescape_callback_cls,
@@ -2279,17 +2279,17 @@ call_connection_handler (struct MHD_Connection
*connection)
connection->client_aware = true;
if (MHD_NO ==
connection->daemon->default_handler
(connection->daemon->default_handler_cls,
- connection,
+ connection,
connection->url,
- connection->method,
- connection->version,
- NULL,
+ connection->method,
+ connection->version,
+ NULL,
&processed,
- &connection->client_context))
+ &connection->client_context))
{
/* serious internal error, close connection */
CONNECTION_CLOSE_ERROR (connection,
- _("Application reported internal error, closing
connection.\n"));
+ _("Application reported internal error, closing connection.\n"));
return;
}
}
@@ -2342,7 +2342,7 @@ process_request_body (struct MHD_Connection *connection)
{
/* malformed encoding */
CONNECTION_CLOSE_ERROR (connection,
- _("Received malformed HTTP request
(bad chunked encoding). Closing connection.\n"));
+ _("Received malformed HTTP request (bad chunked encoding). Closing
connection.\n"));
return;
}
available -= i;
@@ -2380,24 +2380,24 @@ process_request_body (struct MHD_Connection *connection)
{
if ( ('\r' == buffer_head[i]) ||
('\n' == buffer_head[i]) ||
- (';' == buffer_head[i]) )
+ (';' == buffer_head[i]) )
break;
i++;
if (i >= 16)
break;
}
- end_size = i;
- /* find beginning of CRLF (skip over chunk extensions) */
- if (';' == buffer_head[i])
- {
- while (i < available)
- {
- if ( ('\r' == buffer_head[i]) ||
- ('\n' == buffer_head[i]) )
- break;
- i++;
- }
- }
+ end_size = i;
+ /* find beginning of CRLF (skip over chunk extensions) */
+ if (';' == buffer_head[i])
+ {
+ while (i < available)
+ {
+ if ( ('\r' == buffer_head[i]) ||
+ ('\n' == buffer_head[i]) )
+ break;
+ i++;
+ }
+ }
/* take '\n' into account; if '\n' is the unavailable
character, we will need to wait until we have it
before going further */
@@ -2406,23 +2406,23 @@ process_request_body (struct MHD_Connection *connection)
(2 == available) &&
('0' == buffer_head[0]) ) )
break; /* need more data... */
- i++;
+ i++;
malformed = (end_size >= 16);
if (! malformed)
{
size_t num_dig = MHD_strx_to_uint64_n_ (buffer_head,
- end_size,
-
&connection->current_chunk_size);
+ end_size,
+ &connection->current_chunk_size);
malformed = (end_size != num_dig);
}
if (malformed)
{
/* malformed encoding */
CONNECTION_CLOSE_ERROR (connection,
- _("Received malformed HTTP request
(bad chunked encoding). Closing connection.\n"));
+ _("Received malformed HTTP request (bad chunked encoding). Closing
connection.\n"));
return;
}
- /* skip 2nd part of line feed */
+ /* skip 2nd part of line feed */
if ( (i < available) &&
( ('\r' == buffer_head[i]) ||
('\n' == buffer_head[i]) ) )
@@ -2446,19 +2446,19 @@ process_request_body (struct MHD_Connection *connection)
{
/* no chunked encoding, give all to the client */
if ( (0 != connection->remaining_upload_size) &&
- (MHD_SIZE_UNKNOWN != connection->remaining_upload_size) &&
- (connection->remaining_upload_size < available) )
- {
+ (MHD_SIZE_UNKNOWN != connection->remaining_upload_size) &&
+ (connection->remaining_upload_size < available) )
+ {
to_be_processed = (size_t)connection->remaining_upload_size;
- }
+ }
else
- {
+ {
/**
* 1. no chunked encoding, give all to the client
* 2. client may send large chunked data, but only a smaller
part is available at one time.
*/
to_be_processed = available;
- }
+ }
}
left_unprocessed = to_be_processed;
connection->client_aware = true;
@@ -2482,24 +2482,24 @@ process_request_body (struct MHD_Connection *connection)
__FILE__,
__LINE__
#ifdef HAVE_MESSAGES
- , _("libmicrohttpd API violation")
+ , _("libmicrohttpd API violation")
#else
- , NULL
+ , NULL
#endif
- );
+ );
if (0 != left_unprocessed)
- {
- instant_retry = MHD_NO; /* client did not process everything */
+ {
+ instant_retry = MHD_NO; /* client did not process everything */
#ifdef HAVE_MESSAGES
- /* client did not process all upload data, complain if
- the setup was incorrect, which may prevent us from
- handling the rest of the request */
- if ( (0 != (connection->daemon->options &
MHD_USE_INTERNAL_POLLING_THREAD)) &&
- (! connection->suspended) )
- MHD_DLOG (connection->daemon,
- _("WARNING: incomplete upload processing and connection
not suspended may result in hung connection.\n"));
+ /* client did not process all upload data, complain if
+ the setup was incorrect, which may prevent us from
+ handling the rest of the request */
+ if ( (0 != (connection->daemon->options &
MHD_USE_INTERNAL_POLLING_THREAD)) &&
+ (! connection->suspended) )
+ MHD_DLOG (connection->daemon,
+ _("WARNING: incomplete upload processing and connection not
suspended may result in hung connection.\n"));
#endif
- }
+ }
processed_size = to_be_processed - left_unprocessed;
if (connection->have_chunked_upload)
connection->current_chunk_offset += processed_size;
@@ -2537,7 +2537,7 @@ check_write_done (struct MHD_Connection *connection,
connection->write_buffer_send_offset = 0;
connection->state = next_state;
MHD_pool_reallocate (connection->pool,
- connection->write_buffer,
+ connection->write_buffer,
connection->write_buffer_size,
0);
connection->write_buffer = NULL;
@@ -2567,24 +2567,24 @@ process_header_line (struct MHD_Connection *connection,
{
/* error in header line, die hard */
CONNECTION_CLOSE_ERROR (connection,
- _("Received malformed line (no colon). Closing
connection.\n"));
+ _("Received malformed line (no colon). Closing connection.\n"));
return MHD_NO;
}
if (-1 >= connection->daemon->strict_for_client)
{
/* check for whitespace before colon, which is not allowed
- by RFC 7230 section 3.2.4; we count space ' ' and
- tab '\t', but not '\r\n' as those would have ended the line. */
+ by RFC 7230 section 3.2.4; we count space ' ' and
+ tab '\t', but not '\r\n' as those would have ended the line. */
const char *white;
white = strchr (line, ' ');
if ( (NULL != white) &&
- (white < colon) )
- return MHD_NO;
+ (white < colon) )
+ return MHD_NO;
white = strchr (line, '\t');
if ( (NULL != white) &&
- (white < colon) )
- return MHD_NO;
+ (white < colon) )
+ return MHD_NO;
}
/* zero-terminate header */
colon[0] = '\0';
@@ -2638,14 +2638,14 @@ process_broken_line (struct MHD_Connection *connection,
tmp++;
tmp_len = strlen (tmp);
/* FIXME: we might be able to do this better (faster!), as most
- likely 'last' and 'line' should already be adjacent in
- memory; however, doing this right gets tricky if we have a
- value continued over multiple lines (in which case we need to
- record how often we have done this so we can check for
- 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. */
+ likely 'last' and 'line' should already be adjacent in
+ memory; however, doing this right gets tricky if we have a
+ value continued over multiple lines (in which case we need to
+ record how often we have done this so we can check for
+ 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,
last,
last_len + 1,
@@ -2665,8 +2665,8 @@ process_broken_line (struct MHD_Connection *connection,
(NULL != connection->colon) );
if ((MHD_NO == connection_add_header (connection,
last,
- connection->colon,
- kind)))
+ connection->colon,
+ kind)))
{
transmit_error_response (connection,
MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
@@ -2724,8 +2724,8 @@ parse_connection_headers (struct MHD_Connection
*connection)
mhd_assert (NULL == connection->response);
response =
MHD_create_response_from_buffer (MHD_STATICSTR_LEN_
(REQUEST_LACKS_HOST),
- REQUEST_LACKS_HOST,
- MHD_RESPMEM_PERSISTENT);
+ REQUEST_LACKS_HOST,
+ MHD_RESPMEM_PERSISTENT);
MHD_queue_response (connection,
MHD_HTTP_BAD_REQUEST,
response);
@@ -2735,8 +2735,8 @@ parse_connection_headers (struct MHD_Connection
*connection)
connection->remaining_upload_size = 0;
enc = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_TRANSFER_ENCODING);
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_TRANSFER_ENCODING);
if (NULL != enc)
{
connection->remaining_upload_size = MHD_SIZE_UNKNOWN;
@@ -2747,8 +2747,8 @@ parse_connection_headers (struct MHD_Connection
*connection)
else
{
clen = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_CONTENT_LENGTH);
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_CONTENT_LENGTH);
if (NULL != clen)
{
end = clen + MHD_str_to_uint64_ (clen,
@@ -2761,7 +2761,7 @@ parse_connection_headers (struct MHD_Connection
*connection)
MHD_DLOG (connection->daemon,
"Failed to parse `Content-Length' header. Closing
connection.\n");
#endif
- CONNECTION_CLOSE_ERROR (connection,
+ CONNECTION_CLOSE_ERROR (connection,
NULL);
return;
}
@@ -2798,11 +2798,11 @@ MHD_update_last_activity_ (struct MHD_Connection
*connection)
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
/* move connection to head of timeout list (by remove + add operation) */
XDLL_remove (daemon->normal_timeout_head,
- daemon->normal_timeout_tail,
- connection);
+ daemon->normal_timeout_tail,
+ connection);
XDLL_insert (daemon->normal_timeout_head,
- daemon->normal_timeout_tail,
- connection);
+ daemon->normal_timeout_tail,
+ connection);
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
}
@@ -3201,8 +3201,8 @@ cleanup_connection (struct MHD_Connection *connection)
connection);
}
DLL_insert (daemon->cleanup_head,
- daemon->cleanup_tail,
- connection);
+ daemon->cleanup_tail,
+ connection);
connection->resuming = false;
connection->in_idle = false;
MHD_mutex_unlock_chk_(&daemon->cleanup_connection_mutex);
@@ -3274,8 +3274,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
continue;
if (connection->read_closed)
{
- CONNECTION_CLOSE_ERROR (connection,
- NULL);
+ CONNECTION_CLOSE_ERROR (connection,
+ NULL);
continue;
}
break;
@@ -3297,8 +3297,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
continue;
if (connection->read_closed)
{
- CONNECTION_CLOSE_ERROR (connection,
- NULL);
+ CONNECTION_CLOSE_ERROR (connection,
+ NULL);
continue;
}
break;
@@ -3328,8 +3328,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
continue;
if (connection->read_closed)
{
- CONNECTION_CLOSE_ERROR (connection,
- NULL);
+ CONNECTION_CLOSE_ERROR (connection,
+ NULL);
continue;
}
break;
@@ -3369,9 +3369,9 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
break;
}
if ( (NULL != connection->response) &&
- ( (MHD_str_equal_caseless_ (connection->method,
+ ( (MHD_str_equal_caseless_ (connection->method,
MHD_HTTP_METHOD_POST)) ||
- (MHD_str_equal_caseless_ (connection->method,
+ (MHD_str_equal_caseless_ (connection->method,
MHD_HTTP_METHOD_PUT))) )
{
/* we refused (no upload allowed!) */
@@ -3428,8 +3428,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
continue;
if (connection->read_closed)
{
- CONNECTION_CLOSE_ERROR (connection,
- NULL);
+ CONNECTION_CLOSE_ERROR (connection,
+ NULL);
continue;
}
break;
@@ -3460,8 +3460,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
continue;
if (connection->read_closed)
{
- CONNECTION_CLOSE_ERROR (connection,
- NULL);
+ CONNECTION_CLOSE_ERROR (connection,
+ NULL);
continue;
}
break;
@@ -3488,8 +3488,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
if (MHD_NO == build_header_response (connection))
{
/* oops - close! */
- CONNECTION_CLOSE_ERROR (connection,
- _("Closing connection (failed to create
response header)\n"));
+ CONNECTION_CLOSE_ERROR (connection,
+ _("Closing connection (failed to create response header)\n"));
continue;
}
connection->state = MHD_CONNECTION_HEADERS_SENDING;
@@ -3557,8 +3557,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
}
if (MHD_YES == try_ready_normal_body (connection))
{
- if (NULL != connection->response->crc)
- MHD_mutex_unlock_chk_ (&connection->response->mutex);
+ if (NULL != connection->response->crc)
+ MHD_mutex_unlock_chk_ (&connection->response->mutex);
connection->state = MHD_CONNECTION_NORMAL_BODY_READY;
/* Buffering for flushable socket was already enabled*/
if (MHD_NO == socket_flush_possible (connection))
@@ -3599,8 +3599,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
if (MHD_NO == build_header_response (connection))
{
/* oops - close! */
- CONNECTION_CLOSE_ERROR (connection,
- _("Closing connection (failed to create
response header)\n"));
+ CONNECTION_CLOSE_ERROR (connection,
+ _("Closing connection (failed to create response header)\n"));
continue;
}
if ( (! connection->have_chunked_upload) ||
@@ -3614,15 +3614,15 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
/* no default action */
break;
case MHD_CONNECTION_FOOTERS_SENT:
- if (MHD_HTTP_PROCESSING == connection->responseCode)
- {
- /* After this type of response, we allow sending another! */
- connection->state = MHD_CONNECTION_HEADERS_PROCESSED;
- MHD_destroy_response (connection->response);
- connection->response = NULL;
- /* FIXME: maybe partially reset memory pool? */
- continue;
- }
+ if (MHD_HTTP_PROCESSING == connection->responseCode)
+ {
+ /* After this type of response, we allow sending another! */
+ connection->state = MHD_CONNECTION_HEADERS_PROCESSED;
+ MHD_destroy_response (connection->response);
+ connection->response = NULL;
+ /* FIXME: maybe partially reset memory pool? */
+ continue;
+ }
if (MHD_NO != socket_flush_possible (connection))
socket_start_no_buffering_flush (connection);
else
@@ -3634,10 +3634,10 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
(connection->client_aware) )
{
connection->client_aware = false;
- daemon->notify_completed (daemon->notify_completed_cls,
- connection,
- &connection->client_context,
- MHD_REQUEST_TERMINATED_COMPLETED_OK);
+ daemon->notify_completed (daemon->notify_completed_cls,
+ connection,
+ &connection->client_context,
+ MHD_REQUEST_TERMINATED_COMPLETED_OK);
}
if ( (MHD_CONN_USE_KEEPALIVE != connection->keepalive) ||
(connection->read_closed) )
@@ -3672,12 +3672,12 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
connection->read_buffer_size
= connection->daemon->pool_size / 2;
}
- connection->client_aware = false;
+ connection->client_aware = false;
connection->client_context = NULL;
connection->continue_message_write_offset = 0;
connection->responseCode = 0;
connection->headers_received = NULL;
- connection->headers_received_tail = NULL;
+ connection->headers_received_tail = NULL;
connection->response_write_position = 0;
connection->have_chunked_upload = false;
connection->current_chunk_size = 0;
@@ -3690,11 +3690,11 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
connection->write_buffer_append_offset = 0;
continue;
case MHD_CONNECTION_CLOSED:
- cleanup_connection (connection);
+ cleanup_connection (connection);
connection->in_idle = false;
- return MHD_NO;
+ return MHD_NO;
#ifdef UPGRADE_SUPPORT
- case MHD_CONNECTION_UPGRADE:
+ case MHD_CONNECTION_UPGRADE:
connection->in_idle = false;
return MHD_YES; /* keep open */
#endif /* UPGRADE_SUPPORT */
@@ -3750,8 +3750,8 @@ MHD_connection_epoll_update_ (struct MHD_Connection
*connection)
(0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) &&
( ( (MHD_EVENT_LOOP_INFO_WRITE == connection->event_loop_info) &&
(0 == (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY))) ||
- ( (MHD_EVENT_LOOP_INFO_READ == connection->event_loop_info) &&
- (0 == (connection->epoll_state & MHD_EPOLL_STATE_READ_READY)) ) ) )
+ ( (MHD_EVENT_LOOP_INFO_READ == connection->event_loop_info) &&
+ (0 == (connection->epoll_state & MHD_EPOLL_STATE_READ_READY)) ) ) )
{
/* add to epoll set */
struct epoll_event event;
@@ -3759,20 +3759,20 @@ MHD_connection_epoll_update_ (struct MHD_Connection
*connection)
event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET;
event.data.ptr = connection;
if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_ADD,
- connection->socket_fd,
- &event))
- {
+ EPOLL_CTL_ADD,
+ connection->socket_fd,
+ &event))
+ {
#ifdef HAVE_MESSAGES
- if (0 != (daemon->options & MHD_USE_ERROR_LOG))
- MHD_DLOG (daemon,
- _("Call to epoll_ctl failed: %s\n"),
- MHD_socket_last_strerr_ ());
+ if (0 != (daemon->options & MHD_USE_ERROR_LOG))
+ MHD_DLOG (daemon,
+ _("Call to epoll_ctl failed: %s\n"),
+ MHD_socket_last_strerr_ ());
#endif
- connection->state = MHD_CONNECTION_CLOSED;
- cleanup_connection (connection);
- return MHD_NO;
- }
+ connection->state = MHD_CONNECTION_CLOSED;
+ cleanup_connection (connection);
+ return MHD_NO;
+ }
connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET;
}
return MHD_YES;
@@ -3813,17 +3813,17 @@ MHD_get_connection_info (struct MHD_Connection
*connection,
#ifdef HTTPS_SUPPORT
case MHD_CONNECTION_INFO_CIPHER_ALGO:
if (NULL == connection->tls_session)
- return NULL;
+ return NULL;
connection->cipher = gnutls_cipher_get (connection->tls_session);
return (const union MHD_ConnectionInfo *) &connection->cipher;
case MHD_CONNECTION_INFO_PROTOCOL:
if (NULL == connection->tls_session)
- return NULL;
+ return NULL;
connection->protocol = gnutls_protocol_get_version
(connection->tls_session);
return (const union MHD_ConnectionInfo *) &connection->protocol;
case MHD_CONNECTION_INFO_GNUTLS_SESSION:
if (NULL == connection->tls_session)
- return NULL;
+ return NULL;
return (const union MHD_ConnectionInfo *) &connection->tls_session;
#endif /* HTTPS_SUPPORT */
case MHD_CONNECTION_INFO_CLIENT_ADDRESS:
@@ -3863,8 +3863,8 @@ MHD_get_connection_info (struct MHD_Connection
*connection,
*/
int
MHD_set_connection_option (struct MHD_Connection *connection,
- enum MHD_CONNECTION_OPTION option,
- ...)
+ enum MHD_CONNECTION_OPTION option,
+ ...)
{
va_list ap;
struct MHD_Daemon *daemon;
@@ -3935,7 +3935,7 @@ MHD_queue_response (struct MHD_Connection *connection,
(NULL == response) ||
(NULL != connection->response) ||
( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) &&
- (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) )
+ (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) )
return MHD_NO;
daemon = connection->daemon;
@@ -4000,7 +4000,7 @@ MHD_queue_response (struct MHD_Connection *connection,
(NULL != connection->method) &&
( (MHD_str_equal_caseless_ (connection->method,
MHD_HTTP_METHOD_POST)) ||
- (MHD_str_equal_caseless_ (connection->method,
+ (MHD_str_equal_caseless_ (connection->method,
MHD_HTTP_METHOD_PUT))) )
{
/* response was queued "early", refuse to read body / footers or
diff --git a/src/microhttpd/connection_https.c
b/src/microhttpd/connection_https.c
index 63623138..2d1f4844 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -154,24 +154,24 @@ MHD_run_tls_handshake_ (struct MHD_Connection *connection)
{
ret = gnutls_handshake (connection->tls_session);
if (ret == GNUTLS_E_SUCCESS)
- {
- /* set connection TLS state to enable HTTP processing */
- connection->tls_state = MHD_TLS_CONN_CONNECTED;
- MHD_update_last_activity_ (connection);
- return true;
- }
+ {
+ /* set connection TLS state to enable HTTP processing */
+ connection->tls_state = MHD_TLS_CONN_CONNECTED;
+ MHD_update_last_activity_ (connection);
+ return true;
+ }
if ( (GNUTLS_E_AGAIN == ret) ||
- (GNUTLS_E_INTERRUPTED == ret) )
- {
+ (GNUTLS_E_INTERRUPTED == ret) )
+ {
connection->tls_state = MHD_TLS_CONN_HANDSHAKING;
- /* handshake not done */
- return false;
- }
+ /* handshake not done */
+ return false;
+ }
/* handshake failed */
connection->tls_state = MHD_TLS_CONN_TLS_FAILED;
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
- _("Error: received handshake message out of context\n"));
+ _("Error: received handshake message out of context\n"));
#endif
MHD_connection_close_ (connection,
MHD_REQUEST_TERMINATED_WITH_ERROR);
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 56cd4538..e8e7e0e9 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -111,7 +111,7 @@ close_all_connections (struct MHD_Daemon *daemon);
*/
static int
MHD_epoll (struct MHD_Daemon *daemon,
- int may_block);
+ int may_block);
#endif /* EPOLL_SUPPORT */
@@ -126,15 +126,15 @@ MHD_epoll (struct MHD_Daemon *daemon,
*/
static void
mhd_panic_std (void *cls,
- const char *file,
- unsigned int line,
- const char *reason)
+ const char *file,
+ unsigned int line,
+ const char *reason)
{
(void)cls; /* Mute compiler warning. */
#ifdef HAVE_MESSAGES
fprintf (stderr,
_("Fatal error in GNU libmicrohttpd %s:%u: %s\n"),
- file,
+ file,
line,
reason);
#else /* ! HAVE_MESSAGES */
@@ -309,8 +309,8 @@ MHD_ip_addr_compare (const void *a1,
*/
static int
MHD_ip_addr_to_key (const struct sockaddr *addr,
- socklen_t addrlen,
- struct MHD_IPCount *key)
+ socklen_t addrlen,
+ struct MHD_IPCount *key)
{
memset(key,
0,
@@ -360,8 +360,8 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
*/
static int
MHD_ip_limit_add (struct MHD_Daemon *daemon,
- const struct sockaddr *addr,
- socklen_t addrlen)
+ const struct sockaddr *addr,
+ socklen_t addrlen)
{
struct MHD_IPCount *key;
void **nodep;
@@ -389,12 +389,12 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
/* Search for the IP address */
if (NULL == (nodep = tsearch (key,
- &daemon->per_ip_connection_count,
- &MHD_ip_addr_compare)))
+ &daemon->per_ip_connection_count,
+ &MHD_ip_addr_compare)))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Failed to add IP connection count node\n"));
+ _("Failed to add IP connection count node\n"));
#endif
MHD_ip_count_unlock (daemon);
free (key);
@@ -426,8 +426,8 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
*/
static void
MHD_ip_limit_del (struct MHD_Daemon *daemon,
- const struct sockaddr *addr,
- socklen_t addrlen)
+ const struct sockaddr *addr,
+ socklen_t addrlen)
{
struct MHD_IPCount search_key;
struct MHD_IPCount *found_key;
@@ -447,8 +447,8 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
/* Search for the IP address */
if (NULL == (nodep = tfind (&search_key,
- &daemon->per_ip_connection_count,
- &MHD_ip_addr_compare)))
+ &daemon->per_ip_connection_count,
+ &MHD_ip_addr_compare)))
{
/* Something's wrong if we couldn't find an IP address
* that was previously added */
@@ -464,8 +464,8 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
if (0 == --found_key->count)
{
tdelete (found_key,
- &daemon->per_ip_connection_count,
- &MHD_ip_addr_compare);
+ &daemon->per_ip_connection_count,
+ &MHD_ip_addr_compare);
free (found_key);
}
@@ -500,14 +500,14 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
cert.size = strlen (daemon->https_mem_trust);
if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred,
&cert,
- GNUTLS_X509_FMT_PEM) < 0)
- {
+ GNUTLS_X509_FMT_PEM) < 0)
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG(daemon,
- "Bad trust certificate format\n");
+ MHD_DLOG(daemon,
+ "Bad trust certificate format\n");
#endif
- return -1;
- }
+ return -1;
+ }
}
if (daemon->have_dhparams)
@@ -534,11 +534,11 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
0);
#else
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
+ MHD_DLOG (daemon,
_("Failed to setup x509 certificate/key: pre 3.X.X version "
\
"of GnuTLS does not support setting key password"));
#endif
- return -1;
+ return -1;
#endif
}
else
@@ -629,8 +629,8 @@ int
MHD_get_fdset (struct MHD_Daemon *daemon,
fd_set *read_fd_set,
fd_set *write_fd_set,
- fd_set *except_fd_set,
- MHD_socket *max_fd)
+ fd_set *except_fd_set,
+ MHD_socket *max_fd)
{
return MHD_get_fdset2 (daemon,
read_fd_set,
@@ -909,45 +909,45 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
posn = pos->prev;
switch (pos->event_loop_info)
- {
- case MHD_EVENT_LOOP_INFO_READ:
- if (! MHD_add_to_fd_set_ (pos->socket_fd,
+ {
+ case MHD_EVENT_LOOP_INFO_READ:
+ if (! MHD_add_to_fd_set_ (pos->socket_fd,
read_fd_set,
max_fd,
fd_setsize))
- result = MHD_NO;
+ result = MHD_NO;
#ifdef MHD_POSIX_SOCKETS
MHD_add_to_fd_set_ (pos->socket_fd,
except_fd_set,
max_fd,
fd_setsize);
#endif /* MHD_POSIX_SOCKETS */
- break;
- case MHD_EVENT_LOOP_INFO_WRITE:
- if (! MHD_add_to_fd_set_ (pos->socket_fd,
+ break;
+ case MHD_EVENT_LOOP_INFO_WRITE:
+ if (! MHD_add_to_fd_set_ (pos->socket_fd,
write_fd_set,
max_fd,
fd_setsize))
- result = MHD_NO;
+ result = MHD_NO;
#ifdef MHD_POSIX_SOCKETS
MHD_add_to_fd_set_ (pos->socket_fd,
except_fd_set,
max_fd,
fd_setsize);
#endif /* MHD_POSIX_SOCKETS */
- break;
- case MHD_EVENT_LOOP_INFO_BLOCK:
- if ( (NULL == except_fd_set) ||
- ! MHD_add_to_fd_set_ (pos->socket_fd,
- except_fd_set,
+ break;
+ case MHD_EVENT_LOOP_INFO_BLOCK:
+ if ( (NULL == except_fd_set) ||
+ ! MHD_add_to_fd_set_ (pos->socket_fd,
+ except_fd_set,
max_fd,
fd_setsize))
result = MHD_NO;
- break;
- case MHD_EVENT_LOOP_INFO_CLEANUP:
- /* this should never happen */
- break;
- }
+ break;
+ case MHD_EVENT_LOOP_INFO_CLEANUP:
+ /* this should never happen */
+ break;
+ }
}
#ifdef MHD_WINSOCK_SOCKETS
/* W32 use limited array for fd_set so add INFO_READ/INFO_WRITE sockets
@@ -1068,11 +1068,11 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
#endif
return internal_get_fdset2 (daemon,
- read_fd_set,
+ read_fd_set,
write_fd_set,
- except_fd_set,
+ except_fd_set,
max_fd,
- fd_setsize);
+ fd_setsize);
}
@@ -1107,7 +1107,7 @@ call_handlers (struct MHD_Connection *con,
if (!force_close)
{
if ( (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) &&
- read_ready)
+ read_ready)
{
MHD_connection_handle_read (con);
ret = MHD_connection_handle_idle (con);
@@ -1116,7 +1116,7 @@ call_handlers (struct MHD_Connection *con,
/* No need to check value of 'ret' here as closed connection
* cannot be in MHD_EVENT_LOOP_INFO_WRITE state. */
if ( (MHD_EVENT_LOOP_INFO_WRITE == con->event_loop_info) &&
- write_ready)
+ write_ready)
{
MHD_connection_handle_write (con);
ret = MHD_connection_handle_idle (con);
@@ -1763,7 +1763,7 @@ thread_main_handle_connection (void *data)
MHD_thread_init_(&(con->pid));
while ( (! daemon->shutdown) &&
- (MHD_CONNECTION_CLOSED != con->state) )
+ (MHD_CONNECTION_CLOSED != con->state) )
{
const time_t timeout = daemon->connection_timeout;
#ifdef UPGRADE_SUPPORT
@@ -1851,19 +1851,19 @@ thread_main_handle_connection (void *data)
(MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) )
#endif /* HTTPS_SUPPORT */
)
- {
- /* do not block: more data may be inside of TLS buffers waiting or
- * application must provide response data */
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- tvp = &tv;
- }
+ {
+ /* do not block: more data may be inside of TLS buffers waiting or
+ * application must provide response data */
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ tvp = &tv;
+ }
if ( (NULL == tvp) &&
(timeout > 0) )
- {
- now = MHD_monotonic_sec_counter();
- if (now - con->last_activity > timeout)
- tv.tv_sec = 0;
+ {
+ now = MHD_monotonic_sec_counter();
+ if (now - con->last_activity > timeout)
+ tv.tv_sec = 0;
else
{
const time_t seconds_left = timeout - (now - con->last_activity);
@@ -1876,45 +1876,45 @@ thread_main_handle_connection (void *data)
tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) seconds_left;
#endif /* _WIN32 && ! __CYGWIN__ */
}
- tv.tv_usec = 0;
- tvp = &tv;
- }
+ tv.tv_usec = 0;
+ tvp = &tv;
+ }
if (! use_poll)
- {
- /* use select */
- bool err_state = false;
+ {
+ /* use select */
+ bool err_state = false;
- FD_ZERO (&rs);
- FD_ZERO (&ws);
+ FD_ZERO (&rs);
+ FD_ZERO (&ws);
FD_ZERO (&es);
- maxsock = MHD_INVALID_SOCKET;
- switch (con->event_loop_info)
- {
- case MHD_EVENT_LOOP_INFO_READ:
- if (! MHD_add_to_fd_set_ (con->socket_fd,
+ maxsock = MHD_INVALID_SOCKET;
+ switch (con->event_loop_info)
+ {
+ case MHD_EVENT_LOOP_INFO_READ:
+ if (! MHD_add_to_fd_set_ (con->socket_fd,
&rs,
&maxsock,
FD_SETSIZE))
- err_state = true;
- break;
- case MHD_EVENT_LOOP_INFO_WRITE:
- if (! MHD_add_to_fd_set_ (con->socket_fd,
+ err_state = true;
+ break;
+ case MHD_EVENT_LOOP_INFO_WRITE:
+ if (! MHD_add_to_fd_set_ (con->socket_fd,
&ws,
&maxsock,
FD_SETSIZE))
err_state = true;
- break;
- case MHD_EVENT_LOOP_INFO_BLOCK:
- if (! MHD_add_to_fd_set_ (con->socket_fd,
+ break;
+ case MHD_EVENT_LOOP_INFO_BLOCK:
+ if (! MHD_add_to_fd_set_ (con->socket_fd,
&es,
&maxsock,
FD_SETSIZE))
- err_state = true;
- break;
- case MHD_EVENT_LOOP_INFO_CLEANUP:
- /* how did we get here!? */
- goto exit;
- }
+ err_state = true;
+ break;
+ case MHD_EVENT_LOOP_INFO_CLEANUP:
+ /* how did we get here!? */
+ goto exit;
+ }
#if WINDOWS
if (MHD_ITC_IS_VALID_(daemon->itc) )
{
@@ -1934,25 +1934,25 @@ thread_main_handle_connection (void *data)
goto exit;
}
- num_ready = MHD_SYS_select_ (maxsock + 1,
+ num_ready = MHD_SYS_select_ (maxsock + 1,
&rs,
&ws,
NULL,
tvp);
- if (num_ready < 0)
- {
- const int err = MHD_socket_get_error_();
+ if (num_ready < 0)
+ {
+ const int err = MHD_socket_get_error_();
- if (MHD_SCKT_ERR_IS_EINTR_(err))
- continue;
+ if (MHD_SCKT_ERR_IS_EINTR_(err))
+ continue;
#ifdef HAVE_MESSAGES
- MHD_DLOG (con->daemon,
- _("Error during select (%d): `%s'\n"),
- err,
- MHD_socket_strerr_ (err));
+ MHD_DLOG (con->daemon,
+ _("Error during select (%d): `%s'\n"),
+ err,
+ MHD_socket_strerr_ (err));
#endif
- break;
- }
+ break;
+ }
#if WINDOWS
/* Clear ITC before other processing so additional
* signals will trigger select() again */
@@ -1970,30 +1970,30 @@ thread_main_handle_connection (void *data)
FD_ISSET (con->socket_fd,
&es)) )
goto exit;
- }
+ }
#ifdef HAVE_POLL
else
- {
- /* use poll */
- memset (&p,
+ {
+ /* use poll */
+ memset (&p,
0,
sizeof (p));
- p[0].fd = con->socket_fd;
- switch (con->event_loop_info)
- {
- case MHD_EVENT_LOOP_INFO_READ:
- p[0].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC;
- break;
- case MHD_EVENT_LOOP_INFO_WRITE:
- p[0].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC;
- break;
- case MHD_EVENT_LOOP_INFO_BLOCK:
- p[0].events |= MHD_POLL_EVENTS_ERR_DISC;
- break;
- case MHD_EVENT_LOOP_INFO_CLEANUP:
- /* how did we get here!? */
- goto exit;
- }
+ p[0].fd = con->socket_fd;
+ switch (con->event_loop_info)
+ {
+ case MHD_EVENT_LOOP_INFO_READ:
+ p[0].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC;
+ break;
+ case MHD_EVENT_LOOP_INFO_WRITE:
+ p[0].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC;
+ break;
+ case MHD_EVENT_LOOP_INFO_BLOCK:
+ p[0].events |= MHD_POLL_EVENTS_ERR_DISC;
+ break;
+ case MHD_EVENT_LOOP_INFO_CLEANUP:
+ /* how did we get here!? */
+ goto exit;
+ }
#if WINDOWS
extra_slot = 0;
if (MHD_ITC_IS_VALID_(daemon->itc))
@@ -2004,23 +2004,23 @@ thread_main_handle_connection (void *data)
extra_slot = 1;
}
#endif
- if (MHD_sys_poll_ (p,
+ if (MHD_sys_poll_ (p,
#if WINDOWS
1 + extra_slot,
#else
1,
#endif
(NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0)
- {
- if (MHD_SCKT_LAST_ERR_IS_(MHD_SCKT_EINTR_))
- continue;
+ {
+ if (MHD_SCKT_LAST_ERR_IS_(MHD_SCKT_EINTR_))
+ continue;
#ifdef HAVE_MESSAGES
- MHD_DLOG (con->daemon,
+ MHD_DLOG (con->daemon,
_("Error during poll: `%s'\n"),
- MHD_socket_last_strerr_ ());
+ MHD_socket_last_strerr_ ());
#endif
- break;
- }
+ break;
+ }
#if WINDOWS
/* Clear ITC before other processing so additional
* signals will trigger poll() again */
@@ -2034,7 +2034,7 @@ thread_main_handle_connection (void *data)
0 != (p[0].revents & POLLOUT),
0 != (p[0].revents & (POLLERR |
MHD_POLL_REVENTS_ERR_DISC))))
goto exit;
- }
+ }
#endif
#ifdef UPGRADE_SUPPORT
if (MHD_CONNECTION_UPGRADE == con->state)
@@ -2074,7 +2074,7 @@ thread_main_handle_connection (void *data)
#endif
#endif
if (MHD_CONNECTION_CLOSED != con->state)
- MHD_connection_close_ (con,
+ MHD_connection_close_ (con,
(daemon->shutdown) ?
MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN:
MHD_REQUEST_TERMINATED_WITH_ERROR);
@@ -2166,11 +2166,11 @@ MHD_tls_push_func_(gnutls_transport_ptr_t trnsp,
*/
static int
internal_add_connection (struct MHD_Daemon *daemon,
- MHD_socket client_socket,
- const struct sockaddr *addr,
- socklen_t addrlen,
- bool external_add,
- bool non_blck)
+ MHD_socket client_socket,
+ const struct sockaddr *addr,
+ socklen_t addrlen,
+ bool external_add,
+ bool non_blck)
{
struct MHD_Connection *connection;
unsigned int i;
@@ -2181,8 +2181,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
if ((external_add) && (NULL != daemon->worker_pool))
{
/* have a pool, try to find a pool with capacity; we use the
- socket as the initial offset into the pool for load
- balancing */
+ socket as the initial offset into the pool for load
+ balancing */
for (i = 0; i < daemon->worker_pool_size; ++i)
{
struct MHD_Daemon * const worker =
@@ -2209,9 +2209,9 @@ internal_add_connection (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"),
- (int) client_socket,
- (int) FD_SETSIZE);
+ _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"),
+ (int) client_socket,
+ (int) FD_SETSIZE);
#endif
MHD_socket_close_chk_ (client_socket);
#if EINVAL
@@ -2266,7 +2266,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
/* apply connection acceptance policy if present */
if ( (NULL != daemon->apc) &&
(MHD_NO == daemon->apc (daemon->apc_cls,
- addr,
+ addr,
addrlen)) )
{
#if DEBUG_CLOSE
@@ -2290,8 +2290,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
eno = errno;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Error allocating memory: %s\n",
- MHD_strerror_ (errno));
+ "Error allocating memory: %s\n",
+ MHD_strerror_ (errno));
#endif
MHD_socket_close_chk_ (client_socket);
MHD_ip_limit_del (daemon,
@@ -2305,8 +2305,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Error allocating memory: %s\n"),
- MHD_strerror_ (errno));
+ _("Error allocating memory: %s\n"),
+ MHD_strerror_ (errno));
#endif
MHD_socket_close_chk_ (client_socket);
MHD_ip_limit_del (daemon,
@@ -2325,8 +2325,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
eno = errno;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Error allocating memory: %s\n"),
- MHD_strerror_ (errno));
+ _("Error allocating memory: %s\n"),
+ MHD_strerror_ (errno));
#endif
MHD_socket_close_chk_ (client_socket);
MHD_ip_limit_del (daemon,
@@ -2366,14 +2366,14 @@ internal_add_connection (struct MHD_Daemon *daemon,
#endif /* GNUTLS_VERSION_MAJOR >= 3*/
);
gnutls_priority_set (connection->tls_session,
- daemon->priority_cache);
+ daemon->priority_cache);
switch (daemon->cred_type)
{
/* set needed credentials for certificate authentication. */
case GNUTLS_CRD_CERTIFICATE:
gnutls_credentials_set (connection->tls_session,
- GNUTLS_CRD_CERTIFICATE,
- daemon->x509_cred);
+ GNUTLS_CRD_CERTIFICATE,
+ daemon->x509_cred);
break;
default:
#ifdef HAVE_MESSAGES
@@ -2389,9 +2389,9 @@ internal_add_connection (struct MHD_Daemon *daemon,
free (connection);
MHD_PANIC (_("Unknown credential type"));
#if EINVAL
- errno = EINVAL;
+ errno = EINVAL;
#endif
- return MHD_NO;
+ return MHD_NO;
}
#if (GNUTLS_VERSION_NUMBER+0 >= 0x030109) && !defined(_WIN64)
gnutls_transport_set_int (connection->tls_session, (int)(client_socket));
@@ -2402,8 +2402,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
gnutls_transport_set_push_function (connection->tls_session,
MHD_tls_push_func_);
#endif /* MHD_TLSLIB_NEED_PUSH_FUNC */
if (daemon->https_mem_trust)
- gnutls_certificate_server_set_request (connection->tls_session,
- GNUTLS_CERT_REQUEST);
+ gnutls_certificate_server_set_request (connection->tls_session,
+ GNUTLS_CERT_REQUEST);
#else /* ! HTTPS_SUPPORT */
eno = EINVAL;
goto cleanup;
@@ -2434,8 +2434,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
connection);
}
DLL_insert (daemon->connections_head,
- daemon->connections_tail,
- connection);
+ daemon->connections_tail,
+ connection);
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
if (NULL != daemon->notify_connection)
@@ -2453,13 +2453,13 @@ internal_add_connection (struct MHD_Daemon *daemon,
&thread_main_handle_connection,
connection))
{
- eno = errno;
+ eno = errno;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
"Failed to create a thread: %s\n",
MHD_strerror_ (eno));
#endif
- goto cleanup;
+ goto cleanup;
}
}
else
@@ -2468,34 +2468,34 @@ internal_add_connection (struct MHD_Daemon *daemon,
if (0 != (daemon->options & MHD_USE_EPOLL))
{
if ((0 == (daemon->options & MHD_USE_TURBO)) || (external_add))
- { /* Do not manipulate EReady DL-list in 'external_add' mode. */
- struct epoll_event event;
-
- event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET;
- event.data.ptr = connection;
- if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_ADD,
- client_socket,
- &event))
- {
- eno = errno;
+ { /* Do not manipulate EReady DL-list in 'external_add' mode. */
+ struct epoll_event event;
+
+ event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET;
+ event.data.ptr = connection;
+ if (0 != epoll_ctl (daemon->epoll_fd,
+ EPOLL_CTL_ADD,
+ client_socket,
+ &event))
+ {
+ eno = errno;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
- goto cleanup;
- }
- connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET;
- }
+ goto cleanup;
+ }
+ connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET;
+ }
else
- {
- connection->epoll_state |= MHD_EPOLL_STATE_READ_READY |
MHD_EPOLL_STATE_WRITE_READY
- | MHD_EPOLL_STATE_IN_EREADY_EDLL;
- EDLL_insert (daemon->eready_head,
- daemon->eready_tail,
- connection);
- }
+ {
+ connection->epoll_state |= MHD_EPOLL_STATE_READ_READY |
MHD_EPOLL_STATE_WRITE_READY
+ | MHD_EPOLL_STATE_IN_EREADY_EDLL;
+ EDLL_insert (daemon->eready_head,
+ daemon->eready_tail,
+ connection);
+ }
}
else /* This 'else' is combined with next 'if'. */
#endif
@@ -2532,8 +2532,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
connection);
}
DLL_remove (daemon->connections_head,
- daemon->connections_tail,
- connection);
+ daemon->connections_tail,
+ connection);
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
MHD_pool_destroy (connection->pool);
free (connection->addr);
@@ -2804,12 +2804,12 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
{ /* Wake up suspended connections. */
if (! MHD_itc_activate_(daemon->itc,
"w"))
- {
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Failed to signal resume of connection via inter-thread
communication channel."));
+ MHD_DLOG (daemon,
+ _("Failed to signal resume of connection via inter-thread
communication channel."));
#endif
- }
+ }
}
return ret;
}
@@ -2844,9 +2844,9 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
*/
int
MHD_add_connection (struct MHD_Daemon *daemon,
- MHD_socket client_socket,
- const struct sockaddr *addr,
- socklen_t addrlen)
+ MHD_socket client_socket,
+ const struct sockaddr *addr,
+ socklen_t addrlen)
{
bool sk_nonbl;
if (! MHD_socket_nonblocking_ (client_socket))
@@ -2870,11 +2870,11 @@ MHD_add_connection (struct MHD_Daemon *daemon,
#endif
}
return internal_add_connection (daemon,
- client_socket,
- addr,
+ client_socket,
+ addr,
addrlen,
- true,
- sk_nonbl);
+ true,
+ sk_nonbl);
}
@@ -2939,8 +2939,8 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
#ifdef HAVE_MESSAGES
if (! MHD_SCKT_ERR_IS_EAGAIN_ (err) )
MHD_DLOG (daemon,
- _("Error accepting connection: %s\n"),
- MHD_socket_strerr_(err));
+ _("Error accepting connection: %s\n"),
+ MHD_socket_strerr_(err));
#endif
if (MHD_INVALID_SOCKET != s)
{
@@ -3003,9 +3003,9 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
#endif
(void) internal_add_connection (daemon,
s,
- addr,
+ addr,
addrlen,
- false,
+ false,
sk_nonbl);
return MHD_YES;
}
@@ -3029,12 +3029,12 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
while (NULL != (pos = daemon->cleanup_tail))
{
DLL_remove (daemon->cleanup_head,
- daemon->cleanup_tail,
- pos);
+ daemon->cleanup_tail,
+ pos);
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (! pos->thread_joined) &&
+ (! pos->thread_joined) &&
(! MHD_join_thread_ (pos->pid.handle)) )
MHD_PANIC (_("Failed to join a thread\n"));
#ifdef UPGRADE_SUPPORT
@@ -3043,7 +3043,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
MHD_pool_destroy (pos->pool);
#ifdef HTTPS_SUPPORT
if (NULL != pos->tls_session)
- gnutls_deinit (pos->tls_session);
+ gnutls_deinit (pos->tls_session);
#endif /* HTTPS_SUPPORT */
/* clean up the connection */
@@ -3084,14 +3084,14 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
}
#endif
if (NULL != pos->response)
- {
- MHD_destroy_response (pos->response);
- pos->response = NULL;
- }
+ {
+ MHD_destroy_response (pos->response);
+ pos->response = NULL;
+ }
if (MHD_INVALID_SOCKET != pos->socket_fd)
MHD_socket_close_chk_ (pos->socket_fd);
if (NULL != pos->addr)
- free (pos->addr);
+ free (pos->addr);
free (pos);
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -3124,7 +3124,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
*/
int
MHD_get_timeout (struct MHD_Daemon *daemon,
- MHD_UNSIGNED_LONG_LONG *timeout)
+ MHD_UNSIGNED_LONG_LONG *timeout)
{
time_t earliest_deadline;
time_t now;
@@ -3151,11 +3151,11 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
((NULL != daemon->eready_head)
#if defined(UPGRADE_SUPPORT) && defined(HTTPS_SUPPORT)
- || (NULL != daemon->eready_urh_head)
+ || (NULL != daemon->eready_urh_head)
#endif /* UPGRADE_SUPPORT && HTTPS_SUPPORT */
- ) )
+ ) )
{
- /* Some connection(s) already have some data pending. */
+ /* Some connection(s) already have some data pending. */
*timeout = 0;
return MHD_YES;
}
@@ -3166,12 +3166,12 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
for (pos = daemon->manual_timeout_tail; NULL != pos; pos = pos->prevX)
{
if (0 != pos->connection_timeout)
- {
- if ( (! have_timeout) ||
- (earliest_deadline - pos->last_activity >
pos->connection_timeout) )
- earliest_deadline = pos->last_activity + pos->connection_timeout;
- have_timeout = true;
- }
+ {
+ if ( (! have_timeout) ||
+ (earliest_deadline - pos->last_activity > pos->connection_timeout) )
+ earliest_deadline = pos->last_activity + pos->connection_timeout;
+ have_timeout = true;
+ }
}
/* normal timeouts are sorted, so we only need to look at the 'tail'
(oldest) */
pos = daemon->normal_timeout_tail;
@@ -3179,8 +3179,8 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
(0 != pos->connection_timeout) )
{
if ( (! have_timeout) ||
- (earliest_deadline - pos->connection_timeout > pos->last_activity) )
- earliest_deadline = pos->last_activity + pos->connection_timeout;
+ (earliest_deadline - pos->connection_timeout > pos->last_activity) )
+ earliest_deadline = pos->last_activity + pos->connection_timeout;
have_timeout = true;
}
@@ -3249,10 +3249,10 @@ internal_run_from_select (struct MHD_Daemon *daemon,
prev = daemon->connections_tail;
while (NULL != (pos = prev))
{
- prev = pos->prev;
+ prev = pos->prev;
ds = pos->socket_fd;
if (MHD_INVALID_SOCKET == ds)
- continue;
+ continue;
call_handlers (pos,
FD_ISSET (ds,
read_fd_set),
@@ -3368,7 +3368,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
*/
static int
MHD_select (struct MHD_Daemon *daemon,
- int may_block)
+ int may_block)
{
int num_ready;
fd_set rs;
@@ -3485,7 +3485,7 @@ MHD_select (struct MHD_Daemon *daemon,
tv = &timeout;
}
else if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (MHD_YES == MHD_get_timeout (daemon, <imeout)) )
+ (MHD_YES == MHD_get_timeout (daemon, <imeout)) )
{
/* ltimeout is in ms */
timeout.tv_usec = (ltimeout % 1000) * 1000;
@@ -3534,7 +3534,7 @@ MHD_select (struct MHD_Daemon *daemon,
*/
static int
MHD_poll_all (struct MHD_Daemon *daemon,
- int may_block)
+ int may_block)
{
unsigned int num_connections;
struct MHD_Connection *pos;
@@ -3580,29 +3580,29 @@ MHD_poll_all (struct MHD_Daemon *daemon,
poll_listen = -1;
if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) &&
(! daemon->was_quiesced) &&
- (daemon->connections < daemon->connection_limit) &&
+ (daemon->connections < daemon->connection_limit) &&
(! daemon->at_limit) )
{
- /* only listen if we are not at the connection limit */
- p[poll_server].fd = ls;
- p[poll_server].events = POLLIN;
- p[poll_server].revents = 0;
- poll_listen = (int) poll_server;
- poll_server++;
+ /* only listen if we are not at the connection limit */
+ p[poll_server].fd = ls;
+ p[poll_server].events = POLLIN;
+ p[poll_server].revents = 0;
+ poll_listen = (int) poll_server;
+ poll_server++;
}
poll_itc_idx = -1;
if (MHD_ITC_IS_VALID_(daemon->itc))
{
- p[poll_server].fd = MHD_itc_r_fd_ (daemon->itc);
- p[poll_server].events = POLLIN;
- p[poll_server].revents = 0;
+ p[poll_server].fd = MHD_itc_r_fd_ (daemon->itc);
+ p[poll_server].events = POLLIN;
+ p[poll_server].revents = 0;
poll_itc_idx = (int) poll_server;
- poll_server++;
+ poll_server++;
}
if (may_block == MHD_NO)
timeout = 0;
else if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ||
- (MHD_YES != MHD_get_timeout (daemon,
+ (MHD_YES != MHD_get_timeout (daemon,
<imeout)) )
timeout = -1;
else
@@ -3611,23 +3611,23 @@ MHD_poll_all (struct MHD_Daemon *daemon,
i = 0;
for (pos = daemon->connections_tail; NULL != pos; pos = pos->prev)
{
- p[poll_server+i].fd = pos->socket_fd;
- switch (pos->event_loop_info)
- {
- case MHD_EVENT_LOOP_INFO_READ:
- p[poll_server+i].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC;
- break;
- case MHD_EVENT_LOOP_INFO_WRITE:
- p[poll_server+i].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC;
- break;
- case MHD_EVENT_LOOP_INFO_BLOCK:
- p[poll_server+i].events |= MHD_POLL_EVENTS_ERR_DISC;
- break;
- case MHD_EVENT_LOOP_INFO_CLEANUP:
- timeout = 0; /* clean up "pos" immediately */
- break;
- }
- i++;
+ p[poll_server+i].fd = pos->socket_fd;
+ switch (pos->event_loop_info)
+ {
+ case MHD_EVENT_LOOP_INFO_READ:
+ p[poll_server+i].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC;
+ break;
+ case MHD_EVENT_LOOP_INFO_WRITE:
+ p[poll_server+i].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC;
+ break;
+ case MHD_EVENT_LOOP_INFO_BLOCK:
+ p[poll_server+i].events |= MHD_POLL_EVENTS_ERR_DISC;
+ break;
+ case MHD_EVENT_LOOP_INFO_CLEANUP:
+ timeout = 0; /* clean up "pos" immediately */
+ break;
+ }
+ i++;
}
#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
for (urh = daemon->urh_tail; NULL != urh; urh = urh->prev)
@@ -3646,18 +3646,18 @@ MHD_poll_all (struct MHD_Daemon *daemon,
timeout) < 0)
{
const int err = MHD_socket_get_error_ ();
- if (MHD_SCKT_ERR_IS_EINTR_ (err))
+ if (MHD_SCKT_ERR_IS_EINTR_ (err))
{
free(p);
return MHD_YES;
}
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("poll failed: %s\n"),
- MHD_socket_strerr_ (err));
+ MHD_DLOG (daemon,
+ _("poll failed: %s\n"),
+ MHD_socket_strerr_ (err));
#endif
free(p);
- return MHD_NO;
+ return MHD_NO;
}
/* Reset. New value will be set when connections are processed. */
@@ -3680,7 +3680,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
prev = daemon->connections_tail;
while (NULL != (pos = prev))
{
- prev = pos->prev;
+ prev = pos->prev;
/* first, sanity checks */
if (i >= num_connections)
break; /* connection list changed somehow, retry later ... */
@@ -3728,7 +3728,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
/* handle 'listen' FD */
if ( (-1 != poll_listen) &&
- (0 != (p[poll_listen].revents & POLLIN)) )
+ (0 != (p[poll_listen].revents & POLLIN)) )
(void) MHD_accept_connection (daemon);
free(p);
@@ -3746,7 +3746,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
*/
static int
MHD_poll_listen_socket (struct MHD_Daemon *daemon,
- int may_block)
+ int may_block)
{
struct pollfd p[2];
int timeout;
@@ -3796,7 +3796,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
const int err = MHD_socket_get_error_ ();
if (MHD_SCKT_ERR_IS_EINTR_ (err))
- return MHD_YES;
+ return MHD_YES;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("poll failed: %s\n"),
@@ -3828,7 +3828,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
*/
static int
MHD_poll (struct MHD_Daemon *daemon,
- int may_block)
+ int may_block)
{
#ifdef HAVE_POLL
if (daemon->shutdown)
@@ -3922,23 +3922,23 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
unsigned int i;
/* update event masks */
num_events = epoll_wait (daemon->epoll_upgrade_fd,
- events,
+ events,
MAX_EVENTS,
0);
if (-1 == num_events)
- {
+ {
const int err = MHD_socket_get_error_ ();
if (MHD_SCKT_ERR_IS_EINTR_ (err))
- return MHD_YES;
+ return MHD_YES;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Call to epoll_wait failed: %s\n"),
MHD_socket_strerr_ (err));
#endif
- return MHD_NO;
- }
+ return MHD_NO;
+ }
for (i = 0; i < (unsigned int) num_events; i++)
- {
+ {
struct UpgradeEpollHandle * const ueh = events[i].data.ptr;
struct MHD_UpgradeResponseHandle * const urh = ueh->urh;
bool new_err_state = false;
@@ -3956,24 +3956,24 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
if ( (0 == (ueh->celi & MHD_EPOLL_STATE_ERROR)) &&
(0 != (events[i].events & (EPOLLERR | EPOLLPRI))) )
- {
+ {
/* Process new error state only one time
* and avoid continuously marking this connection
* as 'ready'. */
ueh->celi |= MHD_EPOLL_STATE_ERROR;
new_err_state = true;
- }
+ }
if (! urh->in_eready_list)
{
if (new_err_state ||
- is_urh_ready(urh))
- {
- EDLL_insert (daemon->eready_urh_head,
- daemon->eready_urh_tail,
- urh);
- urh->in_eready_list = true;
- }
+ is_urh_ready(urh))
+ {
+ EDLL_insert (daemon->eready_urh_head,
+ daemon->eready_urh_tail,
+ urh);
+ urh->in_eready_list = true;
+ }
}
}
}
@@ -3983,12 +3983,12 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
prev = pos->prevE;
process_urh (pos);
if (! is_urh_ready(pos))
- {
- EDLL_remove (daemon->eready_urh_head,
- daemon->eready_urh_tail,
- pos);
- pos->in_eready_list = false;
- }
+ {
+ EDLL_remove (daemon->eready_urh_head,
+ daemon->eready_urh_tail,
+ pos);
+ pos->in_eready_list = false;
+ }
/* Finished forwarding? */
if ( (0 == pos->in_buffer_size) &&
(0 == pos->out_buffer_size) &&
@@ -4024,7 +4024,7 @@ static const char * const epoll_itc_marker = "itc_marker";
*/
static int
MHD_epoll (struct MHD_Daemon *daemon,
- int may_block)
+ int may_block)
{
#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
static const char * const upgrade_marker = "upgrade_ptr";
@@ -4055,17 +4055,17 @@ MHD_epoll (struct MHD_Daemon *daemon,
event.events = EPOLLIN;
event.data.ptr = daemon;
if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_ADD,
- ls,
- &event))
- {
+ EPOLL_CTL_ADD,
+ ls,
+ &event))
+ {
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
- return MHD_NO;
- }
+ return MHD_NO;
+ }
daemon->listen_socket_in_epoll = true;
}
if ( (daemon->was_quiesced) &&
@@ -4086,17 +4086,17 @@ MHD_epoll (struct MHD_Daemon *daemon,
event.events = EPOLLIN | EPOLLOUT;
event.data.ptr = (void *) upgrade_marker;
if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_ADD,
- daemon->epoll_upgrade_fd,
- &event))
- {
+ EPOLL_CTL_ADD,
+ daemon->epoll_upgrade_fd,
+ &event))
+ {
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
- return MHD_NO;
- }
+ return MHD_NO;
+ }
daemon->upgrade_fd_in_epoll = true;
}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -4106,12 +4106,12 @@ MHD_epoll (struct MHD_Daemon *daemon,
(daemon->was_quiesced) ) )
{
/* we're at the connection limit, disable listen socket
- for event loop for now */
+ for event loop for now */
if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_DEL,
- ls,
- NULL))
- MHD_PANIC (_("Failed to remove listen FD from epoll set\n"));
+ EPOLL_CTL_DEL,
+ ls,
+ NULL))
+ MHD_PANIC (_("Failed to remove listen FD from epoll set\n"));
daemon->listen_socket_in_epoll = false;
}
@@ -4122,15 +4122,15 @@ MHD_epoll (struct MHD_Daemon *daemon,
if (MHD_YES == may_block)
{
if (MHD_YES == MHD_get_timeout (daemon,
- &timeout_ll))
- {
- if (timeout_ll >= (MHD_UNSIGNED_LONG_LONG) INT_MAX)
- timeout_ms = INT_MAX;
- else
- timeout_ms = (int) timeout_ll;
- }
+ &timeout_ll))
+ {
+ if (timeout_ll >= (MHD_UNSIGNED_LONG_LONG) INT_MAX)
+ timeout_ms = INT_MAX;
+ else
+ timeout_ms = (int) timeout_ll;
+ }
else
- timeout_ms = -1;
+ timeout_ms = -1;
}
else
timeout_ms = 0;
@@ -4149,27 +4149,27 @@ MHD_epoll (struct MHD_Daemon *daemon,
{
/* update event masks */
num_events = epoll_wait (daemon->epoll_fd,
- events,
+ events,
MAX_EVENTS,
timeout_ms);
if (-1 == num_events)
- {
+ {
const int err = MHD_socket_get_error_ ();
if (MHD_SCKT_ERR_IS_EINTR_ (err))
- return MHD_YES;
+ return MHD_YES;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Call to epoll_wait failed: %s\n"),
MHD_socket_strerr_ (err));
#endif
- return MHD_NO;
- }
+ return MHD_NO;
+ }
for (i=0;i<(unsigned int) num_events;i++)
- {
+ {
/* First, check for the values of `ptr` that would indicate
that this event is not about a normal connection. */
- if (NULL == events[i].data.ptr)
- continue; /* shutdown signal! */
+ if (NULL == events[i].data.ptr)
+ continue; /* shutdown signal! */
#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
if (upgrade_marker == events[i].data.ptr)
{
@@ -4186,8 +4186,8 @@ MHD_epoll (struct MHD_Daemon *daemon,
MHD_itc_clear_ (daemon->itc);
continue;
}
- if (daemon == events[i].data.ptr)
- {
+ if (daemon == events[i].data.ptr)
+ {
/* Check for error conditions on listen socket. */
/* FIXME: Initiate MHD_quiesce_daemon() to prevent busy waiting?
*/
if (0 == (events[i].events & (EPOLLERR | EPOLLHUP)))
@@ -4202,9 +4202,9 @@ MHD_epoll (struct MHD_Daemon *daemon,
(daemon->connections < daemon->connection_limit) &&
(! daemon->at_limit) )
series_length++;
- }
+ }
continue;
- }
+ }
/* this is an event relating to a 'normal' connection,
remember the event and if appropriate mark the
connection as 'eready'. */
@@ -4261,7 +4261,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
prev = daemon->eready_tail;
while (NULL != (pos = prev))
{
- prev = pos->prevE;
+ prev = pos->prevE;
call_handlers (pos,
0 != (pos->epoll_state & MHD_EPOLL_STATE_READ_READY),
0 != (pos->epoll_state & MHD_EPOLL_STATE_WRITE_READY),
@@ -4307,7 +4307,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
prev = pos->prevX;
MHD_connection_handle_idle (pos);
if (MHD_CONNECTION_CLOSED != pos->state)
- break; /* sorted by timeout, no need to visit the rest! */
+ break; /* sorted by timeout, no need to visit the rest! */
}
return MHD_YES;
}
@@ -4388,18 +4388,18 @@ close_connection (struct MHD_Connection *pos)
mhd_assert (! pos->resuming);
if (pos->connection_timeout == pos->daemon->connection_timeout)
XDLL_remove (daemon->normal_timeout_head,
- daemon->normal_timeout_tail,
- pos);
+ daemon->normal_timeout_tail,
+ pos);
else
XDLL_remove (daemon->manual_timeout_head,
- daemon->manual_timeout_tail,
- pos);
+ daemon->manual_timeout_tail,
+ pos);
DLL_remove (daemon->connections_head,
- daemon->connections_tail,
- pos);
+ daemon->connections_tail,
+ pos);
DLL_insert (daemon->cleanup_head,
- daemon->cleanup_tail,
- pos);
+ daemon->cleanup_tail,
+ pos);
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
}
@@ -4421,13 +4421,13 @@ MHD_polling_thread (void *cls)
while (! daemon->shutdown)
{
if (0 != (daemon->options & MHD_USE_POLL))
- MHD_poll (daemon, MHD_YES);
+ MHD_poll (daemon, MHD_YES);
#ifdef EPOLL_SUPPORT
else if (0 != (daemon->options & MHD_USE_EPOLL))
- MHD_epoll (daemon, MHD_YES);
+ MHD_epoll (daemon, MHD_YES);
#endif
else
- MHD_select (daemon, MHD_YES);
+ MHD_select (daemon, MHD_YES);
MHD_cleanup_connections (daemon);
}
@@ -4541,7 +4541,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Using MHD_quiesce_daemon in this mode requires MHD_USE_ITC\n");
+ "Using MHD_quiesce_daemon in this mode requires MHD_USE_ITC\n");
#endif
return MHD_INVALID_SOCKET;
}
@@ -4549,19 +4549,19 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
if (NULL != daemon->worker_pool)
for (i = 0; i < daemon->worker_pool_size; i++)
{
- daemon->worker_pool[i].was_quiesced = true;
+ daemon->worker_pool[i].was_quiesced = true;
#ifdef EPOLL_SUPPORT
- if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
- (-1 != daemon->worker_pool[i].epoll_fd) &&
- (daemon->worker_pool[i].listen_socket_in_epoll) )
- {
- if (0 != epoll_ctl (daemon->worker_pool[i].epoll_fd,
- EPOLL_CTL_DEL,
- ret,
- NULL))
- MHD_PANIC (_("Failed to remove listen FD from epoll set\n"));
- daemon->worker_pool[i].listen_socket_in_epoll = false;
- }
+ if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
+ (-1 != daemon->worker_pool[i].epoll_fd) &&
+ (daemon->worker_pool[i].listen_socket_in_epoll) )
+ {
+ if (0 != epoll_ctl (daemon->worker_pool[i].epoll_fd,
+ EPOLL_CTL_DEL,
+ ret,
+ NULL))
+ MHD_PANIC (_("Failed to remove listen FD from epoll set\n"));
+ daemon->worker_pool[i].listen_socket_in_epoll = false;
+ }
else
#endif
if (MHD_ITC_IS_VALID_(daemon->worker_pool[i].itc))
@@ -4577,10 +4577,10 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
(daemon->listen_socket_in_epoll) )
{
if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_DEL,
- ret,
- NULL))
- MHD_PANIC ("Failed to remove listen FD from epoll set\n");
+ EPOLL_CTL_DEL,
+ ret,
+ NULL))
+ MHD_PANIC ("Failed to remove listen FD from epoll set\n");
daemon->listen_socket_in_epoll = false;
}
#endif
@@ -4614,8 +4614,8 @@ typedef void
*/
static int
parse_options_va (struct MHD_Daemon *daemon,
- const struct sockaddr **servaddr,
- va_list ap);
+ const struct sockaddr **servaddr,
+ va_list ap);
/**
@@ -4628,8 +4628,8 @@ parse_options_va (struct MHD_Daemon *daemon,
*/
static int
parse_options (struct MHD_Daemon *daemon,
- const struct sockaddr **servaddr,
- ...)
+ const struct sockaddr **servaddr,
+ ...)
{
va_list ap;
int ret;
@@ -4653,8 +4653,8 @@ parse_options (struct MHD_Daemon *daemon,
*/
static int
parse_options_va (struct MHD_Daemon *daemon,
- const struct sockaddr **servaddr,
- va_list ap)
+ const struct sockaddr **servaddr,
+ va_list ap)
{
enum MHD_OPTION opt;
struct MHD_OptionItem *oa;
@@ -4748,85 +4748,85 @@ parse_options_va (struct MHD_Daemon *daemon,
* be optimized out on those platforms. On others it will be
compiled into real
* check. */
else if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct
MHD_Daemon))) /* Compiler may warn on some platforms, ignore warning. */
- {
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Specified thread pool size (%u) too big\n"),
- daemon->worker_pool_size);
-#endif
- return MHD_NO;
- }
- else
- {
- if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))
- {
+ MHD_DLOG (daemon,
+ _("Specified thread pool size (%u) too big\n"),
+ daemon->worker_pool_size);
+#endif
+ return MHD_NO;
+ }
+ else
+ {
+ if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("MHD_OPTION_THREAD_POOL_SIZE option is specified
but "
- "MHD_USE_INTERNAL_POLLING_THREAD flag is not
specified.\n"));
-#endif
- return MHD_NO;
- }
- if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
- {
+ MHD_DLOG (daemon,
+ _("MHD_OPTION_THREAD_POOL_SIZE option is specified but "
+ "MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n"));
+#endif
+ return MHD_NO;
+ }
+ if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Both MHD_OPTION_THREAD_POOL_SIZE option and "
- "MHD_USE_THREAD_PER_CONNECTION flag are
specified.\n"));
+ MHD_DLOG (daemon,
+ _("Both MHD_OPTION_THREAD_POOL_SIZE option and "
+ "MHD_USE_THREAD_PER_CONNECTION flag are specified.\n"));
#endif
- return MHD_NO;
- }
- }
+ return MHD_NO;
+ }
+ }
break;
#ifdef HTTPS_SUPPORT
case MHD_OPTION_HTTPS_MEM_KEY:
- if (0 != (daemon->options & MHD_USE_TLS))
- daemon->https_mem_key = va_arg (ap,
+ if (0 != (daemon->options & MHD_USE_TLS))
+ daemon->https_mem_key = va_arg (ap,
const char *);
#ifdef HAVE_MESSAGES
- else
- MHD_DLOG (daemon,
- _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not
set\n"),
- opt);
+ else
+ MHD_DLOG (daemon,
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"),
+ opt);
#endif
break;
case MHD_OPTION_HTTPS_KEY_PASSWORD:
- if (0 != (daemon->options & MHD_USE_TLS))
- daemon->https_key_password = va_arg (ap,
+ if (0 != (daemon->options & MHD_USE_TLS))
+ daemon->https_key_password = va_arg (ap,
const char *);
#ifdef HAVE_MESSAGES
- else
- MHD_DLOG (daemon,
- _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not
set\n"),
- opt);
+ else
+ MHD_DLOG (daemon,
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"),
+ opt);
#endif
break;
case MHD_OPTION_HTTPS_MEM_CERT:
- if (0 != (daemon->options & MHD_USE_TLS))
- daemon->https_mem_cert = va_arg (ap,
+ if (0 != (daemon->options & MHD_USE_TLS))
+ daemon->https_mem_cert = va_arg (ap,
const char *);
#ifdef HAVE_MESSAGES
- else
- MHD_DLOG (daemon,
- _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not
set\n"),
- opt);
+ else
+ MHD_DLOG (daemon,
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"),
+ opt);
#endif
break;
case MHD_OPTION_HTTPS_MEM_TRUST:
- if (0 != (daemon->options & MHD_USE_TLS))
- daemon->https_mem_trust = va_arg (ap,
+ if (0 != (daemon->options & MHD_USE_TLS))
+ daemon->https_mem_trust = va_arg (ap,
const char *);
#ifdef HAVE_MESSAGES
- else
- MHD_DLOG (daemon,
- _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not
set\n"),
- opt);
+ else
+ MHD_DLOG (daemon,
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"),
+ opt);
#endif
break;
- case MHD_OPTION_HTTPS_CRED_TYPE:
- daemon->cred_type = (gnutls_credentials_type_t) va_arg (ap,
+ case MHD_OPTION_HTTPS_CRED_TYPE:
+ daemon->cred_type = (gnutls_credentials_type_t) va_arg (ap,
int);
- break;
+ break;
case MHD_OPTION_HTTPS_MEM_DHPARAMS:
if (0 != (daemon->options & MHD_USE_TLS))
{
@@ -4868,24 +4868,24 @@ parse_options_va (struct MHD_Daemon *daemon,
}
break;
case MHD_OPTION_HTTPS_PRIORITIES:
- if (0 != (daemon->options & MHD_USE_TLS))
- {
- gnutls_priority_deinit (daemon->priority_cache);
- ret = gnutls_priority_init (&daemon->priority_cache,
- pstr = va_arg (ap, const char*),
- NULL);
- if (GNUTLS_E_SUCCESS != ret)
- {
+ if (0 != (daemon->options & MHD_USE_TLS))
+ {
+ gnutls_priority_deinit (daemon->priority_cache);
+ ret = gnutls_priority_init (&daemon->priority_cache,
+ pstr = va_arg (ap, const char*),
+ NULL);
+ if (GNUTLS_E_SUCCESS != ret)
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Setting priorities to `%s' failed: %s\n"),
- pstr,
- gnutls_strerror (ret));
-#endif
- daemon->priority_cache = NULL;
- return MHD_NO;
- }
- }
+ MHD_DLOG (daemon,
+ _("Setting priorities to `%s' failed: %s\n"),
+ pstr,
+ gnutls_strerror (ret));
+#endif
+ daemon->priority_cache = NULL;
+ return MHD_NO;
+ }
+ }
break;
case MHD_OPTION_HTTPS_CERT_CALLBACK:
#if GNUTLS_VERSION_MAJOR < 3
@@ -4902,18 +4902,18 @@ parse_options_va (struct MHD_Daemon *daemon,
#endif
#endif /* HTTPS_SUPPORT */
#ifdef DAUTH_SUPPORT
- case MHD_OPTION_DIGEST_AUTH_RANDOM:
- daemon->digest_auth_rand_size = va_arg (ap,
+ case MHD_OPTION_DIGEST_AUTH_RANDOM:
+ daemon->digest_auth_rand_size = va_arg (ap,
size_t);
- daemon->digest_auth_random = va_arg (ap,
+ daemon->digest_auth_random = va_arg (ap,
const char *);
- break;
- case MHD_OPTION_NONCE_NC_SIZE:
- daemon->nonce_nc_size = va_arg (ap,
+ break;
+ case MHD_OPTION_NONCE_NC_SIZE:
+ daemon->nonce_nc_size = va_arg (ap,
unsigned int);
- break;
+ break;
#endif
- case MHD_OPTION_LISTEN_SOCKET:
+ case MHD_OPTION_LISTEN_SOCKET:
if (0 != (daemon->options & MHD_USE_NO_LISTEN_SOCKET))
{
#ifdef HAVE_MESSAGES
@@ -4926,7 +4926,7 @@ parse_options_va (struct MHD_Daemon *daemon,
else
daemon->listen_fd = va_arg (ap,
MHD_socket);
- break;
+ break;
case MHD_OPTION_EXTERNAL_LOGGER:
#ifdef HAVE_MESSAGES
daemon->custom_error_log = va_arg (ap,
@@ -4950,70 +4950,70 @@ parse_options_va (struct MHD_Daemon *daemon,
unsigned int);
break;
#endif
- case MHD_OPTION_LISTENING_ADDRESS_REUSE:
- daemon->listening_address_reuse = va_arg (ap,
+ case MHD_OPTION_LISTENING_ADDRESS_REUSE:
+ daemon->listening_address_reuse = va_arg (ap,
unsigned int) ? 1 : -1;
- break;
- case MHD_OPTION_LISTEN_BACKLOG_SIZE:
- daemon->listen_backlog_size = va_arg (ap,
+ break;
+ case MHD_OPTION_LISTEN_BACKLOG_SIZE:
+ daemon->listen_backlog_size = va_arg (ap,
unsigned int);
- break;
- case MHD_OPTION_STRICT_FOR_CLIENT:
+ break;
+ case MHD_OPTION_STRICT_FOR_CLIENT:
daemon->strict_for_client = va_arg (ap, int);;
#ifdef HAVE_MESSAGES
- if ( (0 != (daemon->options & MHD_USE_PEDANTIC_CHECKS)) &&
- (1 != daemon->strict_for_client) )
+ if ( (0 != (daemon->options & MHD_USE_PEDANTIC_CHECKS)) &&
+ (1 != daemon->strict_for_client) )
{
MHD_DLOG (daemon,
_("Flag MHD_USE_PEDANTIC_CHECKS is ignored because "
"another behavior is specified by
MHD_OPTION_STRICT_CLIENT.\n"));
}
#endif /* HAVE_MESSAGES */
- break;
- case MHD_OPTION_ARRAY:
- oa = va_arg (ap, struct MHD_OptionItem*);
- i = 0;
- while (MHD_OPTION_END != (opt = oa[i].option))
- {
- switch (opt)
- {
- /* all options taking 'size_t' */
- case MHD_OPTION_CONNECTION_MEMORY_LIMIT:
- case MHD_OPTION_CONNECTION_MEMORY_INCREMENT:
- case MHD_OPTION_THREAD_STACK_SIZE:
- if (MHD_YES != parse_options (daemon,
- servaddr,
- opt,
- (size_t) oa[i].value,
- MHD_OPTION_END))
- return MHD_NO;
- break;
- /* all options taking 'unsigned int' */
- case MHD_OPTION_NONCE_NC_SIZE:
- case MHD_OPTION_CONNECTION_LIMIT:
- case MHD_OPTION_CONNECTION_TIMEOUT:
- case MHD_OPTION_PER_IP_CONNECTION_LIMIT:
- case MHD_OPTION_THREAD_POOL_SIZE:
+ break;
+ case MHD_OPTION_ARRAY:
+ oa = va_arg (ap, struct MHD_OptionItem*);
+ i = 0;
+ while (MHD_OPTION_END != (opt = oa[i].option))
+ {
+ switch (opt)
+ {
+ /* all options taking 'size_t' */
+ case MHD_OPTION_CONNECTION_MEMORY_LIMIT:
+ case MHD_OPTION_CONNECTION_MEMORY_INCREMENT:
+ case MHD_OPTION_THREAD_STACK_SIZE:
+ if (MHD_YES != parse_options (daemon,
+ servaddr,
+ opt,
+ (size_t) oa[i].value,
+ MHD_OPTION_END))
+ return MHD_NO;
+ break;
+ /* all options taking 'unsigned int' */
+ case MHD_OPTION_NONCE_NC_SIZE:
+ case MHD_OPTION_CONNECTION_LIMIT:
+ case MHD_OPTION_CONNECTION_TIMEOUT:
+ case MHD_OPTION_PER_IP_CONNECTION_LIMIT:
+ case MHD_OPTION_THREAD_POOL_SIZE:
case MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE:
- case MHD_OPTION_LISTENING_ADDRESS_REUSE:
- case MHD_OPTION_LISTEN_BACKLOG_SIZE:
- if (MHD_YES != parse_options (daemon,
- servaddr,
- opt,
- (unsigned int) oa[i].value,
- MHD_OPTION_END))
- return MHD_NO;
- break;
- /* all options taking 'enum' */
+ case MHD_OPTION_LISTENING_ADDRESS_REUSE:
+ case MHD_OPTION_LISTEN_BACKLOG_SIZE:
+ if (MHD_YES != parse_options (daemon,
+ servaddr,
+ opt,
+ (unsigned int) oa[i].value,
+ MHD_OPTION_END))
+ return MHD_NO;
+ break;
+ /* all options taking 'enum' */
#ifdef HTTPS_SUPPORT
- case MHD_OPTION_HTTPS_CRED_TYPE:
- if (MHD_YES != parse_options (daemon,
- servaddr,
- opt,
- (gnutls_credentials_type_t)
oa[i].value,
- MHD_OPTION_END))
- return MHD_NO;
- break;
+ case MHD_OPTION_HTTPS_CRED_TYPE:
+ if (MHD_YES != parse_options (daemon,
+ servaddr,
+ opt,
+ (gnutls_credentials_type_t) oa[i].value,
+ MHD_OPTION_END))
+ return MHD_NO;
+ break;
#endif /* HTTPS_SUPPORT */
/* all options taking 'MHD_socket' */
case MHD_OPTION_LISTEN_SOCKET:
@@ -5033,53 +5033,53 @@ parse_options_va (struct MHD_Daemon *daemon,
MHD_OPTION_END))
return MHD_NO;
break;
- /* all options taking one pointer */
- case MHD_OPTION_SOCK_ADDR:
- case MHD_OPTION_HTTPS_MEM_KEY:
- case MHD_OPTION_HTTPS_KEY_PASSWORD:
- case MHD_OPTION_HTTPS_MEM_CERT:
- case MHD_OPTION_HTTPS_MEM_TRUST:
- case MHD_OPTION_HTTPS_MEM_DHPARAMS:
- case MHD_OPTION_HTTPS_PRIORITIES:
- case MHD_OPTION_ARRAY:
+ /* all options taking one pointer */
+ case MHD_OPTION_SOCK_ADDR:
+ case MHD_OPTION_HTTPS_MEM_KEY:
+ case MHD_OPTION_HTTPS_KEY_PASSWORD:
+ case MHD_OPTION_HTTPS_MEM_CERT:
+ case MHD_OPTION_HTTPS_MEM_TRUST:
+ case MHD_OPTION_HTTPS_MEM_DHPARAMS:
+ case MHD_OPTION_HTTPS_PRIORITIES:
+ case MHD_OPTION_ARRAY:
case MHD_OPTION_HTTPS_CERT_CALLBACK:
- if (MHD_YES != parse_options (daemon,
- servaddr,
- opt,
- oa[i].ptr_value,
- MHD_OPTION_END))
- return MHD_NO;
- break;
- /* all options taking two pointers */
- case MHD_OPTION_NOTIFY_COMPLETED:
- case MHD_OPTION_NOTIFY_CONNECTION:
- case MHD_OPTION_URI_LOG_CALLBACK:
- case MHD_OPTION_EXTERNAL_LOGGER:
- case MHD_OPTION_UNESCAPE_CALLBACK:
- if (MHD_YES != parse_options (daemon,
- servaddr,
- opt,
- (void *) oa[i].value,
- oa[i].ptr_value,
- MHD_OPTION_END))
- return MHD_NO;
- break;
- /* options taking size_t-number followed by pointer */
- case MHD_OPTION_DIGEST_AUTH_RANDOM:
- if (MHD_YES != parse_options (daemon,
- servaddr,
- opt,
- (size_t) oa[i].value,
- oa[i].ptr_value,
- MHD_OPTION_END))
- return MHD_NO;
- break;
- default:
- return MHD_NO;
- }
- i++;
- }
- break;
+ if (MHD_YES != parse_options (daemon,
+ servaddr,
+ opt,
+ oa[i].ptr_value,
+ MHD_OPTION_END))
+ return MHD_NO;
+ break;
+ /* all options taking two pointers */
+ case MHD_OPTION_NOTIFY_COMPLETED:
+ case MHD_OPTION_NOTIFY_CONNECTION:
+ case MHD_OPTION_URI_LOG_CALLBACK:
+ case MHD_OPTION_EXTERNAL_LOGGER:
+ case MHD_OPTION_UNESCAPE_CALLBACK:
+ if (MHD_YES != parse_options (daemon,
+ servaddr,
+ opt,
+ (void *) oa[i].value,
+ oa[i].ptr_value,
+ MHD_OPTION_END))
+ return MHD_NO;
+ break;
+ /* options taking size_t-number followed by pointer */
+ case MHD_OPTION_DIGEST_AUTH_RANDOM:
+ if (MHD_YES != parse_options (daemon,
+ servaddr,
+ opt,
+ (size_t) oa[i].value,
+ oa[i].ptr_value,
+ MHD_OPTION_END))
+ return MHD_NO;
+ break;
+ default:
+ return MHD_NO;
+ }
+ i++;
+ }
+ break;
case MHD_OPTION_UNESCAPE_CALLBACK:
daemon->unescape_callback = va_arg (ap,
UnescapeCallback);
@@ -5093,17 +5093,17 @@ parse_options_va (struct MHD_Daemon *daemon,
(opt == MHD_OPTION_HTTPS_MEM_TRUST))
{
MHD_DLOG (daemon,
- _("MHD HTTPS option %d passed to MHD compiled without
HTTPS support\n"),
- opt);
+ _("MHD HTTPS option %d passed to MHD compiled without HTTPS support\n"),
+ opt);
}
else
{
MHD_DLOG (daemon,
- _("Invalid option %d! (Did you terminate the list with
MHD_OPTION_END?)\n"),
- opt);
+ _("Invalid option %d! (Did you terminate the list with
MHD_OPTION_END?)\n"),
+ opt);
}
#endif
- return MHD_NO;
+ return MHD_NO;
}
}
return MHD_YES;
@@ -5179,9 +5179,9 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
event.events = EPOLLIN;
event.data.ptr = daemon;
if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_ADD,
- ls,
- &event))
+ EPOLL_CTL_ADD,
+ ls,
+ &event))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
@@ -5241,7 +5241,7 @@ MHD_start_daemon_va (unsigned int flags,
void *apc_cls,
MHD_AccessHandlerCallback dh,
void *dh_cls,
- va_list ap)
+ va_list ap)
{
const MHD_SCKT_OPT_BOOL_ on = 1;
struct MHD_Daemon *daemon;
@@ -5345,8 +5345,8 @@ MHD_start_daemon_va (unsigned int flags,
if (0 != (*pflags & MHD_USE_TLS))
{
gnutls_priority_init (&daemon->priority_cache,
- "NORMAL",
- NULL);
+ "NORMAL",
+ NULL);
}
#endif /* HTTPS_SUPPORT */
daemon->listen_fd = MHD_INVALID_SOCKET;
@@ -5414,8 +5414,8 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HTTPS_SUPPORT
if ( (0 != (*pflags & MHD_USE_TLS)) &&
- (NULL != daemon->priority_cache) )
- gnutls_priority_deinit (daemon->priority_cache);
+ (NULL != daemon->priority_cache) )
+ gnutls_priority_deinit (daemon->priority_cache);
#endif /* HTTPS_SUPPORT */
free (daemon);
return NULL;
@@ -5464,45 +5464,45 @@ MHD_start_daemon_va (unsigned int flags,
if (daemon->nonce_nc_size > 0)
{
if ( ( (size_t) (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc))) /
- sizeof(struct MHD_NonceNc) != daemon->nonce_nc_size)
- {
+ sizeof(struct MHD_NonceNc) != daemon->nonce_nc_size)
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Specified value for NC_SIZE too large\n"));
+ MHD_DLOG (daemon,
+ _("Specified value for NC_SIZE too large\n"));
#endif
#ifdef HTTPS_SUPPORT
- if (0 != (*pflags & MHD_USE_TLS))
- gnutls_priority_deinit (daemon->priority_cache);
+ if (0 != (*pflags & MHD_USE_TLS))
+ gnutls_priority_deinit (daemon->priority_cache);
#endif /* HTTPS_SUPPORT */
- free (daemon);
- return NULL;
- }
+ free (daemon);
+ return NULL;
+ }
daemon->nnc = malloc (daemon->nonce_nc_size * sizeof (struct
MHD_NonceNc));
if (NULL == daemon->nnc)
- {
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Failed to allocate memory for nonce-nc map: %s\n"),
- MHD_strerror_ (errno));
+ MHD_DLOG (daemon,
+ _("Failed to allocate memory for nonce-nc map: %s\n"),
+ MHD_strerror_ (errno));
#endif
#ifdef HTTPS_SUPPORT
- if (0 != (*pflags & MHD_USE_TLS))
- gnutls_priority_deinit (daemon->priority_cache);
+ if (0 != (*pflags & MHD_USE_TLS))
+ gnutls_priority_deinit (daemon->priority_cache);
#endif /* HTTPS_SUPPORT */
- free (daemon);
- return NULL;
- }
+ free (daemon);
+ return NULL;
+ }
}
if (! MHD_mutex_init_ (&daemon->nnc_lock))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("MHD failed to initialize nonce-nc mutex\n"));
+ _("MHD failed to initialize nonce-nc mutex\n"));
#endif
#ifdef HTTPS_SUPPORT
if (0 != (*pflags & MHD_USE_TLS))
- gnutls_priority_deinit (daemon->priority_cache);
+ gnutls_priority_deinit (daemon->priority_cache);
#endif /* HTTPS_SUPPORT */
free (daemon->nnc);
free (daemon);
@@ -5516,7 +5516,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("MHD thread pooling only works with
MHD_USE_INTERNAL_POLLING_THREAD\n"));
+ _("MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n"));
#endif
goto free_and_fail;
}
@@ -5527,14 +5527,14 @@ MHD_start_daemon_va (unsigned int flags,
/* try to open listen socket */
listen_fd = MHD_socket_create_listen_(*pflags & MHD_USE_IPv6);
if (MHD_INVALID_SOCKET == listen_fd)
- {
+ {
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Failed to create socket for listening: %s\n"),
MHD_socket_last_strerr_ ());
#endif
- goto free_and_fail;
- }
+ goto free_and_fail;
+ }
/* Apply the socket options according to listening_address_reuse. */
if (0 == daemon->listening_address_reuse)
@@ -5647,60 +5647,60 @@ MHD_start_daemon_va (unsigned int flags,
/* check for user supplied sockaddr */
#if HAVE_INET6
if (0 != (*pflags & MHD_USE_IPv6))
- addrlen = sizeof (struct sockaddr_in6);
+ addrlen = sizeof (struct sockaddr_in6);
else
#endif
- addrlen = sizeof (struct sockaddr_in);
+ addrlen = sizeof (struct sockaddr_in);
if (NULL == servaddr)
- {
+ {
#if HAVE_INET6
- if (0 != (*pflags & MHD_USE_IPv6))
- {
+ if (0 != (*pflags & MHD_USE_IPv6))
+ {
#ifdef IN6ADDR_ANY_INIT
- static const struct in6_addr static_in6any = IN6ADDR_ANY_INIT;
+ static const struct in6_addr static_in6any = IN6ADDR_ANY_INIT;
#endif
memset (&servaddr6,
0,
sizeof (struct sockaddr_in6));
- servaddr6.sin6_family = AF_INET6;
- servaddr6.sin6_port = htons (port);
+ servaddr6.sin6_family = AF_INET6;
+ servaddr6.sin6_port = htons (port);
#ifdef IN6ADDR_ANY_INIT
- servaddr6.sin6_addr = static_in6any;
+ servaddr6.sin6_addr = static_in6any;
#endif
#if HAVE_SOCKADDR_IN_SIN_LEN
- servaddr6.sin6_len = sizeof (struct sockaddr_in6);
+ servaddr6.sin6_len = sizeof (struct sockaddr_in6);
#endif
- servaddr = (struct sockaddr *) &servaddr6;
- }
- else
+ servaddr = (struct sockaddr *) &servaddr6;
+ }
+ else
#endif
- {
- memset (&servaddr4,
+ {
+ memset (&servaddr4,
0,
sizeof (struct sockaddr_in));
- servaddr4.sin_family = AF_INET;
- servaddr4.sin_port = htons (port);
- if (0 != INADDR_ANY)
- servaddr4.sin_addr.s_addr = htonl (INADDR_ANY);
+ servaddr4.sin_family = AF_INET;
+ servaddr4.sin_port = htons (port);
+ if (0 != INADDR_ANY)
+ servaddr4.sin_addr.s_addr = htonl (INADDR_ANY);
#if HAVE_SOCKADDR_IN_SIN_LEN
- servaddr4.sin_len = sizeof (struct sockaddr_in);
+ servaddr4.sin_len = sizeof (struct sockaddr_in);
#endif
- servaddr = (struct sockaddr *) &servaddr4;
- }
- }
+ servaddr = (struct sockaddr *) &servaddr4;
+ }
+ }
daemon->listen_fd = listen_fd;
if (0 != (*pflags & MHD_USE_IPv6))
- {
+ {
#ifdef IPPROTO_IPV6
#ifdef IPV6_V6ONLY
- /* Note: "IPV6_V6ONLY" is declared by Windows Vista ff., see
"IPPROTO_IPV6 Socket Options"
-
(http://msdn.microsoft.com/en-us/library/ms738574%28v=VS.85%29.aspx);
- and may also be missing on older POSIX systems; good luck if you
have any of those,
- your IPv6 socket may then also bind against IPv4 anyway... */
- const MHD_SCKT_OPT_BOOL_ v6_only =
+ /* Note: "IPV6_V6ONLY" is declared by Windows Vista ff., see "IPPROTO_IPV6
Socket Options"
+ (http://msdn.microsoft.com/en-us/library/ms738574%28v=VS.85%29.aspx);
+ and may also be missing on older POSIX systems; good luck if you have
any of those,
+ your IPv6 socket may then also bind against IPv4 anyway... */
+ const MHD_SCKT_OPT_BOOL_ v6_only =
(MHD_USE_DUAL_STACK != (*pflags & MHD_USE_DUAL_STACK));
- if (0 > setsockopt (listen_fd,
+ if (0 > setsockopt (listen_fd,
IPPROTO_IPV6, IPV6_V6ONLY,
(const void *) &v6_only,
sizeof (v6_only)))
@@ -5713,18 +5713,18 @@ MHD_start_daemon_va (unsigned int flags,
}
#endif
#endif
- }
+ }
if (-1 == bind (listen_fd, servaddr, addrlen))
- {
+ {
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Failed to bind to port %u: %s\n"),
(unsigned int) port,
MHD_socket_last_strerr_ ());
#endif
- MHD_socket_close_chk_ (listen_fd);
- goto free_and_fail;
- }
+ MHD_socket_close_chk_ (listen_fd);
+ goto free_and_fail;
+ }
#ifdef TCP_FASTOPEN
if (0 != (*pflags & MHD_USE_TCP_FASTOPEN))
{
@@ -5746,15 +5746,15 @@ MHD_start_daemon_va (unsigned int flags,
#endif
if (listen (listen_fd,
daemon->listen_backlog_size) < 0)
- {
+ {
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Failed to listen for connections: %s\n"),
MHD_socket_last_strerr_ ());
#endif
- MHD_socket_close_chk_ (listen_fd);
- goto free_and_fail;
- }
+ MHD_socket_close_chk_ (listen_fd);
+ goto free_and_fail;
+ }
}
else
{
@@ -5866,15 +5866,15 @@ MHD_start_daemon_va (unsigned int flags,
(0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) )
{
if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION))
- {
+ {
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Combining MHD_USE_THREAD_PER_CONNECTION and
MHD_USE_EPOLL is not supported.\n"));
+ MHD_DLOG (daemon,
+ _("Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not
supported.\n"));
#endif
- goto free_and_fail;
- }
+ goto free_and_fail;
+ }
if (MHD_YES != setup_epoll_to_listen (daemon))
- goto free_and_fail;
+ goto free_and_fail;
}
#endif /* EPOLL_SUPPORT */
@@ -5911,7 +5911,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Failed to initialize TLS support\n"));
+ _("Failed to initialize TLS support\n"));
#endif
if (MHD_INVALID_SOCKET != listen_fd)
MHD_socket_close_chk_ (listen_fd);
@@ -6083,10 +6083,10 @@ thread_failed:
if (daemon->upgrade_fd_in_epoll)
{
if (0 != epoll_ctl (daemon->epoll_fd,
- EPOLL_CTL_DEL,
- daemon->epoll_upgrade_fd,
- NULL))
- MHD_PANIC (_("Failed to remove FD from epoll set\n"));
+ EPOLL_CTL_DEL,
+ daemon->epoll_upgrade_fd,
+ NULL))
+ MHD_PANIC (_("Failed to remove FD from epoll set\n"));
daemon->upgrade_fd_in_epoll = false;
}
#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -6425,8 +6425,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
*/
const union MHD_DaemonInfo *
MHD_get_daemon_info (struct MHD_Daemon *daemon,
- enum MHD_DaemonInfoType info_type,
- ...)
+ enum MHD_DaemonInfoType info_type,
+ ...)
{
if (NULL == daemon)
return NULL;
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 7226becf..7edf280a 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -48,7 +48,7 @@
/**
* Beginning string for any valid Digest authentication header.
*/
-#define _BASE "Digest "
+#define _BASE "Digest "
/**
* Maximum length of a username for digest authentication.
@@ -75,8 +75,8 @@
*/
static void
cvthex (const unsigned char *bin,
- size_t len,
- char *hex)
+ size_t len,
+ char *hex)
{
size_t i;
unsigned int j;
@@ -106,12 +106,12 @@ cvthex (const unsigned char *bin,
*/
static void
digest_calc_ha1 (const char *alg,
- const char *username,
- const char *realm,
- const char *password,
- const char *nonce,
- const char *cnonce,
- char sessionkey[HASH_MD5_HEX_LEN + 1])
+ const char *username,
+ const char *realm,
+ const char *password,
+ const char *nonce,
+ const char *cnonce,
+ char sessionkey[HASH_MD5_HEX_LEN + 1])
{
struct MD5Context md5;
unsigned char ha1[MD5_DIGEST_SIZE];
@@ -177,14 +177,14 @@ digest_calc_ha1 (const char *alg,
*/
static void
digest_calc_response (const char ha1[HASH_MD5_HEX_LEN + 1],
- const char *nonce,
- const char *noncecount,
- const char *cnonce,
- const char *qop,
- const char *method,
- const char *uri,
- const char *hentity,
- char response[HASH_MD5_HEX_LEN + 1])
+ const char *nonce,
+ const char *noncecount,
+ const char *cnonce,
+ const char *qop,
+ const char *method,
+ const char *uri,
+ const char *hentity,
+ char response[HASH_MD5_HEX_LEN + 1])
{
struct MD5Context md5;
unsigned char ha2[MD5_DIGEST_SIZE];
@@ -207,12 +207,12 @@ digest_calc_response (const char ha1[HASH_MD5_HEX_LEN +
1],
"auth-int"))
{
/* This is dead code since the rest of this module does
- not support auth-int. */
+ not support auth-int. */
MD5Update (&md5,
":",
1);
if (NULL != hentity)
- MD5Update (&md5,
+ MD5Update (&md5,
hentity,
strlen (hentity));
}
@@ -284,9 +284,9 @@ digest_calc_response (const char ha1[HASH_MD5_HEX_LEN + 1],
*/
static size_t
lookup_sub_value (char *dest,
- size_t size,
- const char *data,
- const char *key)
+ size_t size,
+ const char *data,
+ const char *key)
{
size_t keylen;
size_t len;
@@ -304,63 +304,63 @@ lookup_sub_value (char *dest,
{
if (NULL == (eq = strchr (ptr,
'=')))
- return 0;
+ return 0;
q1 = eq + 1;
while (' ' == *q1)
- q1++;
+ q1++;
if ('\"' != *q1)
- {
- q2 = strchr (q1,
+ {
+ q2 = strchr (q1,
',');
- qn = q2;
- }
+ qn = q2;
+ }
else
- {
- q1++;
- q2 = strchr (q1,
+ {
+ q1++;
+ q2 = strchr (q1,
'\"');
- if (NULL == q2)
- return 0; /* end quote not found */
- qn = q2 + 1;
- }
+ if (NULL == q2)
+ return 0; /* end quote not found */
+ qn = q2 + 1;
+ }
if ( (MHD_str_equal_caseless_n_(ptr,
key,
keylen)) &&
- (eq == &ptr[keylen]) )
- {
- if (NULL == q2)
- {
- len = strlen (q1) + 1;
- if (size > len)
- size = len;
- size--;
- strncpy (dest,
- q1,
- size);
- dest[size] = '\0';
- return size;
- }
- else
- {
- if (size > (size_t) ((q2 - q1) + 1))
- size = (q2 - q1) + 1;
- size--;
- memcpy (dest,
- q1,
- size);
- dest[size] = '\0';
- return size;
- }
- }
+ (eq == &ptr[keylen]) )
+ {
+ if (NULL == q2)
+ {
+ len = strlen (q1) + 1;
+ if (size > len)
+ size = len;
+ size--;
+ strncpy (dest,
+ q1,
+ size);
+ dest[size] = '\0';
+ return size;
+ }
+ else
+ {
+ if (size > (size_t) ((q2 - q1) + 1))
+ size = (q2 - q1) + 1;
+ size--;
+ memcpy (dest,
+ q1,
+ size);
+ dest[size] = '\0';
+ return size;
+ }
+ }
if (NULL == qn)
- return 0;
+ return 0;
ptr = strchr (qn,
',');
if (NULL == ptr)
- return 0;
+ return 0;
ptr++;
while (' ' == *ptr)
- ptr++;
+ ptr++;
}
return 0;
}
@@ -377,8 +377,8 @@ lookup_sub_value (char *dest,
*/
static int
check_nonce_nc (struct MHD_Connection *connection,
- const char *nonce,
- uint64_t nc)
+ const char *nonce,
+ uint64_t nc)
{
struct MHD_Daemon *daemon = connection->daemon;
struct MHD_NonceNc *nn;
@@ -414,7 +414,7 @@ check_nonce_nc (struct MHD_Connection *connection,
{
/* Fresh nonce, reinitialize array */
strcpy (nn->nonce,
- nonce);
+ nonce);
nn->nc = 0;
nn->nmask = 0;
MHD_mutex_unlock_chk_ (&daemon->nnc_lock);
@@ -441,7 +441,7 @@ check_nonce_nc (struct MHD_Connection *connection,
MHD_mutex_unlock_chk_ (&daemon->nnc_lock);
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Stale nonce received. If this happens a lot, you should
probably increase the size of the nonce array.\n"));
+ _("Stale nonce received. If this happens a lot, you should probably
increase the size of the nonce array.\n"));
#endif
return MHD_NO;
}
@@ -461,7 +461,7 @@ check_nonce_nc (struct MHD_Connection *connection,
*
* @param connection The MHD connection structure
* @return NULL if no username could be found, a pointer
- * to the username if found
+ * to the username if found
* @warning Returned value must be freed by #MHD_free().
* @ingroup authentication
*/
@@ -483,9 +483,9 @@ MHD_digest_auth_get_username(struct MHD_Connection
*connection)
return NULL;
header += MHD_STATICSTR_LEN_ (_BASE);
if (0 == (len = lookup_sub_value (user,
- sizeof (user),
- header,
- "username")))
+ sizeof (user),
+ header,
+ "username")))
return NULL;
return strdup (user);
}
@@ -506,12 +506,12 @@ MHD_digest_auth_get_username(struct MHD_Connection
*connection)
*/
static void
calculate_nonce (uint32_t nonce_time,
- const char *method,
- const char *rnd,
- size_t rnd_size,
- const char *uri,
- const char *realm,
- char nonce[NONCE_STD_LEN + 1])
+ const char *method,
+ const char *rnd,
+ size_t rnd_size,
+ const char *uri,
+ const char *realm,
+ char nonce[NONCE_STD_LEN + 1])
{
struct MD5Context md5;
unsigned char timestamp[TIMESTAMP_BIN_SIZE];
@@ -578,27 +578,27 @@ calculate_nonce (uint32_t nonce_time,
*/
static int
test_header (struct MHD_Connection *connection,
- const char *key,
- const char *value,
- enum MHD_ValueKind kind)
+ const char *key,
+ const char *value,
+ enum MHD_ValueKind kind)
{
struct MHD_HTTP_Header *pos;
for (pos = connection->headers_received; NULL != pos; pos = pos->next)
{
if (kind != pos->kind)
- continue;
+ continue;
if (0 != strcmp (key,
pos->header))
- continue;
+ continue;
if ( (NULL == value) &&
- (NULL == pos->value) )
- return MHD_YES;
+ (NULL == pos->value) )
+ return MHD_YES;
if ( (NULL == value) ||
- (NULL == pos->value) ||
- (0 != strcmp (value,
+ (NULL == pos->value) ||
+ (0 != strcmp (value,
pos->value)) )
- continue;
+ continue;
return MHD_YES;
}
return MHD_NO;
@@ -617,7 +617,7 @@ test_header (struct MHD_Connection *connection,
*/
static int
check_argument_match (struct MHD_Connection *connection,
- const char *args)
+ const char *args)
{
struct MHD_HTTP_Header *pos;
char *argb;
@@ -629,15 +629,15 @@ check_argument_match (struct MHD_Connection *connection,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
- _("Failed to allocate memory for copy of URI arguments\n"));
+ _("Failed to allocate memory for copy of URI arguments\n"));
#endif /* HAVE_MESSAGES */
return MHD_NO;
}
ret = MHD_parse_arguments_ (connection,
- MHD_GET_ARGUMENT_KIND,
- argb,
- &test_header,
- &num_headers);
+ MHD_GET_ARGUMENT_KIND,
+ argb,
+ &test_header,
+ &num_headers);
free (argb);
if (MHD_YES != ret)
return MHD_NO;
@@ -645,7 +645,7 @@ check_argument_match (struct MHD_Connection *connection,
for (pos = connection->headers_received; NULL != pos; pos = pos->next)
{
if (MHD_GET_ARGUMENT_KIND != pos->kind)
- continue;
+ continue;
num_headers--;
}
if (0 != num_headers)
@@ -665,17 +665,17 @@ check_argument_match (struct MHD_Connection *connection,
* @param username The username needs to be authenticated
* @param password The password used in the authentication
* @param nonce_timeout The amount of time for a nonce to be
- * invalid in seconds
+ * invalid in seconds
* @return #MHD_YES if authenticated, #MHD_NO if not,
- * #MHD_INVALID_NONCE if nonce is invalid
+ * #MHD_INVALID_NONCE if nonce is invalid
* @ingroup authentication
*/
int
MHD_digest_auth_check (struct MHD_Connection *connection,
- const char *realm,
- const char *username,
- const char *password,
- unsigned int nonce_timeout)
+ const char *realm,
+ const char *username,
+ const char *password,
+ unsigned int nonce_timeout)
{
struct MHD_Daemon *daemon = connection->daemon;
size_t len;
@@ -695,8 +695,8 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
uint64_t nci;
header = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_AUTHORIZATION);
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_AUTHORIZATION);
if (NULL == header)
return MHD_NO;
if (0 != strncmp (header,
@@ -710,11 +710,11 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
char un[MAX_USERNAME_LENGTH];
len = lookup_sub_value (un,
- sizeof (un),
- header,
+ sizeof (un),
+ header,
"username");
if ( (0 == len) ||
- (0 != strcmp (username,
+ (0 != strcmp (username,
un)) )
return MHD_NO;
left -= strlen ("username") + len;
@@ -728,15 +728,15 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
header,
"realm");
if ( (0 == len) ||
- (0 != strcmp (realm,
+ (0 != strcmp (realm,
r)) )
return MHD_NO;
left -= strlen ("realm") + len;
}
if (0 == (len = lookup_sub_value (nonce,
- sizeof (nonce),
- header,
+ sizeof (nonce),
+ header,
"nonce")))
return MHD_NO;
left -= strlen ("nonce") + len;
@@ -819,7 +819,7 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Authentication failed, invalid format.\n"));
+ _("Authentication failed, invalid format.\n"));
#endif
return MHD_NO;
}
@@ -829,7 +829,7 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Authentication failed, invalid nc format.\n"));
+ _("Authentication failed, invalid nc format.\n"));
#endif
return MHD_NO; /* invalid nonce format */
}
@@ -876,26 +876,26 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
cnonce,
ha1);
digest_calc_response (ha1,
- nonce,
- nc,
- cnonce,
- qop,
- connection->method,
- uri,
- hentity,
- respexp);
+ nonce,
+ nc,
+ cnonce,
+ qop,
+ connection->method,
+ uri,
+ hentity,
+ respexp);
/* Need to unescape URI before comparing with connection->url */
daemon->unescape_callback (daemon->unescape_callback_cls,
connection,
uri);
if (0 != strncmp (uri,
- connection->url,
- strlen (connection->url)))
+ connection->url,
+ strlen (connection->url)))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Authentication failed, URI does not match.\n"));
+ _("Authentication failed, URI does not match.\n"));
#endif
free (uri);
return MHD_NO;
@@ -906,16 +906,16 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
'?');
if (NULL == args)
- args = "";
+ args = "";
else
- args++;
+ args++;
if (MHD_YES !=
- check_argument_match (connection,
- args) )
+ check_argument_match (connection,
+ args) )
{
#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Authentication failed, arguments do not match.\n"));
+ MHD_DLOG (daemon,
+ _("Authentication failed, arguments do not match.\n"));
#endif
free (uri);
return MHD_NO;
@@ -940,16 +940,16 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
* body; note that this function will set the "WWW Authenticate"
* header and that the caller should not do this
* @param signal_stale #MHD_YES if the nonce is invalid to add
- * 'stale=true' to the authentication header
+ * 'stale=true' to the authentication header
* @return #MHD_YES on success, #MHD_NO otherwise
* @ingroup authentication
*/
int
MHD_queue_auth_fail_response (struct MHD_Connection *connection,
- const char *realm,
- const char *opaque,
- struct MHD_Response *response,
- int signal_stale)
+ const char *realm,
+ const char *opaque,
+ struct MHD_Response *response,
+ int signal_stale)
{
int ret;
int hlen;
@@ -957,12 +957,12 @@ MHD_queue_auth_fail_response (struct MHD_Connection
*connection,
/* Generating the server nonce */
calculate_nonce ((uint32_t) MHD_monotonic_sec_counter(),
- connection->method,
- connection->daemon->digest_auth_random,
- connection->daemon->digest_auth_rand_size,
- connection->url,
- realm,
- nonce);
+ connection->method,
+ connection->daemon->digest_auth_random,
+ connection->daemon->digest_auth_rand_size,
+ connection->url,
+ realm,
+ nonce);
if (MHD_YES !=
check_nonce_nc (connection,
nonce,
@@ -970,7 +970,7 @@ MHD_queue_auth_fail_response (struct MHD_Connection
*connection,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
- _("Could not register nonce (is the nonce array size
zero?).\n"));
+ _("Could not register nonce (is the nonce array size zero?).\n"));
#endif
return MHD_NO;
}
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index d2532c54..23b14faa 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -142,24 +142,24 @@ MHD_http_unescape (char *val)
{
uint32_t num;
switch (*rpos)
- {
- case '%':
+ {
+ case '%':
if (2 == MHD_strx_to_uint32_n_ (rpos + 1,
2,
&num))
- {
- *wpos = (char)((unsigned char) num);
- wpos++;
- rpos += 3;
- break;
- }
+ {
+ *wpos = (char)((unsigned char) num);
+ wpos++;
+ rpos += 3;
+ break;
+ }
/* TODO: add bad sequence handling */
- /* intentional fall through! */
- default:
- *wpos = *rpos;
- wpos++;
- rpos++;
- }
+ /* intentional fall through! */
+ default:
+ *wpos = *rpos;
+ wpos++;
+ rpos++;
+ }
}
*wpos = '\0'; /* add 0-terminator */
return wpos - val; /* = strlen(val) */
@@ -182,10 +182,10 @@ MHD_http_unescape (char *val)
*/
int
MHD_parse_arguments_ (struct MHD_Connection *connection,
- enum MHD_ValueKind kind,
- char *args,
- MHD_ArgumentIterator_ cb,
- unsigned int *num_headers)
+ enum MHD_ValueKind kind,
+ char *args,
+ MHD_ArgumentIterator_ cb,
+ unsigned int *num_headers)
{
struct MHD_Daemon *daemon = connection->daemon;
char *equals;
@@ -193,84 +193,84 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
*num_headers = 0;
while ( (NULL != args) &&
- ('\0' != args[0]) )
+ ('\0' != args[0]) )
{
equals = strchr (args, '=');
amper = strchr (args, '&');
if (NULL == amper)
- {
- /* last argument */
- if (NULL == equals)
- {
- /* last argument, without '=' */
+ {
+ /* last argument */
+ if (NULL == equals)
+ {
+ /* last argument, without '=' */
MHD_unescape_plus (args);
- daemon->unescape_callback (daemon->unescape_callback_cls,
- connection,
- args);
- if (MHD_YES != cb (connection,
- args,
- NULL,
- kind))
- return MHD_NO;
- (*num_headers)++;
- break;
- }
- /* got 'foo=bar' */
- equals[0] = '\0';
- equals++;
+ daemon->unescape_callback (daemon->unescape_callback_cls,
+ connection,
+ args);
+ if (MHD_YES != cb (connection,
+ args,
+ NULL,
+ kind))
+ return MHD_NO;
+ (*num_headers)++;
+ break;
+ }
+ /* got 'foo=bar' */
+ equals[0] = '\0';
+ equals++;
MHD_unescape_plus (args);
- daemon->unescape_callback (daemon->unescape_callback_cls,
- connection,
- args);
+ daemon->unescape_callback (daemon->unescape_callback_cls,
+ connection,
+ args);
MHD_unescape_plus (equals);
- daemon->unescape_callback (daemon->unescape_callback_cls,
- connection,
- equals);
- if (MHD_YES != cb (connection,
- args,
- equals,
- kind))
- return MHD_NO;
- (*num_headers)++;
- break;
- }
+ daemon->unescape_callback (daemon->unescape_callback_cls,
+ connection,
+ equals);
+ if (MHD_YES != cb (connection,
+ args,
+ equals,
+ kind))
+ return MHD_NO;
+ (*num_headers)++;
+ break;
+ }
/* amper is non-NULL here */
amper[0] = '\0';
amper++;
if ( (NULL == equals) ||
- (equals >= amper) )
- {
- /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value
*/
+ (equals >= amper) )
+ {
+ /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */
MHD_unescape_plus (args);
- daemon->unescape_callback (daemon->unescape_callback_cls,
- connection,
- args);
- if (MHD_YES != cb (connection,
- args,
- NULL,
- kind))
- return MHD_NO;
- /* continue with 'bar' */
- (*num_headers)++;
- args = amper;
- continue;
- }
+ daemon->unescape_callback (daemon->unescape_callback_cls,
+ connection,
+ args);
+ if (MHD_YES != cb (connection,
+ args,
+ NULL,
+ kind))
+ return MHD_NO;
+ /* continue with 'bar' */
+ (*num_headers)++;
+ args = amper;
+ continue;
+ }
/* equals and amper are non-NULL here, and equals < amper,
- so we got regular 'foo=value&bar...'-kind of argument */
+ so we got regular 'foo=value&bar...'-kind of argument */
equals[0] = '\0';
equals++;
MHD_unescape_plus (args);
daemon->unescape_callback (daemon->unescape_callback_cls,
- connection,
- args);
+ connection,
+ args);
MHD_unescape_plus (equals);
daemon->unescape_callback (daemon->unescape_callback_cls,
- connection,
- equals);
+ connection,
+ equals);
if (MHD_YES != cb (connection,
- args,
- equals,
- kind))
+ args,
+ equals,
+ kind))
return MHD_NO;
(*num_headers)++;
args = amper;
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 5668a8f8..1064fb21 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -248,7 +248,7 @@ struct MHD_NonceNc
*/
void
MHD_DLOG (const struct MHD_Daemon *daemon,
- const char *format,
+ const char *format,
...);
#endif
@@ -1850,9 +1850,9 @@ MHD_unescape_plus (char *arg);
*/
typedef int
(*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
- const char *key,
- const char *value,
- enum MHD_ValueKind kind);
+ const char *key,
+ const char *value,
+ enum MHD_ValueKind kind);
/**
@@ -1871,10 +1871,10 @@ typedef int
*/
int
MHD_parse_arguments_ (struct MHD_Connection *connection,
- enum MHD_ValueKind kind,
- char *args,
- MHD_ArgumentIterator_ cb,
- unsigned int *num_headers);
+ enum MHD_ValueKind kind,
+ char *args,
+ MHD_ArgumentIterator_ cb,
+ unsigned int *num_headers);
/**
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index d92a42ee..370b11ef 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -1,6 +1,6 @@
/*
* This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
+ * The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
@@ -20,21 +20,21 @@
#include "md5.h"
#include "mhd_byteorder.h"
-#define PUT_64BIT_LE(cp, value) do { \
- (cp)[7] = (uint8_t)((value) >> 56); \
- (cp)[6] = (uint8_t)((value) >> 48); \
- (cp)[5] = (uint8_t)((value) >> 40); \
- (cp)[4] = (uint8_t)((value) >> 32); \
- (cp)[3] = (uint8_t)((value) >> 24); \
- (cp)[2] = (uint8_t)((value) >> 16); \
- (cp)[1] = (uint8_t)((value) >> 8); \
- (cp)[0] = (uint8_t)((value)); } while (0)
-
-#define PUT_32BIT_LE(cp, value) do { \
- (cp)[3] = (uint8_t)((value) >> 24); \
- (cp)[2] = (uint8_t)((value) >> 16); \
- (cp)[1] = (uint8_t)((value) >> 8); \
- (cp)[0] = (uint8_t)((value)); } while (0)
+#define PUT_64BIT_LE(cp, value) do { \
+ (cp)[7] = (uint8_t)((value) >> 56); \
+ (cp)[6] = (uint8_t)((value) >> 48); \
+ (cp)[5] = (uint8_t)((value) >> 40); \
+ (cp)[4] = (uint8_t)((value) >> 32); \
+ (cp)[3] = (uint8_t)((value) >> 24); \
+ (cp)[2] = (uint8_t)((value) >> 16); \
+ (cp)[1] = (uint8_t)((value) >> 8); \
+ (cp)[0] = (uint8_t)((value)); } while (0)
+
+#define PUT_32BIT_LE(cp, value) do { \
+ (cp)[3] = (uint8_t)((value) >> 24); \
+ (cp)[2] = (uint8_t)((value) >> 16); \
+ (cp)[1] = (uint8_t)((value) >> 8); \
+ (cp)[0] = (uint8_t)((value)); } while (0)
static uint8_t PADDING[MD5_BLOCK_SIZE] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -124,7 +124,7 @@ MD5Pad(struct MD5Context *ctx)
((ctx->count >> 3) & (MD5_BLOCK_SIZE - 1));
if (padlen < 1 + 8)
padlen += MD5_BLOCK_SIZE;
- MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
+ MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
MD5Update(ctx, count, 8);
}
@@ -157,7 +157,7 @@ MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct
MD5Context *ctx)
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
+ ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
diff --git a/src/microhttpd/md5.h b/src/microhttpd/md5.h
index ad1151e9..5d39a3b4 100644
--- a/src/microhttpd/md5.h
+++ b/src/microhttpd/md5.h
@@ -1,6 +1,6 @@
/*
* This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
+ * The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
@@ -20,15 +20,15 @@
#include "platform.h"
-#define MD5_BLOCK_SIZE 64
-#define MD5_DIGEST_SIZE 16
-#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_SIZE * 2 + 1)
+#define MD5_BLOCK_SIZE 64
+#define MD5_DIGEST_SIZE 16
+#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_SIZE * 2 + 1)
struct MD5Context
{
- uint32_t state[4]; /* state */
- uint64_t count; /* number of bits, mod 2^64 */
- uint8_t buffer[MD5_BLOCK_SIZE]; /* input buffer */
+ uint32_t state[4]; /* state */
+ uint64_t count; /* number of bits, mod 2^64 */
+ uint8_t buffer[MD5_BLOCK_SIZE]; /* input buffer */
};
/*
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index bda45e1e..0996f795 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -114,7 +114,7 @@ MHD_pool_create (size_t max)
pool->memory = mmap (NULL,
max,
PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS,
+ MAP_PRIVATE | MAP_ANONYMOUS,
-1,
0);
#elif defined(_WIN32)
@@ -201,7 +201,7 @@ MHD_pool_get_free (struct MemoryPool *pool)
*/
void *
MHD_pool_allocate (struct MemoryPool *pool,
- size_t size,
+ size_t size,
int from_end)
{
void *ret;
@@ -247,8 +247,8 @@ MHD_pool_allocate (struct MemoryPool *pool,
void *
MHD_pool_reallocate (struct MemoryPool *pool,
void *old,
- size_t old_size,
- size_t new_size)
+ size_t old_size,
+ size_t new_size)
{
void *ret;
size_t asize;
@@ -312,8 +312,8 @@ MHD_pool_reallocate (struct MemoryPool *pool,
*/
void *
MHD_pool_reset (struct MemoryPool *pool,
- void *keep,
- size_t copy_bytes,
+ void *keep,
+ size_t copy_bytes,
size_t new_size)
{
if ( (NULL != keep) &&
diff --git a/src/microhttpd/memorypool.h b/src/microhttpd/memorypool.h
index 36136af8..cdc81799 100644
--- a/src/microhttpd/memorypool.h
+++ b/src/microhttpd/memorypool.h
@@ -70,7 +70,7 @@ MHD_pool_destroy (struct MemoryPool *pool);
*/
void *
MHD_pool_allocate (struct MemoryPool *pool,
- size_t size,
+ size_t size,
int from_end);
@@ -93,9 +93,9 @@ MHD_pool_allocate (struct MemoryPool *pool,
*/
void *
MHD_pool_reallocate (struct MemoryPool *pool,
- void *old,
- size_t old_size,
- size_t new_size);
+ void *old,
+ size_t old_size,
+ size_t new_size);
/**
@@ -123,8 +123,8 @@ MHD_pool_get_free (struct MemoryPool *pool);
*/
void *
MHD_pool_reset (struct MemoryPool *pool,
- void *keep,
- size_t copy_bytes,
+ void *keep,
+ size_t copy_bytes,
size_t new_size);
#endif
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 8b710ea1..3a1c0da1 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -307,7 +307,7 @@ MHD_create_post_processor (struct MHD_Connection
*connection,
/* Q: should this be "strcasestr"? */
boundary = strstr (boundary, "boundary=");
if (NULL == boundary)
- return NULL; /* failed to determine boundary */
+ return NULL; /* failed to determine boundary */
boundary += MHD_STATICSTR_LEN_ ("boundary=");
blen = strlen (boundary);
if ( (blen == 0) ||
@@ -315,11 +315,11 @@ MHD_create_post_processor (struct MHD_Connection
*connection,
return NULL; /* (will be) out of memory or invalid boundary
*/
if ( (boundary[0] == '"') &&
(boundary[blen - 1] == '"') )
- {
- /* remove enclosing quotes */
- ++boundary;
- blen -= 2;
- }
+ {
+ /* remove enclosing quotes */
+ ++boundary;
+ blen -= 2;
+ }
}
else
blen = 0;
@@ -352,7 +352,7 @@ MHD_create_post_processor (struct MHD_Connection
*connection,
static int
post_process_urlencoded (struct MHD_PostProcessor *pp,
const char *post_data,
- size_t post_data_len)
+ size_t post_data_len)
{
size_t equals;
size_t amper;
@@ -391,7 +391,7 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
return MHD_YES; /* no '=' yet */
buf[pp->buffer_pos] = '\0'; /* 0-terminate key */
pp->buffer_pos = 0; /* reset for next key */
- MHD_unescape_plus (buf);
+ MHD_unescape_plus (buf);
MHD_http_unescape (buf);
poff += equals + 1;
pp->state = PP_ProcessValue;
@@ -457,10 +457,10 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
/* unescape */
xbuf[xoff] = '\0'; /* 0-terminate in preparation */
- MHD_unescape_plus (xbuf);
+ MHD_unescape_plus (xbuf);
xoff = MHD_http_unescape (xbuf);
/* finally: call application! */
- pp->must_ikvi = MHD_NO;
+ pp->must_ikvi = MHD_NO;
if (MHD_NO == pp->ikvi (pp->cls,
MHD_POSTDATA_KIND,
(const char *) &pp[1], /* key */
@@ -621,8 +621,8 @@ find_boundary (struct MHD_PostProcessor *pp,
*/
static void
try_get_value (const char *buf,
- const char *key,
- char **destination)
+ const char *key,
+ char **destination)
{
const char *spos;
const char *bpos;
@@ -824,14 +824,14 @@ process_value_to_boundary (struct MHD_PostProcessor *pp,
at least at the last character that we are sure
is not part of the boundary */
if ( ( (MHD_YES == pp->must_ikvi) ||
- (0 != newline) ) &&
+ (0 != newline) ) &&
(MHD_NO == pp->ikvi (pp->cls,
- MHD_POSTDATA_KIND,
- pp->content_name,
- pp->content_filename,
- pp->content_type,
- pp->content_transfer_encoding,
- buf,
+ MHD_POSTDATA_KIND,
+ pp->content_name,
+ pp->content_filename,
+ pp->content_type,
+ pp->content_transfer_encoding,
+ buf,
pp->value_offset,
newline)) )
{
@@ -890,7 +890,7 @@ free_unmarked (struct MHD_PostProcessor *pp)
static int
post_process_multipart (struct MHD_PostProcessor *pp,
const char *post_data,
- size_t post_data_len)
+ size_t post_data_len)
{
char *buf;
size_t max;
@@ -1006,10 +1006,10 @@ post_process_multipart (struct MHD_PostProcessor *pp,
* > line or after the last one.
*/
(void) find_boundary (pp,
- pp->boundary,
- pp->blen,
- &ioff,
- PP_ProcessEntryHeaders,
+ pp->boundary,
+ pp->blen,
+ &ioff,
+ PP_ProcessEntryHeaders,
PP_Done);
break;
case PP_NextBoundary:
@@ -1026,7 +1026,7 @@ post_process_multipart (struct MHD_PostProcessor *pp,
}
break;
case PP_ProcessEntryHeaders:
- pp->must_ikvi = MHD_YES;
+ pp->must_ikvi = MHD_YES;
if (MHD_NO ==
process_multipart_headers (pp,
&ioff,
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index d677cf62..003043ae 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -67,9 +67,9 @@
*/
static int
add_response_entry (struct MHD_Response *response,
- enum MHD_ValueKind kind,
- const char *header,
- const char *content)
+ enum MHD_ValueKind kind,
+ const char *header,
+ const char *content)
{
struct MHD_HTTP_Header *hdr;
@@ -120,9 +120,9 @@ MHD_add_response_header (struct MHD_Response *response,
const char *content)
{
return add_response_entry (response,
- MHD_HEADER_KIND,
- header,
- content);
+ MHD_HEADER_KIND,
+ header,
+ content);
}
@@ -141,9 +141,9 @@ MHD_add_response_footer (struct MHD_Response *response,
const char *content)
{
return add_response_entry (response,
- MHD_FOOTER_KIND,
- footer,
- content);
+ MHD_FOOTER_KIND,
+ footer,
+ content);
}
@@ -159,7 +159,7 @@ MHD_add_response_footer (struct MHD_Response *response,
int
MHD_del_response_header (struct MHD_Response *response,
const char *header,
- const char *content)
+ const char *content)
{
struct MHD_HTTP_Header *pos;
struct MHD_HTTP_Header *prev;
@@ -236,7 +236,7 @@ MHD_get_response_headers (struct MHD_Response *response,
*/
const char *
MHD_get_response_header (struct MHD_Response *response,
- const char *key)
+ const char *key)
{
struct MHD_HTTP_Header *pos;
@@ -499,8 +499,8 @@ free_callback (void *cls)
*/
struct MHD_Response *
MHD_create_response_from_fd_at_offset (size_t size,
- int fd,
- off_t offset)
+ int fd,
+ off_t offset)
{
return MHD_create_response_from_fd_at_offset64 (size,
fd,
@@ -544,10 +544,10 @@ MHD_create_response_from_fd_at_offset64 (uint64_t size,
return NULL;
response = MHD_create_response_from_callback (size,
- 4 * 1024,
- &file_reader,
- NULL,
- &free_callback);
+ 4 * 1024,
+ &file_reader,
+ NULL,
+ &free_callback);
if (NULL == response)
return NULL;
response->fd = fd;
@@ -568,7 +568,7 @@ MHD_create_response_from_fd_at_offset64 (uint64_t size,
*/
struct MHD_Response *
MHD_create_response_from_fd (size_t size,
- int fd)
+ int fd)
{
return MHD_create_response_from_fd_at_offset64 (size,
fd,
@@ -669,13 +669,13 @@ MHD_create_response_from_data (size_t size,
*/
struct MHD_Response *
MHD_create_response_from_buffer (size_t size,
- void *buffer,
- enum MHD_ResponseMemoryMode mode)
+ void *buffer,
+ enum MHD_ResponseMemoryMode mode)
{
return MHD_create_response_from_data (size,
- buffer,
- mode == MHD_RESPMEM_MUST_FREE,
- mode == MHD_RESPMEM_MUST_COPY);
+ buffer,
+ mode == MHD_RESPMEM_MUST_FREE,
+ mode == MHD_RESPMEM_MUST_COPY);
}
@@ -812,7 +812,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- _("Failed to make loopback sockets non-blocking.\n"));
+ _("Failed to make loopback sockets non-blocking.\n"));
#endif
if (! res2)
{
@@ -906,7 +906,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
EPOLL_CTL_ADD,
connection->socket_fd,
&event))
- {
+ {
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_("Call to epoll_ctl failed: %s\n"),
@@ -916,7 +916,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
MHD_socket_close_chk_ (sv[1]);
free (urh);
return MHD_NO;
- }
+ }
/* Second, add our end of the UNIX socketpair() */
event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET;
@@ -925,7 +925,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
EPOLL_CTL_ADD,
urh->mhd.socket,
&event))
- {
+ {
event.events = EPOLLIN | EPOLLOUT | EPOLLPRI;
event.data.ptr = &urh->app;
if (0 != epoll_ctl (daemon->epoll_upgrade_fd,
@@ -942,11 +942,11 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
MHD_socket_close_chk_ (sv[1]);
free (urh);
return MHD_NO;
- }
- EDLL_insert (daemon->eready_urh_head,
- daemon->eready_urh_tail,
- urh);
- urh->in_eready_list = true;
+ }
+ EDLL_insert (daemon->eready_urh_head,
+ daemon->eready_urh_tail,
+ urh);
+ urh->in_eready_list = true;
}
#endif /* EPOLL_SUPPORT */
if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION) )
@@ -1025,7 +1025,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
*/
_MHD_EXTERN struct MHD_Response *
MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
- void *upgrade_handler_cls)
+ void *upgrade_handler_cls)
{
struct MHD_Response *response;
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 62d4afbd..3517c49b 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -1004,15 +1004,15 @@ test_upgrade (int flags,
if (!test_tls)
d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE,
-
MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT) ?
- 0 : 1090,
- NULL, NULL,
- &ahc_upgrade, NULL,
- MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, ¬ify_completed_cb,
NULL,
- MHD_OPTION_NOTIFY_CONNECTION, ¬ify_connection_cb,
NULL,
- MHD_OPTION_THREAD_POOL_SIZE, pool,
- MHD_OPTION_END);
+ MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT) ?
+ 0 : 1090,
+ NULL, NULL,
+ &ahc_upgrade, NULL,
+ MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
+ MHD_OPTION_NOTIFY_COMPLETED, ¬ify_completed_cb, NULL,
+ MHD_OPTION_NOTIFY_CONNECTION, ¬ify_connection_cb, NULL,
+ MHD_OPTION_THREAD_POOL_SIZE, pool,
+ MHD_OPTION_END);
#ifdef HTTPS_SUPPORT
else
d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE |
MHD_USE_TLS,
diff --git a/src/microhttpd/tsearch.c b/src/microhttpd/tsearch.c
index fe5fcd5b..b274023f 100644
--- a/src/microhttpd/tsearch.c
+++ b/src/microhttpd/tsearch.c
@@ -13,7 +13,7 @@
#include <stdlib.h>
-typedef struct node
+typedef struct node
{
const void *key;
struct node *llink;
@@ -21,11 +21,11 @@ typedef struct node
} node_t;
-/* $NetBSD: tsearch.c,v 1.5 2005/11/29 03:12:00 christos Exp $ */
+/* $NetBSD: tsearch.c,v 1.5 2005/11/29 03:12:00 christos Exp $ */
/* find or insert datum into search tree */
void *
-tsearch (const void *vkey, /* key to be located */
- void **vrootp, /* address of tree root */
+tsearch (const void *vkey, /* key to be located */
+ void **vrootp, /* address of tree root */
int (*compar)(const void *, const void *))
{
node_t *q;
@@ -35,29 +35,29 @@ tsearch (const void *vkey, /* key to be located */
return NULL;
while (*rootp != NULL)
- { /* Knuth's T1: */
+ { /* Knuth's T1: */
int r;
- if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
- return *rootp; /* we found it! */
+ if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
+ return *rootp; /* we found it! */
rootp = (r < 0) ?
- &(*rootp)->llink : /* T3: follow left branch */
- &(*rootp)->rlink; /* T4: follow right branch */
+ &(*rootp)->llink : /* T3: follow left branch */
+ &(*rootp)->rlink; /* T4: follow right branch */
}
- q = malloc (sizeof(node_t)); /* T5: key not found */
+ q = malloc (sizeof(node_t)); /* T5: key not found */
if (q)
- { /* make new node */
- *rootp = q; /* link new node to old */
- q->key = vkey; /* initialize new node */
+ { /* make new node */
+ *rootp = q; /* link new node to old */
+ q->key = vkey; /* initialize new node */
q->llink = q->rlink = NULL;
}
return q;
}
-/* $NetBSD: tfind.c,v 1.5 2005/03/23 08:16:53 kleink Exp $ */
+/* $NetBSD: tfind.c,v 1.5 2005/03/23 08:16:53 kleink Exp $ */
/* find a node, or return NULL */
void *
tfind (const void *vkey, /* key to be found */
@@ -70,20 +70,20 @@ tfind (const void *vkey, /* key to be found */
return NULL;
while (*rootp != NULL)
- { /* T1: */
+ { /* T1: */
int r;
- if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
- return *rootp; /* key found */
+ if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
+ return *rootp; /* key found */
rootp = (r < 0) ?
- &(*rootp)->llink : /* T3: follow left branch */
- &(*rootp)->rlink; /* T4: follow right branch */
+ &(*rootp)->llink : /* T3: follow left branch */
+ &(*rootp)->rlink; /* T4: follow right branch */
}
return NULL;
}
-/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */
+/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */
/*
* delete node with given key
*
@@ -109,25 +109,25 @@ tdelete (const void * __restrict vkey,
{
p = *rootp;
rootp = (cmp < 0) ?
- &(*rootp)->llink : /* follow llink branch */
- &(*rootp)->rlink; /* follow rlink branch */
+ &(*rootp)->llink : /* follow llink branch */
+ &(*rootp)->rlink; /* follow rlink branch */
if (*rootp == NULL)
- return NULL; /* key not found */
+ return NULL; /* key not found */
}
- r = (*rootp)->rlink; /* D1: */
- if ((q = (*rootp)->llink) == NULL) /* Left NULL? */
+ r = (*rootp)->rlink; /* D1: */
+ if ((q = (*rootp)->llink) == NULL) /* Left NULL? */
{
q = r;
}
else if (r != NULL)
- { /* Right link is NULL? */
+ { /* Right link is NULL? */
if (r->llink == NULL)
- { /* D2: Find successor */
+ { /* D2: Find successor */
r->llink = q;
q = r;
}
else
- { /* D3: Find NULL link */
+ { /* D3: Find NULL link */
for (q = r->llink; q->llink != NULL; q = r->llink)
r = q;
r->llink = q->rlink;
@@ -135,8 +135,8 @@ tdelete (const void * __restrict vkey,
q->rlink = (*rootp)->rlink;
}
}
- free(*rootp); /* D4: Free node */
- *rootp = q; /* link parent to new node */
+ free(*rootp); /* D4: Free node */
+ *rootp = q; /* link parent to new node */
return p;
}
diff --git a/src/microhttpd/tsearch.h b/src/microhttpd/tsearch.h
index aa186495..e5bb8bb4 100644
--- a/src/microhttpd/tsearch.h
+++ b/src/microhttpd/tsearch.h
@@ -2,7 +2,7 @@
* Written by J.T. Conklin <address@hidden>
* Public domain.
*
- * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $
+ * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $
* $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert
$
*/
@@ -14,19 +14,19 @@ extern "C" {
#endif /* __cplusplus */
-void *
+void *
tdelete (const void * __restrict,
void ** __restrict,
int (*)(const void *, const void *));
-void *
+void *
tfind (const void *,
void * const *,
int (*)(const void *, const void *));
-void *
+void *
tsearch (const void *,
void **,
int (*)(const void *, const void *));
diff --git a/src/testcurl/gauger.h b/src/testcurl/gauger.h
index 6698f5d5..405b7d19 100644
--- a/src/testcurl/gauger.h
+++ b/src/testcurl/gauger.h
@@ -19,7 +19,7 @@
#define GAUGER(category, counter, value, unit)\
{\
- const char * __gauger_v[10]; \
+ const char * __gauger_v[10]; \
char __gauger_s[32];\
pid_t __gauger_p;\
if(!(__gauger_p=fork())){\
@@ -27,15 +27,15 @@
sprintf(__gauger_s,"%Lf", (long double) (value));\
__gauger_v[0] = "gauger";\
__gauger_v[1] = "-n";\
- __gauger_v[2] = counter; \
+ __gauger_v[2] = counter; \
__gauger_v[3] = "-d";\
__gauger_v[4] = __gauger_s;\
__gauger_v[5] = "-u";\
- __gauger_v[6] = unit; \
+ __gauger_v[6] = unit; \
__gauger_v[7] = "-c";\
- __gauger_v[8] = category; \
+ __gauger_v[8] = category; \
__gauger_v[9] = (char *)NULL;\
- execvp("gauger", (char*const*) __gauger_v); \
+ execvp("gauger", (char*const*) __gauger_v); \
_exit(1);\
}else{\
_exit(0);\
diff --git a/src/testcurl/https/test_empty_response.c
b/src/testcurl/https/test_empty_response.c
index 27cb1e31..94eea518 100644
--- a/src/testcurl/https/test_empty_response.c
+++ b/src/testcurl/https/test_empty_response.c
@@ -53,7 +53,7 @@ ahc_echo (void *cls,
(void)upload_data;(void)upload_data_size;(void)unused; /* Unused.
Silent compiler warning. */
response = MHD_create_response_from_buffer (0, NULL,
- MHD_RESPMEM_PERSISTENT);
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -92,7 +92,7 @@ testInternalSelectGet ()
port, NULL, NULL, &ahc_echo, "GET",
MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
- MHD_OPTION_END);
+ MHD_OPTION_END);
if (d == NULL)
return 256;
diff --git a/src/testcurl/https/test_https_get.c
b/src/testcurl/https/test_https_get.c
index 61c25643..72b231ac 100644
--- a/src/testcurl/https/test_https_get.c
+++ b/src/testcurl/https/test_https_get.c
@@ -40,8 +40,8 @@ extern const char srv_signed_key_pem[];
/* perform a HTTP GET request via SSL/TLS */
static int
test_secure_get (FILE * test_fd,
- const char *cipher_suite,
- int proto_version)
+ const char *cipher_suite,
+ int proto_version)
{
int ret;
struct MHD_Daemon *d;
diff --git a/src/testcurl/https/test_https_get_select.c
b/src/testcurl/https/test_https_get_select.c
index 64be861a..dc8ecf52 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -63,8 +63,8 @@ ahc_echo (void *cls,
}
*unused = NULL;
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
@@ -111,7 +111,7 @@ testExternalGet (int flags)
port, NULL, NULL, &ahc_echo, "GET",
MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
- MHD_OPTION_END);
+ MHD_OPTION_END);
if (d == NULL)
return 256;
if (0 == port)
diff --git a/src/testcurl/https/test_https_multi_daemon.c
b/src/testcurl/https/test_https_multi_daemon.c
index 130fa9df..16e0fb23 100644
--- a/src/testcurl/https/test_https_multi_daemon.c
+++ b/src/testcurl/https/test_https_multi_daemon.c
@@ -43,7 +43,7 @@ extern const char srv_self_signed_cert_pem[];
*/
static int
test_concurent_daemon_pair (void *cls,
- const char *cipher_suite,
+ const char *cipher_suite,
int proto_version)
{
int ret;
@@ -165,7 +165,7 @@ main (int argc, char *const *argv)
fclose (cert);
if (0 != remove (ca_cert_file_name))
fprintf (stderr,
- "Failed to remove `%s'\n",
- ca_cert_file_name);
+ "Failed to remove `%s'\n",
+ ca_cert_file_name);
return errorCount != 0 ? 1 : 0;
}
diff --git a/src/testcurl/https/test_https_session_info.c
b/src/testcurl/https/test_https_session_info.c
index a58c7f7b..64ccfb7c 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -61,7 +61,7 @@ query_session_ahc (void *cls, struct MHD_Connection
*connection,
if (GNUTLS_TLS1_1 !=
(ret = MHD_get_connection_info
(connection,
- MHD_CONNECTION_INFO_PROTOCOL)->protocol))
+ MHD_CONNECTION_INFO_PROTOCOL)->protocol))
{
if (GNUTLS_TLS1_2 == ret)
{
@@ -82,8 +82,8 @@ query_session_ahc (void *cls, struct MHD_Connection
*connection,
}
response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE),
- (void *) EMPTY_PAGE,
- MHD_RESPMEM_PERSISTENT);
+ (void *) EMPTY_PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -117,7 +117,7 @@ test_query_session ()
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS |
MHD_USE_ERROR_LOG, port,
NULL, NULL, &query_session_ahc, NULL,
- MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128",
+ MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128",
MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
MHD_OPTION_END);
diff --git a/src/testcurl/https/test_tls_authentication.c
b/src/testcurl/https/test_tls_authentication.c
index 7a6cd9a4..479b3ad5 100644
--- a/src/testcurl/https/test_tls_authentication.c
+++ b/src/testcurl/https/test_tls_authentication.c
@@ -123,7 +123,7 @@ main (int argc, char *const *argv)
curl_global_cleanup ();
if (0 != remove (ca_cert_file_name))
fprintf (stderr,
- "Failed to remove `%s'\n",
- ca_cert_file_name);
+ "Failed to remove `%s'\n",
+ ca_cert_file_name);
return errorCount != 0 ? 1 : 0;
}
diff --git a/src/testcurl/https/test_tls_extensions.c
b/src/testcurl/https/test_tls_extensions.c
index 08cde939..5d6931ca 100644
--- a/src/testcurl/https/test_tls_extensions.c
+++ b/src/testcurl/https/test_tls_extensions.c
@@ -102,8 +102,8 @@ test_hello_extension (gnutls_session_t session, int port,
extensions_t exten_t,
data = MHD_gnutls_malloc (datalen);
if (data == NULL)
{
- free (cbc.buf);
- return -1;
+ free (cbc.buf);
+ return -1;
}
hver = MHD_gtls_version_max (session);
data[pos++] = MHD_gtls_version_get_major (hver);
@@ -178,7 +178,7 @@ test_hello_extension (gnutls_session_t session, int port,
extensions_t exten_t,
/* this should crash the server */
ret = gnutls_send_handshake (session, data, datalen,
- GNUTLS_HANDSHAKE_CLIENT_HELLO);
+ GNUTLS_HANDSHAKE_CLIENT_HELLO);
/* advance to STATE2 */
session->internals.handshake_state = STATE2;
diff --git a/src/testcurl/https/test_tls_options.c
b/src/testcurl/https/test_tls_options.c
index e3b427d9..111facee 100644
--- a/src/testcurl/https/test_tls_options.c
+++ b/src/testcurl/https/test_tls_options.c
@@ -135,28 +135,28 @@ main (int argc, char *const *argv)
if (0 !=
test_wrap ("TLS1.0-AES-SHA1",
- &test_https_transfer, NULL, port, daemon_flags,
- aes128_sha,
- CURL_SSLVERSION_TLSv1,
- MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
- MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
- MHD_OPTION_HTTPS_PRIORITIES,
"NONE:+VERS-TLS1.0:+AES-128-CBC:+SHA1:+RSA:+COMP-NULL",
- MHD_OPTION_END))
+ &test_https_transfer, NULL, port, daemon_flags,
+ aes128_sha,
+ CURL_SSLVERSION_TLSv1,
+ MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
+ MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
+ MHD_OPTION_HTTPS_PRIORITIES,
"NONE:+VERS-TLS1.0:+AES-128-CBC:+SHA1:+RSA:+COMP-NULL",
+ MHD_OPTION_END))
{
fprintf (stderr, "TLS1.0-AES-SHA1 test failed\n");
errorCount++;
}
fprintf (stderr,
- "The following handshake should fail (and print an error
message)...\n");
+ "The following handshake should fail (and print an error message)...\n");
if (0 !=
test_wrap ("TLS1.0 vs SSL3",
- &test_unmatching_ssl_version, NULL, port, daemon_flags,
- aes256_sha,
- CURL_SSLVERSION_SSLv3,
- MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
- MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
- MHD_OPTION_HTTPS_PRIORITIES,
"NONE:+VERS-TLS1.0:+AES-256-CBC:+SHA1:+RSA:+COMP-NULL",
- MHD_OPTION_END))
+ &test_unmatching_ssl_version, NULL, port, daemon_flags,
+ aes256_sha,
+ CURL_SSLVERSION_SSLv3,
+ MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
+ MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
+ MHD_OPTION_HTTPS_PRIORITIES,
"NONE:+VERS-TLS1.0:+AES-256-CBC:+SHA1:+RSA:+COMP-NULL",
+ MHD_OPTION_END))
{
fprintf (stderr, "TLS1.0 vs SSL3 test failed\n");
errorCount++;
diff --git a/src/testcurl/https/tls_test_common.c
b/src/testcurl/https/tls_test_common.c
index a3a7df24..fb7e93a8 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -62,9 +62,9 @@ setup_ca_cert ()
*/
int
test_daemon_get (void *cls,
- const char *cipher_suite, int proto_version,
- int port,
- int ver_peer)
+ const char *cipher_suite, int proto_version,
+ int port,
+ int ver_peer)
{
CURL *c;
struct CBC cbc;
@@ -184,8 +184,8 @@ http_ahc (void *cls, struct MHD_Connection *connection,
}
*ptr = NULL; /* reset when done */
response = MHD_create_response_from_buffer (strlen (test_data),
- (void *) test_data,
- MHD_RESPMEM_PERSISTENT);
+ (void *) test_data,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -372,8 +372,8 @@ test_https_transfer (void *cls,
/* compare test file & daemon responce */
if ( (len != strlen (test_data)) ||
(memcmp (cbc.buf,
- test_data,
- len) != 0) )
+ test_data,
+ len) != 0) )
{
fprintf (stderr, "Error: local file & received file differ.\n");
ret = -1;
@@ -428,7 +428,7 @@ int
setup_session (gnutls_session_t * session,
gnutls_datum_t * key,
gnutls_datum_t * cert,
- gnutls_certificate_credentials_t * xcred)
+ gnutls_certificate_credentials_t * xcred)
{
int ret;
const char *err_pos;
@@ -439,7 +439,7 @@ setup_session (gnutls_session_t * session,
if (NULL == key->data)
{
gnutls_certificate_free_credentials (*xcred);
- return -1;
+ return -1;
}
memcpy (key->data, srv_key_pem, key->size);
cert->size = strlen (srv_self_signed_cert_pem) + 1;
@@ -447,15 +447,15 @@ setup_session (gnutls_session_t * session,
if (NULL == cert->data)
{
gnutls_certificate_free_credentials (*xcred);
- free (key->data);
- return -1;
+ free (key->data);
+ return -1;
}
memcpy (cert->data, srv_self_signed_cert_pem, cert->size);
gnutls_certificate_set_x509_key_mem (*xcred, cert, key,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_init (session, GNUTLS_CLIENT);
ret = gnutls_priority_set_direct (*session,
- "NORMAL", &err_pos);
+ "NORMAL", &err_pos);
if (ret < 0)
{
gnutls_deinit (*session);
@@ -464,8 +464,8 @@ setup_session (gnutls_session_t * session,
return -1;
}
gnutls_credentials_set (*session,
- GNUTLS_CRD_CERTIFICATE,
- *xcred);
+ GNUTLS_CRD_CERTIFICATE,
+ *xcred);
return 0;
}
diff --git a/src/testcurl/https/tls_test_common.h
b/src/testcurl/https/tls_test_common.h
index 490239ef..e4c70145 100644
--- a/src/testcurl/https/tls_test_common.h
+++ b/src/testcurl/https/tls_test_common.h
@@ -83,7 +83,7 @@ setup_ca_cert (void);
*/
int
test_daemon_get (void * cls,
- const char *cipher_suite, int proto_version,
+ const char *cipher_suite, int proto_version,
int port, int ver_peer);
void
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index 98578173..af64519a 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -91,7 +91,7 @@ now ()
gettimeofday (&tv, NULL);
return (((unsigned long long) tv.tv_sec * 1000LL) +
- ((unsigned long long) tv.tv_usec / 1000LL));
+ ((unsigned long long) tv.tv_usec / 1000LL));
}
@@ -116,14 +116,14 @@ stop (const char *desc)
double rps = ((double) (ROUNDS * 1000)) / ((double) (now() - start_time));
fprintf (stderr,
- "Sequential GETs using %s: %f %s\n",
- desc,
- rps,
- "requests/s");
+ "Sequential GETs using %s: %f %s\n",
+ desc,
+ rps,
+ "requests/s");
GAUGER (desc,
- "Sequential GETs",
- rps,
- "requests/s");
+ "Sequential GETs",
+ rps,
+ "requests/s");
}
@@ -137,8 +137,8 @@ struct CBC
static size_t
copyBuffer (void *ptr,
- size_t size, size_t nmemb,
- void *ctx)
+ size_t size, size_t nmemb,
+ void *ctx)
{
struct CBC *cbc = ctx;
@@ -220,27 +220,27 @@ testInternalGet (int port, int poll_flag)
curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
if (oneone)
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
else
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
/* NOTE: use of CONNECTTIMEOUT without also
- setting NOSIGNAL results in really weird
- crashes on my system!*/
+ setting NOSIGNAL results in really weird
+ crashes on my system!*/
curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
if (CURLE_OK != (errornum = curl_easy_perform (c)))
- {
- fprintf (stderr,
- "curl_easy_perform failed: `%s'\n",
- curl_easy_strerror (errornum));
- curl_easy_cleanup (c);
- MHD_stop_daemon (d);
- return 2;
- }
+ {
+ fprintf (stderr,
+ "curl_easy_perform failed: `%s'\n",
+ curl_easy_strerror (errornum));
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 2;
+ }
curl_easy_cleanup (c);
}
stop (poll_flag == MHD_USE_AUTO ? "internal thread with 'auto'" :
poll_flag == MHD_USE_POLL ? "internal thread with poll()" :
- poll_flag == MHD_USE_EPOLL ? "internal thread with epoll" : "internal
thread with select()");
+ poll_flag == MHD_USE_EPOLL ? "internal thread with epoll" : "internal thread
with select()");
MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
return 4;
@@ -290,29 +290,29 @@ testMultithreadedGet (int port, int poll_flag)
curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
if (oneone)
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
else
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
/* NOTE: use of CONNECTTIMEOUT without also
- setting NOSIGNAL results in really weird
- crashes on my system! */
+ setting NOSIGNAL results in really weird
+ crashes on my system! */
curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
if (CURLE_OK != (errornum = curl_easy_perform (c)))
- {
- fprintf (stderr,
- "curl_easy_perform failed: `%s'\n",
- curl_easy_strerror (errornum));
- curl_easy_cleanup (c);
- MHD_stop_daemon (d);
- return 32;
- }
+ {
+ fprintf (stderr,
+ "curl_easy_perform failed: `%s'\n",
+ curl_easy_strerror (errornum));
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 32;
+ }
curl_easy_cleanup (c);
}
stop ((poll_flag & MHD_USE_AUTO) ? "internal thread with 'auto' and thread
per connection" :
(poll_flag & MHD_USE_POLL) ? "internal thread with poll() and thread
per connection" :
- (poll_flag & MHD_USE_EPOLL) ? "internal thread with epoll and thread
per connection" :
- "internal thread with select() and thread per connection");
+ (poll_flag & MHD_USE_EPOLL) ? "internal thread with epoll and thread per
connection" :
+ "internal thread with select() and thread per connection");
MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
return 64;
@@ -362,28 +362,28 @@ testMultithreadedPoolGet (int port, int poll_flag)
curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
if (oneone)
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
else
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
/* NOTE: use of CONNECTTIMEOUT without also
- setting NOSIGNAL results in really weird
- crashes on my system!*/
+ setting NOSIGNAL results in really weird
+ crashes on my system!*/
curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
if (CURLE_OK != (errornum = curl_easy_perform (c)))
- {
- fprintf (stderr,
- "curl_easy_perform failed: `%s'\n",
- curl_easy_strerror (errornum));
- curl_easy_cleanup (c);
- MHD_stop_daemon (d);
- return 32;
- }
+ {
+ fprintf (stderr,
+ "curl_easy_perform failed: `%s'\n",
+ curl_easy_strerror (errornum));
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 32;
+ }
curl_easy_cleanup (c);
}
stop (0 != (poll_flag & MHD_USE_AUTO) ? "internal thread pool with 'auto'" :
0 != (poll_flag & MHD_USE_POLL) ? "internal thread pool with poll()" :
- 0 != (poll_flag & MHD_USE_EPOLL) ? "internal thread pool with epoll" :
"internal thread pool with select()");
+ 0 != (poll_flag & MHD_USE_EPOLL) ? "internal thread pool with epoll" :
"internal thread pool with select()");
MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
return 64;
@@ -452,52 +452,52 @@ testExternalGet (int port)
curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
if (oneone)
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
else
- curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
/* NOTE: use of CONNECTTIMEOUT without also
- setting NOSIGNAL results in really weird
- crashes on my system! */
+ setting NOSIGNAL results in really weird
+ crashes on my system! */
curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
mret = curl_multi_add_handle (multi, c);
if (mret != CURLM_OK)
- {
- curl_multi_cleanup (multi);
- curl_easy_cleanup (c);
- MHD_stop_daemon (d);
- return 1024;
- }
+ {
+ curl_multi_cleanup (multi);
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 1024;
+ }
start = time (NULL);
while ((time (NULL) - start < 5) && (c != NULL))
- {
- maxsock = MHD_INVALID_SOCKET;
- maxposixs = -1;
- FD_ZERO (&rs);
- FD_ZERO (&ws);
- FD_ZERO (&es);
- curl_multi_perform (multi, &running);
- mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs);
- if (mret != CURLM_OK)
- {
- curl_multi_remove_handle (multi, c);
- curl_multi_cleanup (multi);
- curl_easy_cleanup (c);
- MHD_stop_daemon (d);
- return 2048;
- }
- if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock))
- {
- curl_multi_remove_handle (multi, c);
- curl_multi_cleanup (multi);
- curl_easy_cleanup (c);
- MHD_stop_daemon (d);
- return 4096;
- }
- tv.tv_sec = 0;
- tv.tv_usec = 1000;
- if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv))
+ {
+ maxsock = MHD_INVALID_SOCKET;
+ maxposixs = -1;
+ FD_ZERO (&rs);
+ FD_ZERO (&ws);
+ FD_ZERO (&es);
+ curl_multi_perform (multi, &running);
+ mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs);
+ if (mret != CURLM_OK)
+ {
+ curl_multi_remove_handle (multi, c);
+ curl_multi_cleanup (multi);
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 2048;
+ }
+ if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock))
+ {
+ curl_multi_remove_handle (multi, c);
+ curl_multi_cleanup (multi);
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 4096;
+ }
+ tv.tv_sec = 0;
+ tv.tv_usec = 1000;
+ if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv))
{
#ifdef MHD_POSIX_SOCKETS
if (EINTR != errno)
@@ -508,41 +508,41 @@ testExternalGet (int port)
Sleep (1000);
#endif
}
- curl_multi_perform (multi, &running);
- if (running == 0)
- {
- msg = curl_multi_info_read (multi, &running);
- if (msg == NULL)
- break;
- if (msg->msg == CURLMSG_DONE)
- {
- if (msg->data.result != CURLE_OK)
- printf ("%s failed at %s:%d: `%s'\n",
- "curl_multi_perform",
- __FILE__,
- __LINE__, curl_easy_strerror (msg->data.result));
- curl_multi_remove_handle (multi, c);
- curl_easy_cleanup (c);
- c = NULL;
- }
- }
- /* two possibilities here; as select sets are
- tiny, this makes virtually no difference
- in actual runtime right now, even though the
- number of select calls is virtually cut in half
- (and 'select' is the most expensive of our system
- calls according to 'strace') */
- if (0)
- MHD_run (d);
- else
- MHD_run_from_select (d, &rs, &ws, &es);
- }
+ curl_multi_perform (multi, &running);
+ if (running == 0)
+ {
+ msg = curl_multi_info_read (multi, &running);
+ if (msg == NULL)
+ break;
+ if (msg->msg == CURLMSG_DONE)
+ {
+ if (msg->data.result != CURLE_OK)
+ printf ("%s failed at %s:%d: `%s'\n",
+ "curl_multi_perform",
+ __FILE__,
+ __LINE__, curl_easy_strerror (msg->data.result));
+ curl_multi_remove_handle (multi, c);
+ curl_easy_cleanup (c);
+ c = NULL;
+ }
+ }
+ /* two possibilities here; as select sets are
+ tiny, this makes virtually no difference
+ in actual runtime right now, even though the
+ number of select calls is virtually cut in half
+ (and 'select' is the most expensive of our system
+ calls according to 'strace') */
+ if (0)
+ MHD_run (d);
+ else
+ MHD_run_from_select (d, &rs, &ws, &es);
+ }
if (NULL != c)
- {
- curl_multi_remove_handle (multi, c);
- curl_easy_cleanup (c);
- fprintf (stderr, "Timeout!?\n");
- }
+ {
+ curl_multi_remove_handle (multi, c);
+ curl_easy_cleanup (c);
+ fprintf (stderr, "Timeout!?\n");
+ }
}
stop ("external select");
if (multi != NULL)
@@ -572,8 +572,8 @@ main (int argc, char *const *argv)
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
return 2;
response = MHD_create_response_from_buffer (strlen ("/hello_world"),
- "/hello_world",
- MHD_RESPMEM_MUST_COPY);
+ "/hello_world",
+ MHD_RESPMEM_MUST_COPY);
errorCount += testExternalGet (port++);
errorCount += testInternalGet (port++, MHD_USE_AUTO);
errorCount += testMultithreadedGet (port++, MHD_USE_AUTO);
diff --git a/src/testcurl/perf_get_concurrent.c
b/src/testcurl/perf_get_concurrent.c
index 49ed1ba4..5c5fea42 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -93,7 +93,7 @@ now ()
gettimeofday (&tv, NULL);
return (((unsigned long long) tv.tv_sec * 1000LL) +
- ((unsigned long long) tv.tv_usec / 1000LL));
+ ((unsigned long long) tv.tv_usec / 1000LL));
}
@@ -118,21 +118,21 @@ stop (const char *desc)
double rps = ((double) (PAR * ROUNDS * 1000)) / ((double) (now() -
start_time));
fprintf (stderr,
- "Parallel GETs using %s: %f %s\n",
- desc,
- rps,
- "requests/s");
+ "Parallel GETs using %s: %f %s\n",
+ desc,
+ rps,
+ "requests/s");
GAUGER (desc,
- "Parallel GETs",
- rps,
- "requests/s");
+ "Parallel GETs",
+ rps,
+ "requests/s");
}
static size_t
copyBuffer (void *ptr,
- size_t size, size_t nmemb,
- void *ctx)
+ size_t size, size_t nmemb,
+ void *ctx)
{
(void)ptr;(void)ctx; /* Unused. Silent compiler warning. */
return size * nmemb;
@@ -395,7 +395,7 @@ testExternalGet (int port)
port = (int)dinfo->port;
}
if (0 != pthread_create (&pid, NULL,
- &do_gets, (void*)(intptr_t)port))
+ &do_gets, (void*)(intptr_t)port))
{
MHD_stop_daemon(d);
return 512;
@@ -409,16 +409,16 @@ testExternalGet (int port)
FD_ZERO (&ws);
FD_ZERO (&es);
if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
- {
- MHD_stop_daemon (d);
- return 4096;
- }
+ {
+ MHD_stop_daemon (d);
+ return 4096;
+ }
tret = MHD_get_timeout (d, &tt);
if (MHD_YES != tret) tt = 1;
tv.tv_sec = tt / 1000;
tv.tv_usec = 1000 * (tt % 1000);
if (-1 == select (max + 1, &rs, &ws, &es, &tv))
- {
+ {
#ifdef MHD_POSIX_SOCKETS
if (EINTR == errno)
continue;
@@ -432,9 +432,9 @@ testExternalGet (int port)
continue;
}
#endif
- ret |= 1024;
- break;
- }
+ ret |= 1024;
+ break;
+ }
MHD_run_from_select(d, &rs, &ws, &es);
}
@@ -467,8 +467,8 @@ main (int argc, char *const *argv)
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
return 2;
response = MHD_create_response_from_buffer (strlen ("/hello_world"),
- "/hello_world",
- MHD_RESPMEM_MUST_COPY);
+ "/hello_world",
+ MHD_RESPMEM_MUST_COPY);
errorCount += testInternalGet (port++, 0);
errorCount += testMultithreadedGet (port++, 0);
errorCount += testMultithreadedPoolGet (port++, 0);
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index 5b9daf0f..234177a4 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -53,7 +53,7 @@ called_twice(void *cls, uint64_t pos, char *buf, size_t max)
return MHD_CONTENT_READER_END_OF_STREAM;
}
fprintf(stderr,
- "Handler called after returning END_OF_STREAM!\n");
+ "Handler called after returning END_OF_STREAM!\n");
return MHD_CONTENT_READER_END_WITH_ERROR;
}
@@ -62,10 +62,10 @@ static int
callback(void *cls,
struct MHD_Connection *connection,
const char *url,
- const char *method,
+ const char *method,
const char *version,
const char *upload_data,
- size_t *upload_data_size,
+ size_t *upload_data_size,
void **con_cls)
{
struct callback_closure *cbc = calloc(1, sizeof(struct callback_closure));
@@ -76,8 +76,8 @@ callback(void *cls,
(void)upload_data_size;(void)con_cls; /* Unused. Silent compiler
warning. */
r = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024,
- &called_twice, cbc,
- &free);
+ &called_twice, cbc,
+ &free);
if (NULL == r)
{
free (cbc);
@@ -131,12 +131,12 @@ main(int argc, char **argv)
port = 1140;
d = MHD_start_daemon(0,
- port,
- NULL,
- NULL,
- &callback,
- NULL,
- MHD_OPTION_END);
+ port,
+ NULL,
+ NULL,
+ &callback,
+ NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 32;
if (0 == port)
@@ -181,26 +181,26 @@ main(int argc, char **argv)
FD_ZERO(&es);
curl_multi_perform (multi, &running);
if (NULL != multi)
- {
- mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs);
- if (mret != CURLM_OK)
- {
- curl_multi_remove_handle (multi, c);
- curl_multi_cleanup (multi);
- curl_easy_cleanup (c);
- MHD_stop_daemon (d);
- return 3;
- }
- }
+ {
+ mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs);
+ if (mret != CURLM_OK)
+ {
+ curl_multi_remove_handle (multi, c);
+ curl_multi_cleanup (multi);
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 3;
+ }
+ }
if (MHD_YES !=
- MHD_get_fdset(d, &rs, &ws, &es, &maxsock))
- {
+ MHD_get_fdset(d, &rs, &ws, &es, &maxsock))
+ {
curl_multi_remove_handle (multi, c);
curl_multi_cleanup (multi);
curl_easy_cleanup (c);
MHD_stop_daemon (d);
- return 4;
- }
+ return 4;
+ }
tv.tv_sec = 0;
tv.tv_usec = 1000;
if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv))
@@ -215,28 +215,28 @@ main(int argc, char **argv)
#endif
}
if (NULL != multi)
- {
- curl_multi_perform (multi, &running);
- if (running == 0)
- {
- msg = curl_multi_info_read (multi, &running);
- if (msg == NULL)
- break;
- if (msg->msg == CURLMSG_DONE)
- {
- if (msg->data.result != CURLE_OK)
- printf ("%s failed at %s:%d: `%s'\n",
- "curl_multi_perform",
- __FILE__,
- __LINE__, curl_easy_strerror (msg->data.result));
- curl_multi_remove_handle (multi, c);
- curl_multi_cleanup (multi);
- curl_easy_cleanup (c);
- c = NULL;
- multi = NULL;
- }
- }
- }
+ {
+ curl_multi_perform (multi, &running);
+ if (running == 0)
+ {
+ msg = curl_multi_info_read (multi, &running);
+ if (msg == NULL)
+ break;
+ if (msg->msg == CURLMSG_DONE)
+ {
+ if (msg->data.result != CURLE_OK)
+ printf ("%s failed at %s:%d: `%s'\n",
+ "curl_multi_perform",
+ __FILE__,
+ __LINE__, curl_easy_strerror (msg->data.result));
+ curl_multi_remove_handle (multi, c);
+ curl_multi_cleanup (multi);
+ curl_easy_cleanup (c);
+ c = NULL;
+ multi = NULL;
+ }
+ }
+ }
MHD_run(d);
}
MHD_stop_daemon(d);
diff --git a/src/testcurl/test_concurrent_stop.c
b/src/testcurl/test_concurrent_stop.c
index 3409d472..3436591e 100644
--- a/src/testcurl/test_concurrent_stop.c
+++ b/src/testcurl/test_concurrent_stop.c
@@ -63,8 +63,8 @@ static struct MHD_Response *response;
static size_t
copyBuffer (void *ptr,
- size_t size, size_t nmemb,
- void *ctx)
+ size_t size, size_t nmemb,
+ void *ctx)
{
(void)ptr;(void)ctx; /* Unused. Silent compiler warning. */
return size * nmemb;
@@ -286,8 +286,8 @@ main (int argc, char *const *argv)
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
return 2;
response = MHD_create_response_from_buffer (strlen ("/hello_world"),
- "/hello_world",
- MHD_RESPMEM_MUST_COPY);
+ "/hello_world",
+ MHD_RESPMEM_MUST_COPY);
errorCount += testMultithreadedGet (port, 0);
if (0 != port) port++;
errorCount += testMultithreadedPoolGet (port, 0);
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index 70f0f509..92fc9752 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -111,7 +111,7 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url), (void*) url,
- MHD_RESPMEM_MUST_COPY);
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c
index 48c7a87a..d0476688 100644
--- a/src/testcurl/test_digestauth.c
+++ b/src/testcurl/test_digestauth.c
@@ -96,29 +96,29 @@ ahc_echo (void *cls,
DENIED,
MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_auth_fail_response(connection, realm,
- MY_OPAQUE,
- response,
- MHD_NO);
+ MY_OPAQUE,
+ response,
+ MHD_NO);
MHD_destroy_response(response);
return ret;
}
ret = MHD_digest_auth_check(connection, realm,
- username,
- password,
- 300);
+ username,
+ password,
+ 300);
free(username);
if ( (ret == MHD_INVALID_NONCE) ||
(ret == MHD_NO) )
{
response = MHD_create_response_from_buffer(strlen (DENIED),
- DENIED,
- MHD_RESPMEM_PERSISTENT);
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
- return MHD_NO;
+ return MHD_NO;
ret = MHD_queue_auth_fail_response(connection, realm,
- MY_OPAQUE,
- response,
- (ret == MHD_INVALID_NONCE) ? MHD_YES :
MHD_NO);
+ MY_OPAQUE,
+ response,
+ (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO);
MHD_destroy_response(response);
return ret;
}
@@ -205,9 +205,9 @@ testDigestAuth ()
#endif
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, PAGE,
- MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
- MHD_OPTION_NONCE_NC_SIZE, 300,
- MHD_OPTION_END);
+ MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
+ MHD_OPTION_NONCE_NC_SIZE, 300,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
if (0 == port)
diff --git a/src/testcurl/test_digestauth_with_arguments.c
b/src/testcurl/test_digestauth_with_arguments.c
index 107d2256..0529627e 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -91,37 +91,37 @@ ahc_echo (void *cls,
(0 != strcmp (username, "testuser")) )
{
response = MHD_create_response_from_buffer(strlen (DENIED),
- DENIED,
- MHD_RESPMEM_PERSISTENT);
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_auth_fail_response(connection, realm,
- MY_OPAQUE,
- response,
- MHD_NO);
+ MY_OPAQUE,
+ response,
+ MHD_NO);
MHD_destroy_response(response);
return ret;
}
ret = MHD_digest_auth_check(connection, realm,
- username,
- password,
- 300);
+ username,
+ password,
+ 300);
free(username);
if ( (ret == MHD_INVALID_NONCE) ||
(ret == MHD_NO) )
{
response = MHD_create_response_from_buffer(strlen (DENIED),
- DENIED,
- MHD_RESPMEM_PERSISTENT);
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
- return MHD_NO;
+ return MHD_NO;
ret = MHD_queue_auth_fail_response(connection, realm,
- MY_OPAQUE,
- response,
- (ret == MHD_INVALID_NONCE) ? MHD_YES :
MHD_NO);
+ MY_OPAQUE,
+ response,
+ (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO);
MHD_destroy_response(response);
return ret;
}
response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
- MHD_RESPMEM_PERSISTENT);
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
return ret;
@@ -157,24 +157,24 @@ testDigestAuth ()
fd = open("/dev/urandom", O_RDONLY);
if (-1 == fd)
{
- fprintf(stderr, "Failed to open `%s': %s\n",
- "/dev/urandom",
- strerror(errno));
- return 1;
- }
+ fprintf(stderr, "Failed to open `%s': %s\n",
+ "/dev/urandom",
+ strerror(errno));
+ return 1;
+ }
while (off < 8)
- {
- len = read(fd, rnd, 8);
- if (len == (size_t)-1)
- {
- fprintf(stderr, "Failed to read `%s': %s\n",
- "/dev/urandom",
- strerror(errno));
- (void) close(fd);
- return 1;
- }
- off += len;
- }
+ {
+ len = read(fd, rnd, 8);
+ if (len == (size_t)-1)
+ {
+ fprintf(stderr, "Failed to read `%s': %s\n",
+ "/dev/urandom",
+ strerror(errno));
+ (void) close(fd);
+ return 1;
+ }
+ off += len;
+ }
(void) close(fd);
#else
{
@@ -200,9 +200,9 @@ testDigestAuth ()
#endif
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, PAGE,
- MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
- MHD_OPTION_NONCE_NC_SIZE, 300,
- MHD_OPTION_END);
+ MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
+ MHD_OPTION_NONCE_NC_SIZE, 300,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
if (0 == port)
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index 081859f7..86a4de60 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -100,8 +100,8 @@ ahc_echo (void *cls,
}
*unused = NULL;
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
@@ -637,8 +637,8 @@ ahc_empty (void *cls,
}
*unused = NULL;
response = MHD_create_response_from_buffer (0,
- NULL,
- MHD_RESPMEM_PERSISTENT);
+ NULL,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
diff --git a/src/testcurl/test_get_response_cleanup.c
b/src/testcurl/test_get_response_cleanup.c
index 8cb4f4a7..aa97ef8a 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -75,8 +75,8 @@ fork_curl (const char *url)
return ret;
execlp ("curl", "curl", "-s", "-N", "-o", "/dev/null", "-GET", url, NULL);
fprintf (stderr,
- "Failed to exec curl: %s\n",
- strerror (errno));
+ "Failed to exec curl: %s\n",
+ strerror (errno));
_exit (-1);
}
@@ -95,7 +95,7 @@ kill_curl (pid_t pid)
static ssize_t
push_callback (void *cls, uint64_t pos, char *buf, size_t max)
{
- (void)cls;(void)pos; /* Unused. Silent compiler warning. */
+ (void)cls;(void)pos; /* Unused. Silent compiler warning. */
if (max == 0)
return 0;
@@ -140,10 +140,10 @@ ahc_echo (void *cls,
}
*unused = NULL;
response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN,
- 32 * 1024,
- &push_callback,
- &ok,
- &push_free_callback);
+ 32 * 1024,
+ &push_callback,
+ &ok,
+ &push_free_callback);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
@@ -215,8 +215,8 @@ testMultithreadedGet ()
ok = 1;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, "GET",
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 2,
- MHD_OPTION_END);
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 2,
+ MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index 6718106d..dec08a75 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -102,8 +102,8 @@ ahc_echo (void *cls,
if (fd == -1)
{
fprintf (stderr, "Failed to open `%s': %s\n",
- sourcefile,
- strerror (errno));
+ sourcefile,
+ strerror (errno));
exit (1);
}
response = MHD_create_response_from_fd (strlen (TESTSTR), fd);
@@ -582,9 +582,9 @@ main (int argc, char *const *argv)
tmp = "/tmp";
sourcefile = malloc (strlen (tmp) + 32);
sprintf (sourcefile,
- "%s/%s",
- tmp,
- "test-mhd-sendfile");
+ "%s/%s",
+ tmp,
+ "test-mhd-sendfile");
f = fopen (sourcefile, "w");
if (NULL == f)
{
diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c
index 32f7e36a..e83dd8f7 100644
--- a/src/testcurl/test_iplimit.c
+++ b/src/testcurl/test_iplimit.c
@@ -96,8 +96,8 @@ ahc_echo (void *cls,
}
*unused = NULL;
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
@@ -285,7 +285,7 @@ testMultithreadedPoolGet ()
errornum = curl_easy_perform (c);
if ( ( (CURLE_OK != errornum) && (i < 2) ) ||
- ( (CURLE_OK == errornum) && (i == 2) ) )
+ ( (CURLE_OK == errornum) && (i == 2) ) )
{
int j;
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index b7a87c8f..c35e7c6c 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -165,8 +165,8 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -202,8 +202,8 @@ testPutInternalThread (unsigned int add_flag)
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG |
add_flag,
port,
NULL, NULL, &ahc_echo, &done_flag,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read
? 1024 : (PUT_SIZE * 4)),
- MHD_OPTION_END);
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 :
(PUT_SIZE * 4)),
+ MHD_OPTION_END);
if (d == NULL)
return 1;
if (0 == port)
@@ -283,7 +283,7 @@ testPutThreadPerConn (unsigned int add_flag)
port,
NULL, NULL, &ahc_echo, &done_flag,
MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read
? 1024 : (PUT_SIZE * 4)),
- MHD_OPTION_END);
+ MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
@@ -366,7 +366,7 @@ testPutThreadPool (unsigned int add_flag)
NULL, NULL, &ahc_echo, &done_flag,
MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT,
MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read
? 1024 : (PUT_SIZE * 4)),
- MHD_OPTION_END);
+ MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index 49b183dc..e3581b6a 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -84,8 +84,8 @@ ahc_echo (void *cls,
if (0 != strcmp (me, method))
return MHD_NO; /* unexpected method */
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -136,8 +136,8 @@ testLongUrlGet ()
url = malloc (VERY_LONG);
if (url == NULL)
{
- MHD_stop_daemon (d);
- return 1;
+ MHD_stop_daemon (d);
+ return 1;
}
memset (url, 'a', VERY_LONG);
url[VERY_LONG - 1] = '\0';
@@ -226,8 +226,8 @@ testLongHeaderGet ()
url = malloc (VERY_LONG);
if (url == NULL)
{
- MHD_stop_daemon (d);
- return 16;
+ MHD_stop_daemon (d);
+ return 16;
}
memset (url, 'a', VERY_LONG);
url[VERY_LONG - 1] = '\0';
diff --git a/src/testcurl/test_parse_cookies.c
b/src/testcurl/test_parse_cookies.c
index 3e2c181e..a10ac218 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -96,8 +96,8 @@ ahc_echo (void *cls,
if ((hdr == NULL) || (0 != strcmp (hdr, "var4 with spaces")))
abort ();
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_PERSISTENT);
+ (void *) url,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index 6b91b9cc..da4199c4 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -64,9 +64,9 @@ struct CBC
static void
completed_cb (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct MHD_PostProcessor *pp = *con_cls;
(void)cls;(void)connection;(void)toe; /* Unused. Silent compiler warning. */
@@ -149,8 +149,8 @@ ahc_echo (void *cls,
if ((eok == 3) && (0 == *upload_data_size))
{
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
@@ -186,8 +186,8 @@ testInternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
if (0 == port)
@@ -259,8 +259,8 @@ testMultithreadedPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
@@ -333,8 +333,8 @@ testMultithreadedPoolPost ()
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
@@ -421,8 +421,8 @@ testExternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 256;
if (0 == port)
@@ -546,12 +546,12 @@ testExternalPost ()
static int
ahc_cancel (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 **unused)
+ struct MHD_Connection *connection,
+ const char *url,
+ const char *method,
+ const char *version,
+ const char *upload_data, size_t *upload_data_size,
+ void **unused)
{
struct MHD_Response *response;
int ret;
@@ -561,7 +561,7 @@ ahc_cancel (void *cls,
if (0 != strcasecmp ("POST", method))
{
fprintf (stderr,
- "Unexpected method `%s'\n", method);
+ "Unexpected method `%s'\n", method);
return MHD_NO;
}
@@ -570,17 +570,17 @@ ahc_cancel (void *cls,
*unused = "wibble";
/* We don't want the body. Send a 500. */
response = MHD_create_response_from_buffer (0, NULL,
- MHD_RESPMEM_PERSISTENT);
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, 500, response);
if (ret != MHD_YES)
- fprintf(stderr, "Failed to queue response\n");
+ fprintf(stderr, "Failed to queue response\n");
MHD_destroy_response(response);
return ret;
}
else
{
fprintf(stderr,
- "In ahc_cancel again. This should not happen.\n");
+ "In ahc_cancel again. This should not happen.\n");
return MHD_NO;
}
}
@@ -659,7 +659,7 @@ testMultithreadedPostCancelPart(int flags)
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_cancel, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_END);
if (d == NULL)
return 32768;
if (0 == port)
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index 5ed57431..6d3a81e8 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -94,7 +94,7 @@ ahc_echo (void *cls,
if (*mptr != &marker)
abort ();
response = MHD_create_response_from_buffer (2, "OK",
- MHD_RESPMEM_PERSISTENT);
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
*mptr = NULL;
@@ -417,7 +417,7 @@ testExternalPost ()
for (i = 0; i < LOOPCOUNT; i++)
{
if (99 == i % 100)
- fprintf (stderr, ".");
+ fprintf (stderr, ".");
c = curl_easy_init ();
cbc.pos = 0;
buf[0] = '\0';
@@ -479,19 +479,19 @@ testExternalPost ()
if ((CURLM_OK == curl_multi_timeout (multi, &ctimeout)) &&
(ctimeout < (long long)timeout) && (ctimeout >= 0))
timeout = ctimeout;
- if ( (c == NULL) || (running == 0) )
- timeout = 0; /* terminate quickly... */
+ if ( (c == NULL) || (running == 0) )
+ timeout = 0; /* terminate quickly... */
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv))
- {
- if (EINTR == errno)
- continue;
- fprintf (stderr,
- "select failed: %s\n",
- strerror (errno));
- break;
- }
+ {
+ if (EINTR == errno)
+ continue;
+ fprintf (stderr,
+ "select failed: %s\n",
+ strerror (errno));
+ break;
+ }
while (CURLM_CALL_MULTI_PERFORM ==
curl_multi_perform (multi, &running));
if (running == 0)
@@ -551,7 +551,7 @@ now ()
gettimeofday (&tv, NULL);
return (((unsigned long long) tv.tv_sec * 1000LL) +
- ((unsigned long long) tv.tv_usec / 1000LL));
+ ((unsigned long long) tv.tv_usec / 1000LL));
}
@@ -568,43 +568,43 @@ main (int argc, char *const *argv)
start_time = now();
errorCount += testInternalPost ();
fprintf (stderr,
- oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential
POSTs (http/1.0) %f/s\n",
- "internal select",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
+ oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs
(http/1.0) %f/s\n",
+ "internal select",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
GAUGER ("internal select",
- oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs
(http/1.0)",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
- "requests/s");
+ oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
+ "requests/s");
start_time = now();
errorCount += testMultithreadedPost ();
fprintf (stderr,
- oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential
POSTs (http/1.0) %f/s\n",
- "multithreaded post",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
+ oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs
(http/1.0) %f/s\n",
+ "multithreaded post",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
GAUGER ("Multithreaded select",
- oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs
(http/1.0)",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
- "requests/s");
+ oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
+ "requests/s");
start_time = now();
errorCount += testMultithreadedPoolPost ();
fprintf (stderr,
- oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential
POSTs (http/1.0) %f/s\n",
- "thread with pool",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
+ oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs
(http/1.0) %f/s\n",
+ "thread with pool",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
GAUGER ("thread with pool",
- oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs
(http/1.0)",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
- "requests/s");
+ oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
+ "requests/s");
start_time = now();
errorCount += testExternalPost ();
fprintf (stderr,
- oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential
POSTs (http/1.0) %f/s\n",
- "external select",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
+ oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs
(http/1.0) %f/s\n",
+ "external select",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
GAUGER ("external select",
- oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs
(http/1.0)",
- (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
- "requests/s");
+ oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
+ (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
+ "requests/s");
if (errorCount != 0)
fprintf (stderr, "Error (code: %u)\n", errorCount);
curl_global_cleanup ();
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index f94ed1f8..403c0a77 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -60,9 +60,9 @@ struct CBC
static void
completed_cb (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct MHD_PostProcessor *pp = *con_cls;
(void)cls;(void)connection;(void)toe; /* Unused. Silent compiler
warning. */
@@ -150,8 +150,8 @@ ahc_echo (void *cls,
if ((eok == 3) && (0 == *upload_data_size))
{
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
@@ -201,8 +201,8 @@ testInternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
if (0 == port)
@@ -276,8 +276,8 @@ testMultithreadedPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
@@ -352,8 +352,8 @@ testMultithreadedPoolPost ()
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
@@ -442,8 +442,8 @@ testExternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_ERROR_LOG,
port, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 256;
if (0 == port)
diff --git a/src/testcurl/test_process_arguments.c
b/src/testcurl/test_process_arguments.c
index 4f29574d..49e3eef5 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -95,12 +95,12 @@ ahc_echo (void *cls,
if ((hdr == NULL) || (0 != strcmp (hdr, "\240bar")))
abort ();
if (3 != MHD_get_connection_values (connection,
- MHD_GET_ARGUMENT_KIND,
- NULL, NULL))
+ MHD_GET_ARGUMENT_KIND,
+ NULL, NULL))
abort ();
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
diff --git a/src/testcurl/test_process_headers.c
b/src/testcurl/test_process_headers.c
index d123c441..bf19781e 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -124,8 +124,8 @@ ahc_echo (void *cls,
abort ();
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
if (NULL == response)
abort ();
MHD_add_response_header (response, "MyHeader", "MyValue");
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index 83c4a124..b47358bf 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -111,7 +111,7 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url), (void*) url,
- MHD_RESPMEM_MUST_COPY);
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c
index 479079fb..4d5c6d47 100644
--- a/src/testcurl/test_put_chunked.c
+++ b/src/testcurl/test_put_chunked.c
@@ -120,8 +120,8 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c
index f9fd9690..8bee7fd5 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -94,8 +94,8 @@ ahc_echo (void *cls,
}
*unused = NULL;
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
@@ -106,7 +106,7 @@ ahc_echo (void *cls,
static void
request_completed (void *cls, struct MHD_Connection *connection,
- void **con_cls, enum MHD_RequestTerminationCode code)
+ void **con_cls, enum MHD_RequestTerminationCode code)
{
(void)connection;(void)con_cls;(void)code; /* Unused. Silent compiler
warning. */
int *done = (int *)cls;
diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c
index 6f633c84..ff660fc5 100644
--- a/src/testcurl/test_termination.c
+++ b/src/testcurl/test_termination.c
@@ -75,7 +75,7 @@ connection_handler (void *cls,
struct MHD_Response *response =
MHD_create_response_from_buffer (strlen ("Response"), "Response",
- MHD_RESPMEM_PERSISTENT);
+ MHD_RESPMEM_PERSISTENT);
int ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c
index 7621cfd1..e4d918af 100644
--- a/src/testcurl/test_timeout.c
+++ b/src/testcurl/test_timeout.c
@@ -52,9 +52,9 @@ struct CBC
static void
termination_cb (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
int *test = cls;
(void)connection;(void)con_cls; /* Unused. Silent compiler warning. */
@@ -63,18 +63,18 @@ termination_cb (void *cls,
{
case MHD_REQUEST_TERMINATED_COMPLETED_OK :
if (test == &withoutTimeout)
- {
- withoutTimeout = 0;
- }
+ {
+ withoutTimeout = 0;
+ }
break;
case MHD_REQUEST_TERMINATED_WITH_ERROR :
case MHD_REQUEST_TERMINATED_READ_ERROR :
break;
case MHD_REQUEST_TERMINATED_TIMEOUT_REACHED :
if (test == &withTimeout)
- {
- withTimeout = 0;
- }
+ {
+ withTimeout = 0;
+ }
break;
case MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN:
break;
@@ -92,7 +92,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
wrt = size * nmemb;
if (wrt > 8 - (*pos))
- wrt = 8 - (*pos);
+ wrt = 8 - (*pos);
memcpy (stream, &("Hello123"[*pos]), wrt);
(*pos) += wrt;
return wrt;
@@ -153,8 +153,8 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -300,11 +300,11 @@ testWithTimeout ()
curl_easy_cleanup (c);
MHD_stop_daemon (d);
if (errornum == CURLE_GOT_NOTHING)
- /* mhd had the timeout */
- return 0;
+ /* mhd had the timeout */
+ return 0;
else
- /* curl had the timeout first */
- return 32;
+ /* curl had the timeout first */
+ return 32;
}
curl_easy_cleanup (c);
MHD_stop_daemon (d);
@@ -326,8 +326,8 @@ main (int argc, char *const *argv)
errorCount += testWithTimeout ();
if (errorCount != 0)
fprintf (stderr,
- "Error during test execution (code: %u)\n",
- errorCount);
+ "Error during test execution (code: %u)\n",
+ errorCount);
curl_global_cleanup ();
if ((withTimeout == 0) && (withoutTimeout == 0))
return 0;
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index 8675f19c..ad2dcf8c 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -69,9 +69,9 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
static int
test_values (void *cls,
- enum MHD_ValueKind kind,
- const char *key,
- const char *value)
+ enum MHD_ValueKind kind,
+ const char *key,
+ const char *value)
{
(void)cls;(void)kind; /* Unused. Silent compiler warning. */
if ( (0 == strcmp (key, "a")) &&
@@ -109,13 +109,13 @@ ahc_echo (void *cls,
return MHD_YES;
}
MHD_get_connection_values (connection,
- MHD_GET_ARGUMENT_KIND,
- &test_values,
- NULL);
+ MHD_GET_ARGUMENT_KIND,
+ &test_values,
+ NULL);
*unused = NULL;
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c
index 7e116d09..7975e2aa 100644
--- a/src/testzzuf/test_get.c
+++ b/src/testzzuf/test_get.c
@@ -83,8 +83,8 @@ ahc_echo (void *cls,
}
*unused = NULL;
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
diff --git a/src/testzzuf/test_long_header.c b/src/testzzuf/test_long_header.c
index c4e5cf81..6e3c8817 100644
--- a/src/testzzuf/test_long_header.c
+++ b/src/testzzuf/test_long_header.c
@@ -86,8 +86,8 @@ ahc_echo (void *cls,
if (0 != strcmp (me, method))
return MHD_NO; /* unexpected method */
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c
index 9a4a8e9c..8327276c 100644
--- a/src/testzzuf/test_post.c
+++ b/src/testzzuf/test_post.c
@@ -53,9 +53,9 @@ struct CBC
static void
completed_cb (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct MHD_PostProcessor *pp = *con_cls;
(void)cls;(void)connection;(void)toe; /* Unused. Silent compiler warning. */
@@ -136,8 +136,8 @@ ahc_echo (void *cls,
if ((eok == 3) && (0 == *upload_data_size))
{
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
@@ -163,8 +163,8 @@ testInternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG
*/ ,
11080, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
zzuf_socat_start ();
@@ -214,8 +214,8 @@ testMultithreadedPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ ,
11080, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 16;
@@ -277,8 +277,8 @@ testExternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */ ,
1082, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 256;
multi = curl_multi_init ();
diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c
index fe248d47..7363eac8 100644
--- a/src/testzzuf/test_post_form.c
+++ b/src/testzzuf/test_post_form.c
@@ -51,9 +51,9 @@ struct CBC
static void
completed_cb (void *cls,
- struct MHD_Connection *connection,
- void **con_cls,
- enum MHD_RequestTerminationCode toe)
+ struct MHD_Connection *connection,
+ void **con_cls,
+ enum MHD_RequestTerminationCode toe)
{
struct MHD_PostProcessor *pp = *con_cls;
(void)cls;(void)connection;(void)toe; /* Unused. Silent compiler
warning. */
@@ -141,8 +141,8 @@ ahc_echo (void *cls,
if ((eok == 3) && (0 == *upload_data_size))
{
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
@@ -182,8 +182,8 @@ testInternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG
*/ ,
11080, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 1;
zzuf_socat_start ();
@@ -233,8 +233,8 @@ testMultithreadedPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ ,
11080, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 16;
zzuf_socat_start ();
@@ -294,8 +294,8 @@ testExternalPost ()
cbc.pos = 0;
d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */ ,
1082, NULL, NULL, &ahc_echo, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
+ MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+ MHD_OPTION_END);
if (d == NULL)
return 256;
multi = curl_multi_init ();
diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c
index cfe12dee..a51d32f7 100644
--- a/src/testzzuf/test_put.c
+++ b/src/testzzuf/test_put.c
@@ -107,8 +107,8 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c
index 72a9f316..67029945 100644
--- a/src/testzzuf/test_put_chunked.c
+++ b/src/testzzuf/test_put_chunked.c
@@ -113,8 +113,8 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c
index 540c37f9..915689f8 100644
--- a/src/testzzuf/test_put_large.c
+++ b/src/testzzuf/test_put_large.c
@@ -94,7 +94,7 @@ ahc_echo (void *cls,
int *done = cls;
struct MHD_Response *response;
int ret;
- (void)version;(void)unused; /* Unused. Silent compiler warning. */
+ (void)version;(void)unused; /* Unused. Silent compiler warning. */
if (0 != strcmp ("PUT", method))
return MHD_NO; /* unexpected method */
@@ -121,8 +121,8 @@ ahc_echo (void *cls,
return MHD_YES;
}
response = MHD_create_response_from_buffer (strlen (url),
- (void *) url,
- MHD_RESPMEM_MUST_COPY);
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
@@ -365,7 +365,7 @@ int
main (int argc, char *const *argv)
{
unsigned int errorCount = 0;
- (void)argc; /* Unused. Silent compiler warning. */
+ (void)argc; /* Unused. Silent compiler warning. */
oneone = (NULL != strrchr (argv[0], (int) '/')) ?
(NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0;
--
2.16.1
- [libmicrohttpd] [PATCH] code style: remove tabs from source code,
Moritz Warning <=