libmicrohttpd

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

commit 1d7f9db03714a7694ad0ab6aa386f196ef539ac6
parent 3a015cd331f0a88425670fb2c6361875df10229d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 23 Sep 2013 11:44:23 +0000

-need to initialize gcrypt for libcurl

Diffstat:
Msrc/testcurl/Makefile.am | 4++--
Msrc/testcurl/test_digestauth.c | 11++++++++++-
Msrc/testcurl/test_digestauth_with_arguments.c | 10+++++++++-
3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am @@ -127,13 +127,13 @@ test_digestauth_SOURCES = \ test_digestauth.c test_digestauth_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - @LIBCURL@ + @LIBCURL@ @LIBGCRYPT_LIBS@ test_digestauth_with_arguments_SOURCES = \ test_digestauth_with_arguments.c test_digestauth_with_arguments_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - @LIBCURL@ + @LIBCURL@ @LIBGCRYPT_LIBS@ test_get_sendfile_SOURCES = \ test_get_sendfile.c diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c @@ -31,6 +31,7 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#include <gcrypt.h> #ifndef WINDOWS #include <sys/socket.h> @@ -221,12 +222,20 @@ testDigestAuth () return 0; } +GCRY_THREAD_OPTION_PTHREAD_IMPL; + + int main (int argc, char *const *argv) { unsigned int errorCount = 0; - if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + 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 +if (0 != curl_global_init (CURL_GLOBAL_WIN32)) return 2; errorCount += testDigestAuth (); if (errorCount != 0) diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c @@ -23,7 +23,6 @@ * @brief Testcase for libmicrohttpd Digest Auth with arguments * @author Amr Ali */ - #include "MHD_config.h" #include "platform.h" #include <curl/curl.h> @@ -31,6 +30,7 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#include <gcrypt.h> #ifndef WINDOWS #include <sys/socket.h> @@ -221,11 +221,19 @@ testDigestAuth () return 0; } + +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); if (0 != curl_global_init (CURL_GLOBAL_WIN32)) return 2; errorCount += testDigestAuth ();