X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_client_curl.c;h=43396255994dc87fbdc8b729bca30435198579f4;hp=fbb950ac276eb4a059a4494746601dea236c3fa1;hb=69ffc0bdc7ead5971fe683f9f72596a127c5ea58;hpb=87db9817d428282792c8146d9c2ae9748ebf6f1e diff --git a/php_http_client_curl.c b/php_http_client_curl.c index fbb950a..4339625 100644 --- a/php_http_client_curl.c +++ b/php_http_client_curl.c @@ -16,13 +16,20 @@ #if PHP_HTTP_HAVE_CURL #if PHP_HTTP_HAVE_EVENT -# include # if !PHP_HTTP_HAVE_EVENT2 && /* just be really sure */ !(LIBEVENT_VERSION_NUMBER >= 0x02000000) +# include # define event_base_new event_init # define event_assign(e, b, s, a, cb, d) do {\ event_set(e, s, a, cb, d); \ event_base_set(b, e); \ } while(0) +# else +# if PHP_HTTP_HAVE_EVENT2 +# include +# include +# else +# error "libevent presence is unknown" +# endif # endif # ifndef DBG_EVENTS # define DBG_EVENTS 0 @@ -1089,7 +1096,7 @@ static void php_http_curle_options_init(php_http_options_t *registry TSRMLS_DC) /* useragent */ if ((opt = php_http_option_register(registry, ZEND_STRL("useragent"), CURLOPT_USERAGENT, IS_STRING))) { /* don't check strlen, to allow sending no useragent at all */ - ZVAL_STRING(&opt->defval, "PECL::HTTP/" PHP_HTTP_EXT_VERSION " (PHP/" PHP_VERSION ")", 0); + ZVAL_STRING(&opt->defval, "PECL::HTTP/" PHP_PECL_HTTP_VERSION " (PHP/" PHP_VERSION ")", 0); } /* resume */ @@ -1762,11 +1769,12 @@ static int php_http_client_curl_once(php_http_client_t *h) static STATUS php_http_client_curl_exec(php_http_client_t *h) { - TSRMLS_FETCH_FROM_CTX(h->ts); - #if PHP_HTTP_HAVE_EVENT php_http_client_curl_t *curl = h->ctx; +#endif + TSRMLS_FETCH_FROM_CTX(h->ts); +#if PHP_HTTP_HAVE_EVENT if (curl->useevents) { php_http_curlm_timeout_callback(CURL_SOCKET_TIMEOUT, /*EV_READ|EV_WRITE*/0, h); do { @@ -1972,7 +1980,11 @@ PHP_MINIT_FUNCTION(http_client_curl) PHP_MSHUTDOWN_FUNCTION(http_client_curl) { + php_persistent_handles_cleanup(ZEND_STRL("http\\Client\\Curl"), NULL, 0 TSRMLS_CC); + php_persistent_handles_cleanup(ZEND_STRL("http\\Client\\Curl\\Request"), NULL, 0 TSRMLS_CC); + php_http_options_dtor(&php_http_curle_options); + return SUCCESS; }