X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=src%2Fphp_http_curl.c;fp=src%2Fphp_http_curl.c;h=5c026a6de4b89195f91a1706018ef02421abc5de;hp=3a67443b820cf99d80c26ac0f521d1607590fb2a;hb=592c25cc9ea0b72843c2c2de84bd144e00a3231c;hpb=01751b935246b4483a50cbfca959de221e353085 diff --git a/src/php_http_curl.c b/src/php_http_curl.c index 3a67443..5c026a6 100644 --- a/src/php_http_curl.c +++ b/src/php_http_curl.c @@ -14,23 +14,24 @@ #if PHP_HTTP_HAVE_LIBCURL -#if defined(ZTS) && defined(PHP_HTTP_HAVE_SSL) -# ifdef PHP_WIN32 -# define PHP_HTTP_NEED_OPENSSL_TSL +#if ZTS && PHP_HTTP_HAVE_LIBCURL_SSL +# include "TSRM.h" +# if PHP_WIN32 +# define PHP_HTTP_NEED_OPENSSL_TSL 1 # include # else /* !PHP_WIN32 */ -# if defined(PHP_HTTP_HAVE_OPENSSL) -# define PHP_HTTP_NEED_OPENSSL_TSL +# if PHP_HTTP_HAVE_LIBCURL_OPENSSL +# define PHP_HTTP_NEED_OPENSSL_TSL 1 # include -# elif defined(PHP_HTTP_HAVE_GNUTLS) -# define PHP_HTTP_NEED_GNUTLS_TSL +# elif PHP_HTTP_HAVE_LIBCURL_GNUTLS +# define PHP_HTTP_NEED_GNUTLS_TSL 1 # include -# endif /* PHP_HTTP_HAVE_OPENSSL || PHP_HTTP_HAVE_GNUTLS */ +# endif /* PHP_HTTP_HAVE_LIBCURL_OPENSSL || PHP_HTTP_HAVE_LIBCURL_GNUTLS */ # endif /* PHP_WIN32 */ -#endif /* ZTS && PHP_HTTP_HAVE_SSL */ +#endif /* ZTS && PHP_HTTP_HAVE_LIBCURL_SSL */ -#ifdef PHP_HTTP_NEED_OPENSSL_TSL +#if PHP_HTTP_NEED_OPENSSL_TSL static MUTEX_T *php_http_openssl_tsl = NULL; static void php_http_openssl_thread_lock(int mode, int n, const char * file, int line) @@ -47,7 +48,7 @@ static ulong php_http_openssl_thread_id(void) return (ulong) tsrm_thread_id(); } #endif -#ifdef PHP_HTTP_NEED_GNUTLS_TSL +#if PHP_HTTP_NEED_GNUTLS_TSL static int php_http_gnutls_mutex_create(void **m) { if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) { @@ -86,7 +87,7 @@ static struct gcry_thread_cbs php_http_gnutls_tsl = { PHP_MINIT_FUNCTION(http_curl) { -#ifdef PHP_HTTP_NEED_OPENSSL_TSL +#if PHP_HTTP_NEED_OPENSSL_TSL /* mod_ssl, libpq or ext/curl might already have set thread lock callbacks */ if (!CRYPTO_get_id_callback()) { int i, c = CRYPTO_num_locks(); @@ -101,7 +102,7 @@ PHP_MINIT_FUNCTION(http_curl) CRYPTO_set_locking_callback(php_http_openssl_thread_lock); } #endif -#ifdef PHP_HTTP_NEED_GNUTLS_TSL +#if PHP_HTTP_NEED_GNUTLS_TSL gcry_control(GCRYCTL_SET_THREAD_CBS, &php_http_gnutls_tsl); #endif @@ -115,7 +116,7 @@ PHP_MINIT_FUNCTION(http_curl) PHP_MSHUTDOWN_FUNCTION(http_curl) { curl_global_cleanup(); -#ifdef PHP_HTTP_NEED_OPENSSL_TSL +#if PHP_HTTP_NEED_OPENSSL_TSL if (php_http_openssl_tsl) { int i, c = CRYPTO_num_locks();