gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (92bf38a9 -> 23324164


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (92bf38a9 -> 23324164)
Date: Wed, 15 Nov 2017 14:17:13 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 92bf38a9 configure: improved GnuTLS detection, fixed https tests build
     new 1ce13602 Fixed race condition on W32
     new ff492e37 testcurl/https/Makefile.am: moved headers to proper location
     new fd7d7128 Fixed compiler warning
     new 23324164 https tests: supported multi-TLS selection on libcurl >= 
7.56.0, fixed error report for failed initialisation of libcurl

The 4 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/daemon.c                            |  2 ++
 src/microhttpd/mhd_threads.c                       |  2 +-
 src/microhttpd/mhd_threads.h                       | 14 +++++++++++++
 src/testcurl/https/Makefile.am                     | 24 +++++++++++++++++++++-
 src/testcurl/https/test_empty_response.c           |  7 ++-----
 src/testcurl/https/test_https_get.c                |  8 +++-----
 src/testcurl/https/test_https_get_parallel.c       |  7 ++-----
 .../https/test_https_get_parallel_threads.c        |  7 ++-----
 src/testcurl/https/test_https_get_select.c         |  7 ++-----
 src/testcurl/https/test_https_multi_daemon.c       |  8 ++------
 src/testcurl/https/test_https_session_info.c       |  7 ++-----
 src/testcurl/https/test_https_sni.c                |  7 ++-----
 src/testcurl/https/test_tls_authentication.c       |  7 ++-----
 src/testcurl/https/test_tls_extensions.c           |  7 ++-----
 src/testcurl/https/test_tls_options.c              |  7 ++-----
 src/testcurl/https/tls_test_common.c               | 19 +++++++++++++++++
 src/testcurl/https/tls_test_common.h               |  3 +++
 17 files changed, 85 insertions(+), 58 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 62f5b094..8ead8610 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1715,6 +1715,7 @@ thread_main_handle_connection (void *data)
   const bool use_poll = 0;
 #endif /* ! HAVE_POLL */
   bool was_suspended = false;
+  MHD_thread_init_(&(con->pid));
 
   while ( (! daemon->shutdown) &&
          (MHD_CONNECTION_CLOSED != con->state) )
@@ -4370,6 +4371,7 @@ static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_
 MHD_polling_thread (void *cls)
 {
   struct MHD_Daemon *daemon = cls;
+  MHD_thread_init_(&(daemon->pid));
 
   while (! daemon->shutdown)
     {
diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c
index 21d0ecc7..6578e4b1 100644
--- a/src/microhttpd/mhd_threads.c
+++ b/src/microhttpd/mhd_threads.c
@@ -224,7 +224,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
                                      start_routine,
                                      arg,
                                      0,
-                                     (unsigned*)&thread->ID);
+                                     NULL);
 
   if ((MHD_thread_handle_)-1 == thread->handle)
     return 0;
diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h
index d5424659..1a06c64a 100644
--- a/src/microhttpd/mhd_threads.h
+++ b/src/microhttpd/mhd_threads.h
@@ -139,6 +139,20 @@
 #define MHD_thread_ID_match_current_(ID) (GetCurrentThreadId() == (ID))
 #endif
 
+#if defined(MHD_USE_POSIX_THREADS)
+/**
+ * Initialise thread ID.
+ * @param thread_handle_ID_ptr pointer to thread handle-ID
+ */
+#define MHD_thread_init_(thread_handle_ID_ptr) (void)0
+#elif defined(MHD_USE_W32_THREADS)
+/**
+ * Initialise thread ID.
+ * @param thread_handle_ID_ptr pointer to thread handle-ID
+ */
+#define MHD_thread_init_(thread_handle_ID_ptr) 
((thread_handle_ID_ptr)->ID=GetCurrentThreadId())
+#endif
+
 /**
  * Signature of main function for a thread.
  *
diff --git a/src/testcurl/https/Makefile.am b/src/testcurl/https/Makefile.am
index 47deb708..875770b6 100644
--- a/src/testcurl/https/Makefile.am
+++ b/src/testcurl/https/Makefile.am
@@ -34,7 +34,7 @@ check_PROGRAMS = \
   test_https_time_out \
   test_empty_response
 
-EXTRA_DIST = cert.pem key.pem tls_test_keys.h tls_test_common.h \
+EXTRA_DIST = cert.pem key.pem \
   host1.crt host1.key host2.crt host2.key
 
 TESTS = \
@@ -52,6 +52,8 @@ TESTS = \
 
 test_https_time_out_SOURCES = \
   test_https_time_out.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_time_out_LDADD  = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
@@ -60,6 +62,8 @@ test_https_time_out_LDADD  = \
 
 test_tls_options_SOURCES = \
   test_tls_options.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_tls_options_LDADD = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
@@ -68,6 +72,8 @@ test_tls_options_LDADD = \
 
 test_https_get_parallel_SOURCES = \
   test_https_get_parallel.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_get_parallel_CPPFLAGS = \
   $(AM_CPPFLAGS) $(CPU_COUNT_DEF)
@@ -80,6 +86,8 @@ test_https_get_parallel_LDADD = \
 
 test_empty_response_SOURCES = \
   test_empty_response.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_empty_response_LDADD = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
@@ -88,6 +96,8 @@ test_empty_response_LDADD = \
 
 test_https_get_parallel_threads_SOURCES = \
   test_https_get_parallel_threads.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_get_parallel_threads_CPPFLAGS = \
   $(AM_CPPFLAGS) $(CPU_COUNT_DEF)
@@ -100,6 +110,8 @@ test_https_get_parallel_threads_LDADD = \
 
 test_tls_authentication_SOURCES = \
   test_tls_authentication.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_tls_authentication_LDADD  = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
@@ -108,6 +120,8 @@ test_tls_authentication_LDADD  = \
 
 test_https_session_info_SOURCES = \
   test_https_session_info.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_session_info_LDADD  = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
@@ -116,6 +130,8 @@ test_https_session_info_LDADD  = \
 
 test_https_multi_daemon_SOURCES = \
   test_https_multi_daemon.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_multi_daemon_LDADD  = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
@@ -124,6 +140,8 @@ test_https_multi_daemon_LDADD  = \
 
 test_https_get_SOURCES = \
   test_https_get.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_get_LDADD  = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
@@ -133,6 +151,8 @@ test_https_get_LDADD  = \
 if HAVE_GNUTLS_SNI
 test_https_sni_SOURCES = \
   test_https_sni.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_sni_CPPFLAGS = \
   $(AM_CPPFLAGS) \
@@ -145,6 +165,8 @@ endif
 
 test_https_get_select_SOURCES = \
   test_https_get_select.c \
+  tls_test_keys.h \
+  tls_test_common.h \
   tls_test_common.c
 test_https_get_select_LDADD  = \
   $(top_builddir)/src/testcurl/libcurl_version_check.a \
diff --git a/src/testcurl/https/test_empty_response.c 
b/src/testcurl/https/test_empty_response.c
index ba7136a8..27cb1e31 100644
--- a/src/testcurl/https/test_empty_response.c
+++ b/src/testcurl/https/test_empty_response.c
@@ -222,11 +222,8 @@ main (int argc, char *const *argv)
   unsigned int errorCount = 0;
   (void)argc;   /* Unused. Silent compiler warning. */
 
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
   if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
     {
       fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
diff --git a/src/testcurl/https/test_https_get.c 
b/src/testcurl/https/test_https_get.c
index 51536385..8ed0028a 100644
--- a/src/testcurl/https/test_https_get.c
+++ b/src/testcurl/https/test_https_get.c
@@ -139,11 +139,8 @@ main (int argc, char *const *argv)
   gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
 #endif
 #endif /* MHD_HTTPS_REQUIRE_GRYPT */
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
   if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
     {
       fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
@@ -165,6 +162,7 @@ main (int argc, char *const *argv)
     test_cipher_option (NULL, des_cbc3_sha_tlsv1, CURL_SSLVERSION_TLSv1);
 #else  /* GNUTLS_VERSION_NUMBER >= 0x030600 */
   (void)des_cbc3_sha_tlsv1;
+  (void)test_cipher_option;
 #endif /* GNUTLS_VERSION_NUMBER >= 0x030600 */
   print_test_result (errorCount, argv[0]);
 
diff --git a/src/testcurl/https/test_https_get_parallel.c 
b/src/testcurl/https/test_https_get_parallel.c
index 91d870d8..27c23173 100644
--- a/src/testcurl/https/test_https_get_parallel.c
+++ b/src/testcurl/https/test_https_get_parallel.c
@@ -150,11 +150,8 @@ main (int argc, char *const *argv)
   /* initialize random seed used by curl clients */
   unsigned int iseed = (unsigned int) time (NULL);
   srand (iseed);
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
 
   if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
     {
diff --git a/src/testcurl/https/test_https_get_parallel_threads.c 
b/src/testcurl/https/test_https_get_parallel_threads.c
index 832b206f..c9fc8ffc 100644
--- a/src/testcurl/https/test_https_get_parallel_threads.c
+++ b/src/testcurl/https/test_https_get_parallel_threads.c
@@ -157,11 +157,8 @@ main (int argc, char *const *argv)
 #endif
 #endif /* MHD_HTTPS_REQUIRE_GRYPT */
   srand (iseed);
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
   ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
   if (NULL == ssl_version)
     {
diff --git a/src/testcurl/https/test_https_get_select.c 
b/src/testcurl/https/test_https_get_select.c
index 5e1fa238..64be861a 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -250,11 +250,8 @@ main (int argc, char *const *argv)
   unsigned int errorCount = 0;
   (void)argc;   /* Unused. Silent compiler warning. */
 
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
   if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
     {
       fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
diff --git a/src/testcurl/https/test_https_multi_daemon.c 
b/src/testcurl/https/test_https_multi_daemon.c
index 75017662..130fa9df 100644
--- a/src/testcurl/https/test_https_multi_daemon.c
+++ b/src/testcurl/https/test_https_multi_daemon.c
@@ -136,12 +136,8 @@ main (int argc, char *const *argv)
   gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
 #endif
 #endif /* MHD_HTTPS_REQUIRE_GRYPT */
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error (code: %u). l:%d f:%s\n", errorCount, __LINE__,
-               __FUNCTION__);
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
   if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
     {
       fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
diff --git a/src/testcurl/https/test_https_session_info.c 
b/src/testcurl/https/test_https_session_info.c
index 1aa50955..a58c7f7b 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -199,11 +199,8 @@ main (int argc, char *const *argv)
   gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
 #endif
 #endif /* MHD_HTTPS_REQUIRE_GRYPT */
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error (code: %u)\n", errorCount);
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
 
   ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
   if (NULL == ssl_version)
diff --git a/src/testcurl/https/test_https_sni.c 
b/src/testcurl/https/test_https_sni.c
index 1567730c..6963d62c 100644
--- a/src/testcurl/https/test_https_sni.c
+++ b/src/testcurl/https/test_https_sni.c
@@ -269,11 +269,8 @@ main (int argc, char *const *argv)
   gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
 #endif
 #endif /* MHD_HTTPS_REQUIRE_GRYPT */
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
   if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
     {
       fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
diff --git a/src/testcurl/https/test_tls_authentication.c 
b/src/testcurl/https/test_tls_authentication.c
index 734a2a4a..7a6cd9a4 100644
--- a/src/testcurl/https/test_tls_authentication.c
+++ b/src/testcurl/https/test_tls_authentication.c
@@ -94,11 +94,8 @@ main (int argc, char *const *argv)
   gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
 #endif
 #endif /* MHD_HTTPS_REQUIRE_GRYPT */
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error (code: %u)\n", errorCount);
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
   if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
     {
       fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
diff --git a/src/testcurl/https/test_tls_extensions.c 
b/src/testcurl/https/test_tls_extensions.c
index 98725ee3..08cde939 100644
--- a/src/testcurl/https/test_tls_extensions.c
+++ b/src/testcurl/https/test_tls_extensions.c
@@ -238,11 +238,8 @@ main (int argc, char *const *argv)
       return -1;
     }
 
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return -1;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
 
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | 
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS |
                         MHD_USE_ERROR_LOG, port,
diff --git a/src/testcurl/https/test_tls_options.c 
b/src/testcurl/https/test_tls_options.c
index 6d393bf2..e3b427d9 100644
--- a/src/testcurl/https/test_tls_options.c
+++ b/src/testcurl/https/test_tls_options.c
@@ -121,11 +121,8 @@ main (int argc, char *const *argv)
     return 77;
   }
 
-  if (0 != curl_global_init (CURL_GLOBAL_ALL))
-    {
-      fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 99;
-    }
+  if (!testsuite_curl_global_init ())
+    return 99;
 
   const char *aes128_sha = "AES128-SHA";
   const char *aes256_sha = "AES256-SHA";
diff --git a/src/testcurl/https/tls_test_common.c 
b/src/testcurl/https/tls_test_common.c
index be13ad36..24782615 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -525,3 +525,22 @@ test_wrap (const char *test_name, int
   va_end (arg_list);
   return ret;
 }
+
+int testsuite_curl_global_init (void)
+{
+  CURLcode res;
+#if LIBCURL_VERSION_NUM >= 0x07380
+  if (CURLSSLSET_OK != curl_global_sslset(CURLSSLBACKEND_GNUTLS, NULL, NULL))
+    {
+      if (CURLSSLSET_TOO_LATE == curl_global_sslset(CURLSSLBACKEND_OPENSSL, 
NULL, NULL))
+        fprintf (stderr, "WARNING: libcurl was already initialised.\n");
+    }
+#endif /* LIBCURL_VERSION_NUM >= 0x07380 */
+  res = curl_global_init (CURL_GLOBAL_ALL);
+  if (CURLE_OK != res)
+    {
+      fprintf (stderr, "libcurl initialisation error: %s\n", 
curl_easy_strerror(res));
+      return 0;
+    }
+  return 1;
+}
diff --git a/src/testcurl/https/tls_test_common.h 
b/src/testcurl/https/tls_test_common.h
index 07849e44..490239ef 100644
--- a/src/testcurl/https/tls_test_common.h
+++ b/src/testcurl/https/tls_test_common.h
@@ -149,4 +149,7 @@ test_wrap (const char *test_name, int
                              int proto_version), void * cls,
            int port,
            int daemon_flags, const char *cipher_suite, int proto_version, ...);
+
+int testsuite_curl_global_init (void);
+
 #endif /* TLS_TEST_COMMON_H_ */

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



reply via email to

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