libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit c8ddb867ee13ea0cbe2f43c63f3aa1062565630c
parent 902291420f08bee4813edcc2cf096072ddbf444c
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 23 Sep 2013 12:09:46 +0000

fully initialze modern gcrypt in MHD_init, only use thread initialization with legacy libgcrypt, update tests accordingly

Diffstat:
Msrc/microhttpd/daemon.c | 7++++++-
Msrc/testcurl/https/test_empty_response.c | 4----
Msrc/testcurl/https/test_https_get.c | 7-------
Msrc/testcurl/https/test_https_get_parallel.c | 2--
Msrc/testcurl/https/test_https_get_parallel_threads.c | 7-------
Msrc/testcurl/https/test_https_get_select.c | 4----
Msrc/testcurl/https/test_https_multi_daemon.c | 4----
Msrc/testcurl/https/test_https_session_info.c | 4----
Msrc/testcurl/https/test_https_time_out.c | 2--
Msrc/testcurl/https/test_tls_authentication.c | 4----
Msrc/testcurl/https/test_tls_extensions.c | 6++----
Msrc/testcurl/https/test_tls_options.c | 4+---
Msrc/testcurl/test_digestauth.c | 2--
Msrc/testcurl/test_digestauth_with_arguments.c | 4----
Msrc/testcurl/test_postform.c | 4----
15 files changed, 9 insertions(+), 56 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -3841,8 +3841,10 @@ MHD_get_version (void) #endif // __GNUC__ #if HTTPS_SUPPORT +#if GCRYPT_VERSION_NUMBER < 0x010600 GCRY_THREAD_OPTION_PTHREAD_IMPL; #endif +#endif /** @@ -3856,9 +3858,12 @@ MHD_init () #ifdef WINDOWS plibc_init ("GNU", "libmicrohttpd"); -#endif +#endif# #if HTTPS_SUPPORT +#if GCRYPT_VERSION_NUMBER < 0x010600 gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); +#endif + gcry_check_version (NULL); gnutls_global_init (); #endif } diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c @@ -183,16 +183,12 @@ testInternalSelectGet () return 0; } -GCRY_THREAD_OPTION_PTHREAD_IMPL; int main (int argc, char *const *argv) { unsigned int errorCount = 0; - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); - if (!gcry_check_version (GCRYPT_VERSION)) - abort (); if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c @@ -95,9 +95,6 @@ test_secure_get (FILE * test_fd, } -GCRY_THREAD_OPTION_PTHREAD_IMPL; - - int main (int argc, char *const *argv) { @@ -106,11 +103,7 @@ main (int argc, char *const *argv) const char *aes256_sha_sslv3 = "AES256-SHA"; const char *des_cbc3_sha_tlsv1 = "DES-CBC3-SHA"; - - if (!gcry_check_version (GCRYPT_VERSION)) - abort (); gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/https/test_https_get_parallel.c b/src/testcurl/https/test_https_get_parallel.c @@ -121,7 +121,6 @@ test_parallel_clients (void * cls, const char *cipher_suite, return 0; } -GCRY_THREAD_OPTION_PTHREAD_IMPL; int main (int argc, char *const *argv) @@ -132,7 +131,6 @@ main (int argc, char *const *argv) /* initialize random seed used by curl clients */ unsigned int iseed = (unsigned int) time (NULL); srand (iseed); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c @@ -123,10 +123,6 @@ test_parallel_clients (void *cls, const char *cipher_suite, } - -GCRY_THREAD_OPTION_PTHREAD_IMPL; - - int main (int argc, char *const *argv) { @@ -136,9 +132,6 @@ main (int argc, char *const *argv) /* initialize random seed used by curl clients */ unsigned int iseed = (unsigned int) time (NULL); - - gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c @@ -206,16 +206,12 @@ testExternalGet (int flags) return 0; } -GCRY_THREAD_OPTION_PTHREAD_IMPL; int main (int argc, char *const *argv) { unsigned int errorCount = 0; - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); - if (!gcry_check_version (GCRYPT_VERSION)) - abort (); if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); diff --git a/src/testcurl/https/test_https_multi_daemon.c b/src/testcurl/https/test_https_multi_daemon.c @@ -91,9 +91,6 @@ test_concurent_daemon_pair (void *cls, } -GCRY_THREAD_OPTION_PTHREAD_IMPL; - - int main (int argc, char *const *argv) { @@ -101,7 +98,6 @@ main (int argc, char *const *argv) FILE *cert; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c @@ -151,16 +151,12 @@ test_query_session () } -GCRY_THREAD_OPTION_PTHREAD_IMPL; - - int main (int argc, char *const *argv) { unsigned int errorCount = 0; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/https/test_https_time_out.c b/src/testcurl/https/test_https_time_out.c @@ -90,7 +90,6 @@ test_tls_session_time_out (gnutls_session_t session) return 0; } -GCRY_THREAD_OPTION_PTHREAD_IMPL; int main (int argc, char *const *argv) @@ -104,7 +103,6 @@ main (int argc, char *const *argv) gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/https/test_tls_authentication.c b/src/testcurl/https/test_tls_authentication.c @@ -69,16 +69,12 @@ test_secure_get (void * cls, char *cipher_suite, int proto_version) } -GCRY_THREAD_OPTION_PTHREAD_IMPL; - - int main (int argc, char *const *argv) { unsigned int errorCount = 0; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/https/test_tls_extensions.c b/src/testcurl/https/test_tls_extensions.c @@ -193,7 +193,6 @@ cleanup: return ret; } -GCRY_THREAD_OPTION_PTHREAD_IMPL int main (int argc, char *const *argv) @@ -206,13 +205,12 @@ main (int argc, char *const *argv) gnutls_datum_t cert; gnutls_certificate_credentials_t xcred; - int ext_arr[] = { GNUTLS_EXTENSION_SERVER_NAME, + const int ext_arr[] = { + GNUTLS_EXTENSION_SERVER_NAME, -1 }; - gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/https/test_tls_options.c b/src/testcurl/https/test_tls_options.c @@ -75,7 +75,6 @@ test_unmatching_ssl_version (void * cls, const char *cipher_suite, return 0; } -GCRY_THREAD_OPTION_PTHREAD_IMPL; /* setup a temporary transfer test file */ int @@ -83,12 +82,11 @@ main (int argc, char *const *argv) { unsigned int errorCount = 0; const char *ssl_version; - int daemon_flags = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | MHD_USE_DEBUG; + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c @@ -222,7 +222,6 @@ testDigestAuth () return 0; } -GCRY_THREAD_OPTION_PTHREAD_IMPL; int @@ -231,7 +230,6 @@ main (int argc, char *const *argv) unsigned int errorCount = 0; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c @@ -222,16 +222,12 @@ testDigestAuth () } -GCRY_THREAD_OPTION_PTHREAD_IMPL; - - int main (int argc, char *const *argv) { unsigned int errorCount = 0; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c @@ -463,16 +463,12 @@ testExternalPost () } -GCRY_THREAD_OPTION_PTHREAD_IMPL; - - int main (int argc, char *const *argv) { unsigned int errorCount = 0; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif