gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (d178fff3 -> d951b950


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (d178fff3 -> d951b950)
Date: Sun, 26 Nov 2017 21:01:05 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from d178fff3 Fixed typo in 4a126e24e7b780c3ad0196b72f813ce4a90215e3
     new 4d292e63 mhd_str.c: additional fix for size-optimized builds, silenced 
compiler warnings
     new d951b950 tests: check whether MHD use SO_REUSEADDR by default

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/mhd_str.c |   5 ++
 src/testcurl/test_get.c  | 134 ++++++++++++++++++++++++-----------------------
 2 files changed, 73 insertions(+), 66 deletions(-)

diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index cb86ae80..d0b03ead 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -50,6 +50,8 @@
  */
 
 #ifdef INLINE_FUNC
+
+#if 0 /* Disable unused functions. */
 /**
  * Check whether character is lower case letter in US-ASCII
  *
@@ -61,6 +63,7 @@ isasciilower (char c)
 {
   return (c >= 'a') && (c <= 'z');
 }
+#endif /* Disable unused functions. */
 
 
 /**
@@ -76,6 +79,7 @@ isasciiupper (char c)
 }
 
 
+#if 0 /* Disable unused functions. */
 /**
  * Check whether character is letter in US-ASCII
  *
@@ -87,6 +91,7 @@ isasciialpha (char c)
 {
   return isasciilower (c) || isasciiupper (c);
 }
+#endif /* Disable unused functions. */
 
 
 /**
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index b16c1554..4f4a0944 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -55,6 +55,7 @@
 #endif
 
 static int oneone;
+static int global_port;
 
 struct CBC
 {
@@ -117,35 +118,35 @@ testInternalGet (int poll_flag)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
 
-  if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-    port = 0;
-  else
+  if (0 == global_port)
     {
-      port = 1220;
-      if (oneone)
-        port += 20;
+      if (MHD_NO == MHD_is_feature_supported 
(MHD_FEATURE_AUTODETECT_BIND_PORT))
+       {
+         global_port = 1220;
+         if (oneone)
+           global_port += 20;
+       }
     }
 
   cbc.buf = buf;
   cbc.size = 2048;
   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);
+                        global_port, NULL, NULL, &ahc_echo, "GET", 
MHD_OPTION_END);
   if (d == NULL)
     return 1;
-  if (0 == port)
+  if (0 == global_port)
     {
       const union MHD_DaemonInfo *dinfo;
       dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
       if (NULL == dinfo || 0 == dinfo->port)
         { MHD_stop_daemon (d); return 32; }
-      port = (int)dinfo->port;
+      global_port = (int)dinfo->port;
     }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
-  curl_easy_setopt (c, CURLOPT_PORT, (long)port);
+  curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
@@ -186,35 +187,35 @@ testMultithreadedGet (int poll_flag)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
 
-  if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-    port = 0;
-  else
+  if (0 == global_port)
     {
-      port = 1221;
-      if (oneone)
-        port += 20;
+      if (MHD_NO == MHD_is_feature_supported 
(MHD_FEATURE_AUTODETECT_BIND_PORT))
+       {
+         global_port = 1221;
+         if (oneone)
+           global_port += 20;
+       }
     }
 
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 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);
+                        global_port, NULL, NULL, &ahc_echo, "GET", 
MHD_OPTION_END);
   if (d == NULL)
     return 16;
-  if (0 == port)
+  if (0 == global_port)
     {
       const union MHD_DaemonInfo *dinfo;
       dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
       if (NULL == dinfo || 0 == dinfo->port)
         { MHD_stop_daemon (d); return 32; }
-      port = (int)dinfo->port;
+      global_port = (int)dinfo->port;
     }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
-  curl_easy_setopt (c, CURLOPT_PORT, (long)port);
+  curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
@@ -255,36 +256,36 @@ testMultithreadedPoolGet (int poll_flag)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
 
-  if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-    port = 0;
-  else
+  if (0 == global_port)
     {
-      port = 1222;
-      if (oneone)
-        port += 20;
+      if (MHD_NO == MHD_is_feature_supported 
(MHD_FEATURE_AUTODETECT_BIND_PORT))
+       {
+         global_port = 1222;
+         if (oneone)
+           global_port += 20;
+       }
     }
 
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | 
poll_flag,
-                        port, NULL, NULL, &ahc_echo, "GET",
+                        global_port, NULL, NULL, &ahc_echo, "GET",
                         MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, 
MHD_OPTION_END);
   if (d == NULL)
     return 16;
-  if (0 == port)
+  if (0 == global_port)
     {
       const union MHD_DaemonInfo *dinfo;
       dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
       if (NULL == dinfo || 0 == dinfo->port)
         { MHD_stop_daemon (d); return 32; }
-      port = (int)dinfo->port;
+      global_port = (int)dinfo->port;
     }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
-  curl_easy_setopt (c, CURLOPT_PORT, (long)port);
+  curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
@@ -339,15 +340,15 @@ testExternalGet ()
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  int port;
 
-  if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-    port = 0;
-  else
+  if (0 == global_port)
     {
-      port = 1223;
-      if (oneone)
-        port += 20;
+      if (MHD_NO == MHD_is_feature_supported 
(MHD_FEATURE_AUTODETECT_BIND_PORT))
+       {
+         global_port = 1223;
+         if (oneone)
+           global_port += 20;
+       }
     }
 
   multi = NULL;
@@ -355,20 +356,20 @@ testExternalGet ()
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
+                        global_port, NULL, NULL, &ahc_echo, "GET", 
MHD_OPTION_END);
   if (d == NULL)
     return 256;
-  if (0 == port)
+  if (0 == global_port)
     {
       const union MHD_DaemonInfo *dinfo;
       dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
       if (NULL == dinfo || 0 == dinfo->port)
         { MHD_stop_daemon (d); return 32; }
-      port = (int)dinfo->port;
+      global_port = (int)dinfo->port;
     }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
-  curl_easy_setopt (c, CURLOPT_PORT, (long)port);
+  curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
@@ -565,28 +566,28 @@ testStopRace (int poll_flag)
     struct sockaddr_in sin;
     MHD_socket fd;
     struct MHD_Daemon *d;
-    int port;
 
-    if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-      port = 0;
-    else
+    if (0 == global_port)
       {
-        port = 1224;
-        if (oneone)
-          port += 20;
+       if (MHD_NO == MHD_is_feature_supported 
(MHD_FEATURE_AUTODETECT_BIND_PORT))
+         {
+           global_port = 1224;
+           if (oneone)
+             global_port += 20;
+         }
       }
 
     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);
+                         global_port, NULL, NULL, &ahc_echo, "GET", 
MHD_OPTION_END);
     if (d == NULL)
        return 16;
-    if (0 == port)
+    if (0 == global_port)
       {
         const union MHD_DaemonInfo *dinfo;
         dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
         if (NULL == dinfo || 0 == dinfo->port)
           { MHD_stop_daemon (d); return 32; }
-        port = (int)dinfo->port;
+        global_port = (int)dinfo->port;
       }
 
     fd = socket (PF_INET, SOCK_STREAM, 0);
@@ -598,7 +599,7 @@ testStopRace (int poll_flag)
 
     memset(&sin, 0, sizeof(sin));
     sin.sin_family = AF_INET;
-    sin.sin_port = htons(port);
+    sin.sin_port = htons(global_port);
     sin.sin_addr.s_addr = htonl(0x7f000001);
 
     if (connect (fd, (struct sockaddr *)(&sin), sizeof(sin)) < 0)
@@ -680,35 +681,35 @@ testEmptyGet (int poll_flag)
   struct CBC cbc;
   CURLcode errornum;
   int excess_found = 0;
-  int port;
 
-  if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-    port = 0;
-  else
+  if (0 == global_port)
     {
-      port = 1225;
-      if (oneone)
-        port += 20;
+      if (MHD_NO == MHD_is_feature_supported 
(MHD_FEATURE_AUTODETECT_BIND_PORT))
+       {
+         global_port = 1225;
+         if (oneone)
+           global_port += 20;
+       }
     }
 
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG  | 
poll_flag,
-                        port, NULL, NULL, &ahc_empty, NULL, MHD_OPTION_END);
+                        global_port, NULL, NULL, &ahc_empty, NULL, 
MHD_OPTION_END);
   if (d == NULL)
     return 4194304;
-  if (0 == port)
+  if (0 == global_port)
     {
       const union MHD_DaemonInfo *dinfo;
       dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
       if (NULL == dinfo || 0 == dinfo->port)
         { MHD_stop_daemon (d); return 32; }
-      port = (int)dinfo->port;
+      global_port = (int)dinfo->port;
     }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
-  curl_easy_setopt (c, CURLOPT_PORT, (long)port);
+  curl_easy_setopt (c, CURLOPT_PORT, (long)global_port);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
   curl_easy_setopt (c, CURLOPT_DEBUGFUNCTION, &curlExcessFound);
@@ -754,6 +755,7 @@ main (int argc, char *const *argv)
     (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0;
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
     return 2;
+  global_port = 0;
   errorCount += testInternalGet (0);
   errorCount += testMultithreadedGet (0);
   errorCount += testMultithreadedPoolGet (0);

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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