gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 06/09: testcurl: Muted some compiler warnings, minor ref


From: gnunet
Subject: [libmicrohttpd] 06/09: testcurl: Muted some compiler warnings, minor refactoring
Date: Sat, 01 Oct 2022 14:16:06 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 53207f93b0886adddf9bc0fa6ac1ba88db7a6682
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Sep 30 15:32:43 2022 +0300

    testcurl: Muted some compiler warnings, minor refactoring
    
    Used new API for creating of responses to avoid 'const' drops
---
 src/testcurl/perf_get.c                  | 23 +++++----
 src/testcurl/perf_get_concurrent.c       | 37 ++++++++-------
 src/testcurl/test_add_conn.c             | 15 +++---
 src/testcurl/test_concurrent_stop.c      | 13 +++--
 src/testcurl/test_delete.c               |  4 +-
 src/testcurl/test_digestauth_emu_ext.c   |  1 +
 src/testcurl/test_get.c                  | 21 ++++-----
 src/testcurl/test_get_chunked.c          | 15 +++---
 src/testcurl/test_get_close_keep_alive.c | 13 +++--
 src/testcurl/test_get_iovec.c            | 81 ++++++++++++++++----------------
 src/testcurl/test_get_response_cleanup.c | 13 +++--
 src/testcurl/test_get_sendfile.c         | 14 +++---
 src/testcurl/test_get_wait.c             | 11 ++---
 src/testcurl/test_iplimit.c              | 13 +++--
 src/testcurl/test_large_put.c            |  6 +--
 src/testcurl/test_long_header.c          | 15 +++---
 src/testcurl/test_patch.c                |  4 +-
 src/testcurl/test_post.c                 | 16 +++----
 src/testcurl/test_post_loop.c            |  8 +++-
 src/testcurl/test_postform.c             |  5 +-
 src/testcurl/test_process_arguments.c    | 11 ++---
 src/testcurl/test_process_headers.c      | 17 ++++---
 src/testcurl/test_put.c                  |  4 +-
 src/testcurl/test_put_chunked.c          |  5 +-
 src/testcurl/test_quiesce.c              | 19 ++++----
 src/testcurl/test_quiesce_stream.c       |  4 +-
 src/testcurl/test_timeout.c              |  7 ++-
 src/testcurl/test_toolarge.c             | 10 ++--
 src/testcurl/test_tricky.c               | 10 ++--
 src/testcurl/test_urlparse.c             | 11 ++---
 30 files changed, 208 insertions(+), 218 deletions(-)

diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index a9298b2a..825e4778 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -166,12 +166,12 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   enum MHD_Result ret;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -203,8 +203,8 @@ testInternalGet (int port, int poll_flag)
   cbc.buf = buf;
   cbc.size = 2048;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        | (enum MHD_FLAG) poll_flag,
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
   if (0 == port)
@@ -282,8 +282,8 @@ testMultithreadedGet (int port, int poll_flag)
   cbc.size = 2048;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        | (enum MHD_FLAG) poll_flag,
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 16;
   if (0 == port)
@@ -363,8 +363,8 @@ testMultithreadedPoolGet (int port, int poll_flag)
   cbc.buf = buf;
   cbc.size = 2048;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        | (enum MHD_FLAG) poll_flag,
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -459,7 +459,7 @@ testExternalGet (int port)
   cbc.size = 2048;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_END);
   if (NULL == d)
     return 256;
@@ -638,9 +638,8 @@ main (int argc, char *const *argv)
     port += 15;
   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);
+  response = MHD_create_response_from_buffer_copy (strlen ("/hello_world"),
+                                                   "/hello_world");
   errorCount += testExternalGet (port++);
   if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
   {
diff --git a/src/testcurl/perf_get_concurrent.c 
b/src/testcurl/perf_get_concurrent.c
index f0b4e923..203fead1 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -157,12 +157,12 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   enum MHD_Result ret;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -184,6 +184,7 @@ thread_gets (void *param)
   CURLcode errornum;
   unsigned int i;
   char *const url = (char *) param;
+  static char curl_err_marker[] = "curl error";
 
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, url);
@@ -208,7 +209,7 @@ thread_gets (void *param)
                "curl_easy_perform failed: `%s'\n",
                curl_easy_strerror (errornum));
       curl_easy_cleanup (c);
-      return "curl error";
+      return curl_err_marker;
     }
   }
   curl_easy_cleanup (c);
@@ -225,6 +226,7 @@ do_gets (void *param)
   char url[64];
   int port = (int) (intptr_t) param;
   char *err = NULL;
+  static char pthr_err_marker[] = "pthread_create error";
 
   snprintf (url,
             sizeof (url),
@@ -236,7 +238,7 @@ do_gets (void *param)
     {
       for (j--; j >= 0; j--)
         pthread_join (par[j], NULL);
-      return "pthread_create error";
+      return pthr_err_marker;
     }
   }
   for (j = 0; j < PAR; j++)
@@ -269,8 +271,8 @@ testInternalGet (int port, int poll_flag)
 
   signal_done = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        | (enum MHD_FLAG) poll_flag,
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
   if (0 == port)
@@ -320,8 +322,8 @@ testMultithreadedGet (int port, int poll_flag)
   signal_done = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        | (enum MHD_FLAG) poll_flag,
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 16;
   if (0 == port)
@@ -367,8 +369,8 @@ testMultithreadedPoolGet (int port, int poll_flag)
 
   signal_done = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        | (enum MHD_FLAG) poll_flag,
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -418,7 +420,7 @@ testExternalGet (int port)
 
   signal_done = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
@@ -453,8 +455,12 @@ testExternalGet (int port)
     tret = MHD_get_timeout64 (d, &tt64);
     if (MHD_YES != tret)
       tt64 = 1;
-    tv.tv_sec = tt64 / 1000;
-    tv.tv_usec = 1000 * (tt64 % 1000);
+#if ! defined(_WIN32) || defined(__CYGWIN__)
+    tv.tv_sec = (time_t) (tt64 / 1000);
+#else  /* Native W32 */
+    tv.tv_sec = (long) (tt64 / 1000);
+#endif /* Native W32 */
+    tv.tv_usec = ((long) (tt64 % 1000)) * 1000;
     if (-1 == select (max + 1, &rs, &ws, &es, &tv))
     {
 #ifdef MHD_POSIX_SOCKETS
@@ -511,9 +517,8 @@ main (int argc, char *const *argv)
     port += 15;
   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);
+  response = MHD_create_response_from_buffer_copy (strlen ("/hello_world"),
+                                                   "/hello_world");
   errorCount += testInternalGet (port++, 0);
   errorCount += testMultithreadedGet (port++, 0);
   errorCount += testMultithreadedPoolGet (port++, 0);
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c
index 62386657..085d5e69 100644
--- a/src/testcurl/test_add_conn.c
+++ b/src/testcurl/test_add_conn.c
@@ -151,15 +151,15 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
   const char *v;
+  (void) cls;
   (void) version;
   (void) upload_data;
   (void) upload_data_size;       /* Unused. Silence compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -200,9 +200,8 @@ ahc_echo (void *cls,
   if (slow_reply)
     usleep (200000);
 
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection,
                             MHD_HTTP_OK,
                             response);
@@ -266,7 +265,7 @@ createListeningSocket (int *pport)
   struct sockaddr_in sin;
   socklen_t sin_len;
 #ifdef MHD_POSIX_SOCKETS
-  static const int on = 1;
+  static int on = 1;
 #endif /* MHD_POSIX_SOCKETS */
 
   skt = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -745,7 +744,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
                           | (no_listen ? MHD_USE_NO_LISTEN_SOCKET : 0)
                           | MHD_USE_ERROR_LOG,
                           *pport, NULL, NULL,
-                          &ahc_echo, "GET",
+                          &ahc_echo, NULL,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                           MHD_OPTION_END);
   else
@@ -754,7 +753,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
                           | (no_listen ? MHD_USE_NO_LISTEN_SOCKET : 0)
                           | MHD_USE_ERROR_LOG,
                           *pport, NULL, NULL,
-                          &ahc_echo, "GET",
+                          &ahc_echo, NULL,
                           MHD_OPTION_THREAD_POOL_SIZE,
                           testNumThreadsForPool (pollType),
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
diff --git a/src/testcurl/test_concurrent_stop.c 
b/src/testcurl/test_concurrent_stop.c
index e427ea42..d40f911b 100644
--- a/src/testcurl/test_concurrent_stop.c
+++ b/src/testcurl/test_concurrent_stop.c
@@ -145,12 +145,12 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int marker;
-  const char *me = cls;
   enum MHD_Result ret;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&marker != *req_cls)
   {
@@ -273,7 +273,7 @@ testMultithreadedGet (int port,
                         | poll_flag,
                         port,
                         NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_END);
   if (d == NULL)
     return 16;
@@ -318,7 +318,7 @@ testMultithreadedPoolGet (int port,
                         | poll_flag,
                         port,
                         NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -371,9 +371,8 @@ main (int argc, char *const *argv)
     port += 5;
   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);
+  response = MHD_create_response_from_buffer_copy (strlen ("/hello_world"),
+                                                   "/hello_world");
   errorCount += testMultithreadedGet (port, 0);
   if (0 != port)
     port++;
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index f0e89395..91b51851 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -115,8 +115,8 @@ ahc_echo (void *cls,
     *done = 1;
     return MHD_YES;
   }
-  response = MHD_create_response_from_buffer (strlen (url), (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
   return ret;
diff --git a/src/testcurl/test_digestauth_emu_ext.c 
b/src/testcurl/test_digestauth_emu_ext.c
index b3925d13..10e04477 100644
--- a/src/testcurl/test_digestauth_emu_ext.c
+++ b/src/testcurl/test_digestauth_emu_ext.c
@@ -530,6 +530,7 @@ ahc_echo (void *cls,
     case MHD_DAUTH_WRONG_QOP:
     case MHD_DAUTH_WRONG_ALGO:
     case MHD_DAUTH_TOO_LARGE:
+    case MHD_DAUTH_NONCE_OTHER_COND:
       fprintf (stderr, "'MHD_digest_auth_check3()' returned "
                "unexpected result: %d. ",
                check_res);
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index 8fe1c771..09641fc5 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -110,15 +110,15 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
   const char *v;
+  (void) cls;
   (void) version;
   (void) upload_data;
   (void) upload_data_size;       /* Unused. Silence compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -156,9 +156,8 @@ ahc_echo (void *cls,
              NULL == v ? "NULL" : v);
     _exit (19);
   }
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection,
                             MHD_HTTP_OK,
                             response);
@@ -195,7 +194,7 @@ testInternalGet (int poll_flag)
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | poll_flag,
                         global_port, NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -269,7 +268,7 @@ testMultithreadedGet (int poll_flag)
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | poll_flag,
                         global_port, NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -342,7 +341,7 @@ testMultithreadedPoolGet (int poll_flag)
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | poll_flag,
                         global_port, NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                         MHD_OPTION_END);
@@ -426,7 +425,7 @@ testExternalGet ()
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         global_port, NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -601,7 +600,7 @@ testUnknownPortGet (int poll_flag)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | poll_flag,
-                        0, NULL, NULL, &ahc_echo, "GET",
+                        0, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_SOCK_ADDR, &addr,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                         MHD_OPTION_END);
@@ -688,7 +687,7 @@ testStopRace (int poll_flag)
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | poll_flag,
                         global_port, NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                         MHD_OPTION_END);
   if (d == NULL)
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 4f7b5606..5cc5aea9 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -183,16 +183,16 @@ ahc_echo (void *cls,
           const char *upload_data, size_t *upload_data_size, void **req_cls)
 {
   static int aptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
 
+  (void) cls;
   (void) url;
   (void) version;              /* Unused. Silent compiler warning. */
   (void) upload_data;
   (void) upload_data_size;     /* Unused. Silent compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&aptr != *req_cls)
   {
@@ -227,8 +227,7 @@ ahc_echo (void *cls,
       for (pos = 0; pos < resp_size; pos += RESP_BLOCK_SIZE)
         memset (buf + pos, 'A' + (pos / RESP_BLOCK_SIZE), RESP_BLOCK_SIZE);
 
-      response = MHD_create_response_from_buffer (resp_size, buf,
-                                                  MHD_RESPMEM_MUST_COPY);
+      response = MHD_create_response_from_buffer_copy (resp_size, buf);
       free (buf);
     }
     else
@@ -324,7 +323,7 @@ testInternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
   if (0 == port)
@@ -407,7 +406,7 @@ testMultithreadedGet ()
   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, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 16;
   if (0 == port)
@@ -489,7 +488,7 @@ testMultithreadedPoolGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -588,7 +587,7 @@ testExternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_get_close_keep_alive.c 
b/src/testcurl/test_get_close_keep_alive.c
index 7857f2ad..ef020833 100644
--- a/src/testcurl/test_get_close_keep_alive.c
+++ b/src/testcurl/test_get_close_keep_alive.c
@@ -315,14 +315,14 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
+  (void) cls;
   (void) version;
   (void) upload_data;
   (void) upload_data_size;       /* Unused. Silence compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -333,9 +333,8 @@ ahc_echo (void *cls,
   if (slow_reply)
     usleep (200000);
 
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   if (NULL == response)
   {
     fprintf (stderr, "Failed to create response. Line: %d\n", __LINE__);
@@ -960,14 +959,14 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
     d = MHD_start_daemon (((int) thrType) | ((int) pollType)
                           | MHD_USE_ERROR_LOG,
                           *pport, NULL, NULL,
-                          &ahc_echo, "GET",
+                          &ahc_echo, NULL,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                           MHD_OPTION_END);
   else
     d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | ((int) pollType)
                           | MHD_USE_ERROR_LOG,
                           *pport, NULL, NULL,
-                          &ahc_echo, "GET",
+                          &ahc_echo, NULL,
                           MHD_OPTION_THREAD_POOL_SIZE,
                           testNumThreadsForPool (pollType),
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c
index bcb610dc..4e59c56f 100644
--- a/src/testcurl/test_get_iovec.c
+++ b/src/testcurl/test_get_iovec.c
@@ -92,15 +92,20 @@ iov_free_callback (void *cls)
 }
 
 
+struct iovncont_data
+{
+  void *ptrs[TESTSTR_IOVCNT];
+};
+
 static void
 iovncont_free_callback (void *cls)
 {
-  struct MHD_IoVec *iov = cls;
+  struct iovncont_data *data = (struct iovncont_data *) cls;
   unsigned int i;
 
   for (i = 0; i < TESTSTR_IOVCNT; ++i)
-    free ((void *) iov[i].iov_base);
-  free (iov);
+    free (data->ptrs[i]);
+  free (data);
 }
 
 
@@ -126,7 +131,7 @@ check_read_data (const void *ptr, size_t len)
 
 
 static enum MHD_Result
-ahc_echo (void *cls,
+ahc_cont (void *cls,
           struct MHD_Connection *connection,
           const char *url,
           const char *method,
@@ -135,16 +140,16 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
   int *data;
   struct MHD_IoVec iov[TESTSTR_IOVCNT];
   int i;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -182,25 +187,25 @@ ahc_echo (void *cls,
 
 
 static enum MHD_Result
-ncont_echo (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 **req_cls)
+ahc_ncont (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 **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
-  int *data;
-  struct MHD_IoVec *iov;
+  struct MHD_IoVec iov[TESTSTR_IOVCNT];
+  struct iovncont_data *clear_cls;
   int i, j;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -209,30 +214,33 @@ ncont_echo (void *cls,
   }
   *req_cls = NULL;
 
-  if (NULL == (iov = malloc (sizeof(struct MHD_IoVec) * TESTSTR_IOVCNT)))
-    return MHD_NO;
-
+  clear_cls = malloc (sizeof(struct iovncont_data));
+  if (NULL == clear_cls)
+    abort ();
   memset (iov, 0, sizeof(struct MHD_IoVec) * TESTSTR_IOVCNT);
 
   /* Create some test data. */
   for (j = TESTSTR_IOVCNT - 1; j >= 0; --j)
   {
-    if (NULL == (data = malloc (TESTSTR_IOVLEN)))
-      goto err_out;
-
-    iov[j].iov_base = data;
-    iov[j].iov_len = TESTSTR_IOVLEN;
+    int *data;
+    data = malloc (TESTSTR_IOVLEN);
+    if (NULL == data)
+      abort ();
+    clear_cls->ptrs[j] = (void *) data;
 
     for (i = 0; i < (int) (TESTSTR_IOVLEN / sizeof(int)); ++i)
     {
       data[i] = i + (j * TESTSTR_IOVLEN / sizeof(int));
     }
+    iov[j].iov_base = (const void *) data;
+    iov[j].iov_len = TESTSTR_IOVLEN;
+
   }
 
   response = MHD_create_response_from_iovec (iov,
                                              TESTSTR_IOVCNT,
                                              &iovncont_free_callback,
-                                             iov);
+                                             clear_cls);
   ret = MHD_queue_response (connection,
                             MHD_HTTP_OK,
                             response);
@@ -240,15 +248,6 @@ ncont_echo (void *cls,
   if (ret == MHD_NO)
     abort ();
   return ret;
-
-err_out:
-  for (j = 0; j < TESTSTR_IOVCNT; ++j)
-  {
-    if (NULL != iov[j].iov_base)
-      free ((void *) iov[j].iov_base);
-  }
-  free (iov);
-  return MHD_NO;
 }
 
 
@@ -277,12 +276,12 @@ testInternalGet (bool contiguous)
   if (contiguous)
   {
     d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                          port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                          port, NULL, NULL, &ahc_cont, NULL, MHD_OPTION_END);
   }
   else
   {
     d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                          port, NULL, NULL, &ncont_echo, "GET", 
MHD_OPTION_END);
+                          port, NULL, NULL, &ahc_ncont, NULL, MHD_OPTION_END);
   }
 
   if (d == NULL)
@@ -356,7 +355,7 @@ testMultithreadedGet ()
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | MHD_USE_AUTO,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_cont, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 16;
   if (0 == port)
@@ -427,7 +426,7 @@ testMultithreadedPoolGet ()
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | MHD_USE_AUTO,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        port, NULL, NULL, &ahc_cont, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -514,7 +513,7 @@ testExternalGet ()
   cbc.size = sizeof(readbuf);
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_cont, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
@@ -682,7 +681,7 @@ testUnknownPortGet ()
   cbc.size = sizeof(readbuf);
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        0, NULL, NULL, &ahc_echo, "GET",
+                        0, NULL, NULL, &ahc_cont, NULL,
                         MHD_OPTION_SOCK_ADDR, &addr,
                         MHD_OPTION_END);
   if (d == NULL)
diff --git a/src/testcurl/test_get_response_cleanup.c 
b/src/testcurl/test_get_response_cleanup.c
index ededc88b..fcda2349 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -125,14 +125,13 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  // fprintf (stderr, "In CB: %s!\n", method);
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -172,7 +171,7 @@ testInternalGet ()
 
   ok = 1;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
   if (0 == port)
@@ -221,7 +220,7 @@ 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",
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 2,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -283,7 +282,7 @@ testMultithreadedPoolGet ()
 
   ok = 1;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -339,7 +338,7 @@ testExternalGet ()
 
   ok = 1;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index 4ca57e23..2a28481f 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -87,14 +87,14 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
   int fd;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -142,7 +142,7 @@ testInternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
   if (0 == port)
@@ -214,7 +214,7 @@ testMultithreadedGet ()
   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, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 16;
   if (0 == port)
@@ -285,7 +285,7 @@ testMultithreadedPoolGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -373,7 +373,7 @@ testExternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
@@ -548,7 +548,7 @@ testUnknownPortGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        0, NULL, NULL, &ahc_echo, "GET",
+                        0, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_SOCK_ADDR, &addr,
                         MHD_OPTION_END);
   if (d == NULL)
diff --git a/src/testcurl/test_get_wait.c b/src/testcurl/test_get_wait.c
index 708c82bd..b2938fdf 100644
--- a/src/testcurl/test_get_wait.c
+++ b/src/testcurl/test_get_wait.c
@@ -89,12 +89,12 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   enum MHD_Result ret;
+  (void) cls;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -176,7 +176,7 @@ testRunWaitGet (int port, int poll_flag)
           test_desc);
   signal_done = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     abort ();
   if (0 == port)
@@ -224,9 +224,8 @@ main (int argc, char *const *argv)
     port += 5;
   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);
+  response = MHD_create_response_from_buffer_static (strlen ("/hello_world"),
+                                                     "/hello_world");
   testRunWaitGet (port++, 0);
   if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_EPOLL))
     testRunWaitGet (port++, MHD_USE_EPOLL);
diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c
index 509e3955..daeac0cf 100644
--- a/src/testcurl/test_iplimit.c
+++ b/src/testcurl/test_iplimit.c
@@ -85,12 +85,12 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
+  (void) cls;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -98,9 +98,8 @@ ahc_echo (void *cls,
     return MHD_YES;
   }
   *req_cls = NULL;
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
   if (ret == MHD_NO)
@@ -134,7 +133,7 @@ testMultithreadedGet ()
 
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
                         port, NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 2,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -245,7 +244,7 @@ testMultithreadedPoolGet ()
     return 0;
 
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 2,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index 161e0f0b..4b7fae46 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -286,9 +286,9 @@ ahc_echo (void *cls,
       *done = 1;   /* Whole request is processed. */
     return MHD_YES;
   }
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response =
+    MHD_create_response_from_buffer_copy (strlen (url),
+                                          (const void *) url);
   if (NULL == response)
     mhdErrorExitDesc ("Failed to create response");
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index feaefed5..c1d07cb3 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -80,17 +80,16 @@ ahc_echo (void *cls,
           const char *upload_data, size_t *upload_data_size,
           void **req_cls)
 {
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
+  (void) cls;
   (void) version; (void) upload_data;      /* Unused. Silent compiler warning. 
*/
   (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. 
*/
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
   return ret;
@@ -124,8 +123,7 @@ testLongUrlGet (size_t buff_size)
                       port,
                       &apc_all,
                       NULL,
-                      &ahc_echo,
-                      "GET",
+                      &ahc_echo, NULL,
                       MHD_OPTION_CONNECTION_MEMORY_LIMIT,
                       (size_t) buff_size, MHD_OPTION_END);
   if (d == NULL)
@@ -218,8 +216,7 @@ testLongHeaderGet (size_t buff_size)
                       port,
                       &apc_all,
                       NULL,
-                      &ahc_echo,
-                      "GET",
+                      &ahc_echo, NULL,
                       MHD_OPTION_CONNECTION_MEMORY_LIMIT,
                       (size_t) buff_size, MHD_OPTION_END);
   if (d == NULL)
diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c
index 100242a5..26d9fec3 100644
--- a/src/testcurl/test_patch.c
+++ b/src/testcurl/test_patch.c
@@ -115,8 +115,8 @@ ahc_echo (void *cls,
     *done = 1;
     return MHD_YES;
   }
-  response = MHD_create_response_from_buffer (strlen (url), (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
   return ret;
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index e36391fd..d97839c0 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -137,9 +137,9 @@ ahc_echo (void *cls,
   enum MHD_Result ret;
   (void) cls; (void) version;      /* Unused. Silent compiler warning. */
 
-  if (0 != strcmp ("POST", method))
+  if (0 != strcmp (MHD_HTTP_METHOD_POST, method))
   {
-    printf ("METHOD: %s\n", method);
+    fprintf (stderr, "METHOD: %s\n", method);
     return MHD_NO;              /* unexpected method */
   }
   pp = *req_cls;
@@ -152,9 +152,8 @@ ahc_echo (void *cls,
   MHD_post_process (pp, upload_data, *upload_data_size);
   if ((eok == 3) && (0 == *upload_data_size))
   {
-    response = MHD_create_response_from_buffer (strlen (url),
-                                                (void *) url,
-                                                MHD_RESPMEM_MUST_COPY);
+    response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                     (const void *) url);
     ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
     MHD_destroy_response (response);
     MHD_destroy_post_processor (pp);
@@ -608,7 +607,8 @@ ahc_cancel (void *cls,
 
   if (*req_cls == NULL)
   {
-    *req_cls = "wibble";
+    static int marker = 1;
+    *req_cls = &marker;
     /* We don't want the body. Send a 500. */
     response = MHD_create_response_empty (MHD_RF_NONE);
     ret = MHD_queue_response (connection, 500, response);
@@ -768,8 +768,8 @@ testMultithreadedPostCancelPart (int flags)
 #endif /* ! _WIN32 */
     {
       fprintf (stderr,
-               "flibbet curl_easy_perform didn't fail as expected: `%s' %d\n",
-               curl_easy_strerror (errornum), errornum);
+               "flibbet curl_easy_perform didn't fail as expected: `%s' %u\n",
+               curl_easy_strerror (errornum), (unsigned int) errornum);
       result = 65536;
     }
     curl_easy_cleanup (c);
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index dbfd170d..b4a22eb1 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -522,8 +522,12 @@ testExternalPost ()
         timeout64 = (uint64_t) ctimeout;
       if (0 == running)
         timeout64 = 0; /* terminate quickly... */
-      tv.tv_sec = timeout64 / 1000;
-      tv.tv_usec = (timeout64 % 1000) * 1000;
+#if ! defined(_WIN32) || defined(__CYGWIN__)
+      tv.tv_sec = (time_t) (timeout64 / 1000);
+#else  /* Native W32 */
+      tv.tv_sec = (long) (timeout64 / 1000);
+#endif /* Native W32 */
+      tv.tv_usec = (long) (1000 * (timeout64 % 1000));
       if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv))
       {
 #ifdef MHD_POSIX_SOCKETS
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index 1ada80e2..b429777b 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -160,9 +160,8 @@ ahc_echo (void *cls,
     abort ();
   if ((eok == 3) && (0 == *upload_data_size))
   {
-    response = MHD_create_response_from_buffer (strlen (url),
-                                                (void *) url,
-                                                MHD_RESPMEM_MUST_COPY);
+    response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                     (const void *) url);
     ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
     MHD_destroy_response (response);
     MHD_destroy_post_processor (pp);
diff --git a/src/testcurl/test_process_arguments.c 
b/src/testcurl/test_process_arguments.c
index 24d5e72f..d3176423 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -72,13 +72,13 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
   const char *hdr;
+  (void) cls;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -101,9 +101,8 @@ ahc_echo (void *cls,
                                       MHD_GET_ARGUMENT_KIND,
                                       NULL, NULL))
     abort ();
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
   if (ret == MHD_NO)
@@ -150,7 +149,7 @@ testExternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_process_headers.c 
b/src/testcurl/test_process_headers.c
index 98b08fbc..0c9d6133 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -92,13 +92,13 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
   const char *hdr;
+  (void) cls;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -128,9 +128,8 @@ ahc_echo (void *cls,
   if ((hdr == NULL) || (0 != strcmp (hdr, "NowPresent")))
     abort ();
 
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   if (NULL == response)
     abort ();
   MHD_add_response_header (response, "MyHeader", "MyValue");
@@ -176,7 +175,7 @@ testInternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
   if (0 == port)
@@ -248,7 +247,7 @@ testMultithreadedGet ()
   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, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 16;
   if (0 == port)
@@ -319,7 +318,7 @@ testMultithreadedPoolGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
                         MHD_OPTION_END);
   if (d == NULL)
@@ -407,7 +406,7 @@ testExternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index 761e1c5f..d2da48ac 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -115,8 +115,8 @@ ahc_echo (void *cls,
     *done = 1;
     return MHD_YES;
   }
-  response = MHD_create_response_from_buffer (strlen (url), (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   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 5820f2e0..d877a2ae 100644
--- a/src/testcurl/test_put_chunked.c
+++ b/src/testcurl/test_put_chunked.c
@@ -125,9 +125,8 @@ ahc_echo (void *cls,
 #endif
     return MHD_YES;
   }
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   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 f7703db7..7425f839 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -251,11 +251,11 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
+  (void) cls;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
   {
     fprintf (stderr, "Unexpected HTTP method '%s'. ", method);
     externalErrorExit ();
@@ -266,9 +266,8 @@ ahc_echo (void *cls,
     return MHD_YES;
   }
   *req_cls = NULL;
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   if (NULL == response)
     mhdErrorExitDesc ("MHD_create_response failed");
   /* Make sure that connection will not be reused */
@@ -317,7 +316,7 @@ ServeOneRequest (void *param)
   fd = *((MHD_socket *) param);
 
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        0, NULL, NULL, &ahc_echo, "GET",
+                        0, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_LISTEN_SOCKET, fd,
                         MHD_OPTION_NOTIFY_COMPLETED, &request_completed, &done,
                         MHD_OPTION_END);
@@ -404,7 +403,7 @@ testGet (int type, int pool_count, int poll_flag)
   struct CBC cbc;
   MHD_socket fd;
   pthread_t thrd;
-  const char *thrdRet;
+  char *thrdRet;
 
   if (verbose)
     printf ("testGet(%d, %d, %d) test started.\n",
@@ -416,7 +415,7 @@ testGet (int type, int pool_count, int poll_flag)
   if (pool_count > 0)
   {
     d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag,
-                          global_port, NULL, NULL, &ahc_echo, "GET",
+                          global_port, NULL, NULL, &ahc_echo, NULL,
                           MHD_OPTION_THREAD_POOL_SIZE,
                           (unsigned int) pool_count,
                           MHD_OPTION_END);
@@ -425,7 +424,7 @@ testGet (int type, int pool_count, int poll_flag)
   else
   {
     d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag,
-                          global_port, NULL, NULL, &ahc_echo, "GET",
+                          global_port, NULL, NULL, &ahc_echo, NULL,
                           MHD_OPTION_END);
   }
   if (d == NULL)
@@ -555,7 +554,7 @@ testExternalGet (void)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         global_port,
                         NULL, NULL,
-                        &ahc_echo, "GET",
+                        &ahc_echo, NULL,
                         MHD_OPTION_END);
   if (d == NULL)
     mhdErrorExitDesc ("Failed to start MHD daemon");
diff --git a/src/testcurl/test_quiesce_stream.c 
b/src/testcurl/test_quiesce_stream.c
index dbfd982b..12b35903 100644
--- a/src/testcurl/test_quiesce_stream.c
+++ b/src/testcurl/test_quiesce_stream.c
@@ -113,7 +113,7 @@ http_ContentReaderCallback (void *cls,
   if (userdata->bytes_written >= 1024)
   {
     fprintf (stderr,
-             "finish: %d\n",
+             "finish: %u\n",
              request_counter);
     return MHD_CONTENT_READER_END_OF_STREAM;
   }
@@ -155,7 +155,7 @@ http_AccessHandlerCallback (void *cls,
   {
     struct ContentReaderUserdata *userdata;
     fprintf (stderr,
-             "start: %d\n",
+             "start: %u\n",
              ++request_counter);
 
     userdata = malloc (sizeof(struct ContentReaderUserdata));
diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c
index 5c184a20..1b41bcb2 100644
--- a/src/testcurl/test_timeout.c
+++ b/src/testcurl/test_timeout.c
@@ -197,7 +197,7 @@ ahc_echo (void *cls,
   enum MHD_Result ret;
   (void) version; (void) req_cls;   /* Unused. Silent compiler warning. */
 
-  if (0 != strcmp ("PUT", method))
+  if (0 != strcmp (MHD_HTTP_METHOD_PUT, method))
     return MHD_NO;              /* unexpected method */
   if ((*done) == 0)
   {
@@ -215,9 +215,8 @@ ahc_echo (void *cls,
     *done = 1;
     return MHD_YES;
   }
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
   return ret;
diff --git a/src/testcurl/test_toolarge.c b/src/testcurl/test_toolarge.c
index 42ea471f..30f0d922 100644
--- a/src/testcurl/test_toolarge.c
+++ b/src/testcurl/test_toolarge.c
@@ -261,7 +261,7 @@ struct headers_check_result
   int large_header_valid;
 };
 
-size_t
+static size_t
 lcurl_hdr_callback (char *buffer, size_t size, size_t nitems,
                     void *userdata)
 {
@@ -372,7 +372,7 @@ struct mhd_header_checker_param
   int large_header_valid;
 };
 
-enum MHD_Result
+static enum MHD_Result
 headerCheckerInterator (void *cls,
                         enum MHD_ValueKind kind,
                         const char *key,
@@ -489,9 +489,9 @@ ahcCheck (void *cls,
                                        &param->header_check_param))
     mhdErrorExitDesc ("Wrong number of headers in the request");
 
-  response = MHD_create_response_from_buffer (param->rp_data_size,
-                                              (void *) param->rp_data,
-                                              MHD_RESPMEM_MUST_COPY);
+  response =
+    MHD_create_response_from_buffer_copy (param->rp_data_size,
+                                          (const void *) param->rp_data);
   if (NULL == response)
     mhdErrorExitDesc ("Failed to create response");
 
diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c
index 5bc28323..b3042f61 100644
--- a/src/testcurl/test_tricky.c
+++ b/src/testcurl/test_tricky.c
@@ -246,7 +246,7 @@ struct headers_check_result
 };
 
 
-size_t
+static size_t
 lcurl_hdr_callback (char *buffer, size_t size, size_t nitems,
                     void *userdata)
 {
@@ -314,7 +314,7 @@ struct mhd_header_checker_param
   int found_header4;
 };
 
-enum MHD_Result
+static enum MHD_Result
 headerCheckerInterator (void *cls,
                         enum MHD_ValueKind kind,
                         const char *key,
@@ -425,9 +425,9 @@ ahcCheck (void *cls,
                                        &param->header_check_param))
     mhdErrorExitDesc ("Wrong number of headers in the request");
 
-  response = MHD_create_response_from_buffer (param->rp_data_size,
-                                              (void *) param->rp_data,
-                                              MHD_RESPMEM_MUST_COPY);
+  response =
+    MHD_create_response_from_buffer_copy (param->rp_data_size,
+                                          (const void *) param->rp_data);
   if (NULL == response)
     mhdErrorExitDesc ("Failed to create response");
 
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index 0145b5f1..71ac668b 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -101,12 +101,12 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   static int ptr;
-  const char *me = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
+  (void) cls;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
-  if (0 != strcmp (me, method))
+  if (0 != strcmp (MHD_HTTP_METHOD_GET, method))
     return MHD_NO;              /* unexpected method */
   if (&ptr != *req_cls)
   {
@@ -118,9 +118,8 @@ ahc_echo (void *cls,
                              &test_values,
                              NULL);
   *req_cls = NULL;
-  response = MHD_create_response_from_buffer (strlen (url),
-                                              (void *) url,
-                                              MHD_RESPMEM_MUST_COPY);
+  response = MHD_create_response_from_buffer_copy (strlen (url),
+                                                   (const void *) url);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
   if (ret == MHD_NO)
@@ -153,7 +152,7 @@ testInternalGet (int poll_flag)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
                         | poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
   if (0 == port)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]