summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-08-18 13:01:23 +0000
committerChristian Grothoff <christian@grothoff.org>2007-08-18 13:01:23 +0000
commit806387b6052d1892b511a9701117a33591c1aa05 (patch)
tree35d58ab338829c614cb1ab6679c73555672847be
parent6f1d61c647808174873f0f507ec215fa8512cb69 (diff)
additional testcase and auto-repeat processing on accept
-rw-r--r--src/daemon/Makefile.am15
-rw-r--r--src/daemon/daemon.c134
-rw-r--r--src/daemon/daemontest_get.c27
-rw-r--r--src/daemon/daemontest_large_put.c388
-rw-r--r--src/daemon/daemontest_post.c27
-rw-r--r--src/daemon/daemontest_put.c26
6 files changed, 493 insertions, 124 deletions
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 8a0aa4b2..e70583d3 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -38,9 +38,11 @@ check_PROGRAMS = \
daemontest_get \
daemontest_post \
daemontest_put \
+ daemontest_large_put \
daemontest_get11 \
daemontest_post11 \
daemontest_put11 \
+ daemontest_large_put11 \
daemontest_long_header
TESTS = $(check_PROGRAMS)
@@ -86,6 +88,19 @@ daemontest_put11_LDADD = \
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
+
+daemontest_large_put_SOURCES = \
+ daemontest_large_put.c
+daemontest_large_put_LDADD = \
+ $(top_builddir)/src/daemon/libmicrohttpd.la \
+ @LIBCURL@
+
+daemontest_large_put11_SOURCES = \
+ daemontest_large_put.c
+daemontest_large_put11_LDADD = \
+ $(top_builddir)/src/daemon/libmicrohttpd.la \
+ @LIBCURL@
+
daemontest_long_header_SOURCES = \
daemontest_long_header.c
daemontest_long_header_LDADD = \
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 26b13d35..385e37c3 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -429,6 +429,7 @@ MHD_select (struct MHD_Daemon *daemon, int may_block)
unsigned long long ltimeout;
int ds;
time_t now;
+ int go_again;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
@@ -436,78 +437,87 @@ MHD_select (struct MHD_Daemon *daemon, int may_block)
abort ();
if (daemon->shutdown == MHD_YES)
return MHD_NO;
- FD_ZERO (&rs);
- FD_ZERO (&ws);
- FD_ZERO (&es);
- max = 0;
-
- if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
- {
- /* single-threaded, go over everything */
- if (MHD_NO == MHD_get_fdset (daemon, &rs, &ws, &es, &max))
- return MHD_NO;
- }
- else
+ go_again = MHD_YES;
+ while (go_again == MHD_YES)
{
- /* accept only, have one thread per connection */
- max = daemon->socket_fd;
- if (max == -1)
+ go_again = MHD_NO;
+ FD_ZERO (&rs);
+ FD_ZERO (&ws);
+ FD_ZERO (&es);
+ max = 0;
+
+ if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
+ {
+ /* single-threaded, go over everything */
+ if (MHD_NO == MHD_get_fdset (daemon, &rs, &ws, &es, &max))
+ return MHD_NO;
+ }
+ else
+ {
+ /* accept only, have one thread per connection */
+ max = daemon->socket_fd;
+ if (max == -1)
+ return MHD_NO;
+ FD_SET (max, &rs);
+ }
+ if (may_block == MHD_NO)
+ {
+ timeout.tv_usec = 0;
+ timeout.tv_sec = 0;
+ }
+ else
+ {
+ /* ltimeout is in ms */
+ if (MHD_YES == MHD_get_timeout (daemon, &ltimeout))
+ {
+ timeout.tv_usec = (ltimeout % 1000) * 1000 * 1000;
+ timeout.tv_sec = ltimeout / 1000;
+ may_block = MHD_NO;
+ }
+ }
+ num_ready = SELECT (max + 1,
+ &rs, &ws, &es,
+ may_block == MHD_NO ? &timeout : NULL);
+ if (daemon->shutdown == MHD_YES)
return MHD_NO;
- FD_SET (max, &rs);
- }
- if (may_block == MHD_NO)
- {
- timeout.tv_usec = 0;
- timeout.tv_sec = 0;
- }
- else
- {
- /* ltimeout is in ms */
- if (MHD_YES == MHD_get_timeout (daemon, &ltimeout))
+ if (num_ready < 0)
{
- timeout.tv_usec = (ltimeout % 1000) * 1000 * 1000;
- timeout.tv_sec = ltimeout / 1000;
- may_block = MHD_NO;
+ if (errno == EINTR)
+ return MHD_YES;
+ MHD_DLOG (daemon, "Select failed: %s\n", STRERROR (errno));
+ return MHD_NO;
}
- }
- num_ready = SELECT (max + 1,
- &rs, &ws, &es, may_block == MHD_NO ? &timeout : NULL);
- if (daemon->shutdown == MHD_YES)
- return MHD_NO;
- if (num_ready < 0)
- {
- if (errno == EINTR)
+ ds = daemon->socket_fd;
+ if (ds == -1)
return MHD_YES;
- MHD_DLOG (daemon, "Select failed: %s\n", STRERROR (errno));
- return MHD_NO;
- }
- ds = daemon->socket_fd;
- if (ds == -1)
- return MHD_YES;
- if (FD_ISSET (ds, &rs))
- MHD_accept_connection (daemon);
- if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
- {
- /* do not have a thread per connection, process all connections now */
- now = time (NULL);
- pos = daemon->connections;
- while (pos != NULL)
+ if (FD_ISSET (ds, &rs))
+ {
+ MHD_accept_connection (daemon);
+ go_again = MHD_YES;
+ }
+ if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
- ds = pos->socket_fd;
- if (ds != -1)
+ /* do not have a thread per connection, process all connections now */
+ now = time (NULL);
+ pos = daemon->connections;
+ while (pos != NULL)
{
- if (FD_ISSET (ds, &rs))
- {
- pos->last_activity = now;
- MHD_connection_handle_read (pos);
- }
- if (FD_ISSET (ds, &ws))
+ ds = pos->socket_fd;
+ if (ds != -1)
{
- pos->last_activity = now;
- MHD_connection_handle_write (pos);
+ if (FD_ISSET (ds, &rs))
+ {
+ pos->last_activity = now;
+ MHD_connection_handle_read (pos);
+ }
+ if (FD_ISSET (ds, &ws))
+ {
+ pos->last_activity = now;
+ MHD_connection_handle_write (pos);
+ }
}
+ pos = pos->next;
}
- pos = pos->next;
}
}
return MHD_YES;
diff --git a/src/daemon/daemontest_get.c b/src/daemon/daemontest_get.c
index f5ef084f..e8ce1e7a 100644
--- a/src/daemon/daemontest_get.c
+++ b/src/daemon/daemontest_get.c
@@ -120,19 +120,11 @@ testInternalGet ()
return 2;
}
curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
- {
- MHD_stop_daemon (d);
- return 4;
- }
-
+ return 4;
if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
- {
- MHD_stop_daemon (d);
- return 8;
- }
- MHD_stop_daemon (d);
-
+ return 8;
return 0;
}
@@ -177,18 +169,11 @@ testMultithreadedGet ()
return 32;
}
curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
- {
- MHD_stop_daemon (d);
- return 64;
- }
+ return 64;
if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
- {
- MHD_stop_daemon (d);
- return 128;
- }
- MHD_stop_daemon (d);
-
+ return 128;
return 0;
}
diff --git a/src/daemon/daemontest_large_put.c b/src/daemon/daemontest_large_put.c
new file mode 100644
index 00000000..e176d29c
--- /dev/null
+++ b/src/daemon/daemontest_large_put.c
@@ -0,0 +1,388 @@
+/*
+ This file is part of libmicrohttpd
+ (C) 2007 Christian Grothoff
+
+ libmicrohttpd is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ libmicrohttpd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libmicrohttpd; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file daemontest_put.c
+ * @brief Testcase for libmicrohttpd PUT operations
+ * @author Christian Grothoff
+ */
+
+#include "config.h"
+#include <curl/curl.h>
+#include <microhttpd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#ifndef WINDOWS
+#include <unistd.h>
+#endif
+
+static int oneone;
+
+/**
+ * Do not make this much larger since we will hit the
+ * MHD default buffer limit and the test code is not
+ * written for incremental upload processing...
+ */
+#define PUT_SIZE (512 * 1024)
+
+static char *put_buffer;
+
+struct CBC
+{
+ char *buf;
+ size_t pos;
+ size_t size;
+};
+
+static size_t
+putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
+{
+ unsigned int *pos = ptr;
+ unsigned int wrt;
+
+ wrt = size * nmemb;
+ if (wrt > PUT_SIZE - (*pos))
+ wrt = PUT_SIZE - (*pos);
+ memcpy (stream, &put_buffer[*pos], wrt);
+ (*pos) += wrt;
+ return wrt;
+}
+
+static size_t
+copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
+{
+ struct CBC *cbc = ctx;
+
+ if (cbc->pos + size * nmemb > cbc->size)
+ return 0; /* overflow */
+ memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
+ cbc->pos += size * nmemb;
+ return size * nmemb;
+}
+
+static int
+ahc_echo (void *cls,
+ struct MHD_Connection *connection,
+ const char *url,
+ const char *method,
+ const char *version,
+ const char *upload_data, unsigned int *upload_data_size)
+{
+ int *done = cls;
+ struct MHD_Response *response;
+ int ret;
+
+ if (0 != strcmp ("PUT", method))
+ return MHD_NO; /* unexpected method */
+ if ((*done) == 0)
+ {
+ if (*upload_data_size != PUT_SIZE)
+ return MHD_YES; /* not yet ready */
+ if (0 == memcmp (upload_data, put_buffer, PUT_SIZE))
+ {
+ *upload_data_size = 0;
+ }
+ else
+ {
+ printf ("Invalid upload data!\n");
+ return MHD_NO;
+ }
+ *done = 1;
+ return MHD_YES;
+ }
+ response = MHD_create_response_from_data (strlen (url),
+ (void *) url, MHD_NO, MHD_YES);
+ ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
+ MHD_destroy_response (response);
+ return ret;
+}
+
+
+static int
+testInternalPut ()
+{
+ struct MHD_Daemon *d;
+ CURL *c;
+ struct CBC cbc;
+ unsigned int pos = 0;
+ int done_flag = 0;
+ CURLcode errornum;
+ char buf[2048];
+
+ cbc.buf = buf;
+ cbc.size = 2048;
+ cbc.pos = 0;
+ d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
+ 1080,
+ NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
+ if (d == NULL)
+ return 1;
+ c = curl_easy_init ();
+ curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world");
+ curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
+ curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
+ curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer);
+ curl_easy_setopt (c, CURLOPT_READDATA, &pos);
+ curl_easy_setopt (c, CURLOPT_UPLOAD, 1L);
+ curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE);
+ 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);
+ else
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L);
+ // NOTE: use of CONNECTTIMEOUT without also
+ // 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;
+ }
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ if (cbc.pos != strlen ("/hello_world"))
+ return 4;
+ if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
+ return 8;
+ return 0;
+}
+
+static int
+testMultithreadedPut ()
+{
+ struct MHD_Daemon *d;
+ CURL *c;
+ struct CBC cbc;
+ unsigned int pos = 0;
+ int done_flag = 0;
+ CURLcode errornum;
+ char buf[2048];
+
+ cbc.buf = buf;
+ cbc.size = 2048;
+ cbc.pos = 0;
+ d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
+ 1081,
+ NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
+ if (d == NULL)
+ {
+ free (cbc.buf);
+ return 16;
+ }
+ c = curl_easy_init ();
+ curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world");
+ curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
+ curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
+ curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer);
+ curl_easy_setopt (c, CURLOPT_READDATA, &pos);
+ curl_easy_setopt (c, CURLOPT_UPLOAD, 1L);
+ curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE);
+ 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);
+ else
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L);
+ // NOTE: use of CONNECTTIMEOUT without also
+ // 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;
+ }
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ if (cbc.pos != strlen ("/hello_world"))
+ return 64;
+ if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
+ return 128;
+ return 0;
+}
+
+
+static int
+testExternalPut ()
+{
+ struct MHD_Daemon *d;
+ CURL *c;
+ struct CBC cbc;
+ CURLM *multi;
+ CURLMcode mret;
+ fd_set rs;
+ fd_set ws;
+ fd_set es;
+ int max;
+ int running;
+ struct CURLMsg *msg;
+ time_t start;
+ struct timeval tv;
+ unsigned int pos = 0;
+ int done_flag = 0;
+ char buf[2048];
+
+ cbc.buf = buf;
+ cbc.size = 2048;
+ cbc.pos = 0;
+ multi = NULL;
+ d = MHD_start_daemon (MHD_USE_DEBUG,
+ 1082,
+ NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
+ if (d == NULL)
+ return 256;
+ c = curl_easy_init ();
+ curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world");
+ curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
+ curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
+ curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer);
+ curl_easy_setopt (c, CURLOPT_READDATA, &pos);
+ curl_easy_setopt (c, CURLOPT_UPLOAD, 1L);
+ curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE);
+ 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);
+ else
+ curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L);
+ // NOTE: use of CONNECTTIMEOUT without also
+ // setting NOSIGNAL results in really weird
+ // crashes on my system!
+ curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
+
+
+ multi = curl_multi_init ();
+ if (multi == NULL)
+ {
+ curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
+ return 512;
+ }
+ 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;
+ }
+ start = time (NULL);
+ while ((time (NULL) - start < 5) && (multi != NULL))
+ {
+ max = 0;
+ FD_ZERO (&rs);
+ FD_ZERO (&ws);
+ FD_ZERO (&es);
+ curl_multi_perform (multi, &running);
+ mret = curl_multi_fdset (multi, &rs, &ws, &es, &max);
+ 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, &max))
+ {
+ 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;
+ select (max + 1, &rs, &ws, &es, &tv);
+ 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);
+ }
+ if (multi != NULL)
+ {
+ curl_multi_remove_handle (multi, c);
+ curl_easy_cleanup (c);
+ curl_multi_cleanup (multi);
+ }
+ MHD_stop_daemon (d);
+ if (cbc.pos != strlen ("/hello_world"))
+ return 64;
+ if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
+ return 128;
+ return 0;
+}
+
+
+
+int
+main (int argc, char *const *argv)
+{
+ unsigned int errorCount = 0;
+
+ oneone = NULL != strstr (argv[0], "11");
+ if (0 != curl_global_init (CURL_GLOBAL_WIN32))
+ return 2;
+ put_buffer = malloc (PUT_SIZE);
+ memset (put_buffer, 1, PUT_SIZE);
+ if (0)
+ {
+ errorCount += testInternalPut ();
+ errorCount += testMultithreadedPut ();
+ }
+ errorCount += testExternalPut ();
+ free (put_buffer);
+ if (errorCount != 0)
+ fprintf (stderr, "Error (code: %u)\n", errorCount);
+ curl_global_cleanup ();
+ return errorCount != 0; /* 0 == pass */
+}
diff --git a/src/daemon/daemontest_post.c b/src/daemon/daemontest_post.c
index 6764450e..ec60575b 100644
--- a/src/daemon/daemontest_post.c
+++ b/src/daemon/daemontest_post.c
@@ -142,19 +142,11 @@ testInternalPost ()
return 2;
}
curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
- {
- MHD_stop_daemon (d);
- return 4;
- }
-
+ return 4;
if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
- {
- MHD_stop_daemon (d);
- return 8;
- }
- MHD_stop_daemon (d);
-
+ return 8;
return 0;
}
@@ -202,18 +194,11 @@ testMultithreadedPost ()
return 32;
}
curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
- {
- MHD_stop_daemon (d);
- return 64;
- }
+ return 64;
if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
- {
- MHD_stop_daemon (d);
- return 128;
- }
- MHD_stop_daemon (d);
-
+ return 128;
return 0;
}
diff --git a/src/daemon/daemontest_put.c b/src/daemon/daemontest_put.c
index 198eb0f8..bd3e0a52 100644
--- a/src/daemon/daemontest_put.c
+++ b/src/daemon/daemontest_put.c
@@ -156,19 +156,11 @@ testInternalPut ()
return 2;
}
curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
- {
- MHD_stop_daemon (d);
- return 4;
- }
-
+ return 4;
if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
- {
- MHD_stop_daemon (d);
- return 8;
- }
- MHD_stop_daemon (d);
-
+ return 8;
return 0;
}
@@ -220,17 +212,11 @@ testMultithreadedPut ()
return 32;
}
curl_easy_cleanup (c);
+ MHD_stop_daemon (d);
if (cbc.pos != strlen ("/hello_world"))
- {
- MHD_stop_daemon (d);
- return 64;
- }
+ return 64;
if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
- {
- MHD_stop_daemon (d);
- return 128;
- }
- MHD_stop_daemon (d);
+ return 128;
return 0;
}