[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 04/04: https tests: supported multi-TLS sel
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 04/04: https tests: supported multi-TLS selection on libcurl >= 7.56.0, fixed error report for failed initialisation of libcurl |
Date: |
Wed, 15 Nov 2017 14:17:17 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 23324164fb6fcc421a0bf081c50a00ce3f66f9b7
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Wed Nov 15 16:12:12 2017 +0300
https tests: supported multi-TLS selection on libcurl >= 7.56.0,
fixed error report for failed initialisation of libcurl
---
src/testcurl/https/test_empty_response.c | 7 ++-----
src/testcurl/https/test_https_get.c | 7 ++-----
src/testcurl/https/test_https_get_parallel.c | 7 ++-----
src/testcurl/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 +++
13 files changed, 44 insertions(+), 56 deletions(-)
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 e417129d..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");
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