From: Michael Wallner Date: Thu, 8 Sep 2005 18:07:10 +0000 (+0000) Subject: - implement ssl crypto locks X-Git-Tag: RELEASE_0_13_0~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=10025ba0ed0c9c8a509441ad1b9d6db633af8596;p=m6w6%2Fext-http - implement ssl crypto locks --- diff --git a/config.m4 b/config.m4 index 5201be6..62dcb4f 100644 --- a/config.m4 +++ b/config.m4 @@ -61,6 +61,12 @@ dnl ---- AC_MSG_RESULT([found: $CURL_CONFIG]) fi + CURL_SSL=`$CURL_CONFIG --features | $EGREP SSL` + if test CURL_SSL == "SSL"; then + AC_DEFINE([HTTP_HAVE_SSL], [1], [ ]) + fi + AC_CHECK_HEADERS([openssl/crypto.h]) + CURL_LIBS=`$CURL_CONFIG --libs` PHP_ADD_INCLUDE($CURL_DIR/include) diff --git a/config.w32 b/config.w32 index 134429c..1182438 100644 --- a/config.w32 +++ b/config.w32 @@ -36,6 +36,7 @@ if (PHP_HTTP != "no") { CHECK_LIB("zlib.lib", "http", PHP_HTTP) && CHECK_LIB("winmm.lib", "http", PHP_HTTP)) { AC_DEFINE("HTTP_HAVE_CURL", 1, "Have CURL library"); + AC_DEFINE("HTTP_HAVE_SSL", 1, "Have SSL"); AC_DEFINE("HAVE_CURL_MULTI_STRERROR", 1, ""); AC_DEFINE("HAVE_CURL_EASY_STRERROR", 1, "") } else { diff --git a/http.c b/http.c index 02a789a..06c3224 100644 --- a/http.c +++ b/http.c @@ -52,6 +52,14 @@ #include "phpstr/phpstr.h" #ifdef HTTP_HAVE_CURL +# if defined(ZTS) && defined(HTTP_HAVE_SSL) +# if !defined(HAVE_OPENSSL_CRYPTO_H) +# error "libcurl was compiled with OpenSSL support, but we have no crypto.h" +# else +# define HTTP_NEED_SSL +# include +# endif +# endif # ifdef PHP_WIN32 # include # endif @@ -251,9 +259,7 @@ PHP_INI_END() /* }}} */ /* {{{ SSL */ -#if defined(ZTS) && defined(HTTP_HAVE_CURL) && defined(HAVE_OPENSSL_CRYPTO_H) - -#include +#ifdef HTTP_NEED_SSL static MUTEX_T *http_ssl_mutex = NULL; @@ -310,7 +316,7 @@ PHP_MINIT_FUNCTION(http) #ifdef HTTP_HAVE_CURL if (CURLE_OK == curl_global_init(CURL_GLOBAL_ALL)) { -# if defined(ZTS) && defined(HAVE_OPENSSL_CRYPTO_H) +# ifdef HTTP_NEED_SSL curl_version_info_data *cvid = curl_version_info(CURLVERSION_NOW); if (cvid && (cvid->features & CURL_VERSION_SSL)) { http_ssl_init(); @@ -344,7 +350,7 @@ PHP_MSHUTDOWN_FUNCTION(http) UNREGISTER_INI_ENTRIES(); #ifdef HTTP_HAVE_CURL curl_global_cleanup(); -# if defined(ZTS) && defined(HAVE_OPENSSL_CRYPTO_H) +# ifdef HTTP_NEED_SSL if (http_ssl_mutex) { http_ssl_cleanup(); }