#if PHP_HTTP_HAVE_CURL
#if PHP_HTTP_HAVE_EVENT
-# include <event.h>
# if !PHP_HTTP_HAVE_EVENT2 && /* just be really sure */ !(LIBEVENT_VERSION_NUMBER >= 0x02000000)
+# include <event.h>
# 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
-# include <event_struct.h>
-# endif
+# else
+# if PHP_HTTP_HAVE_EVENT2
+# include <event2/event.h>
+# include <event2/event_struct.h>
+# else
+# error "libevent presence is unknown"
+# endif
+# endif
# ifndef DBG_EVENTS
# define DBG_EVENTS 0
# endif
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 {
PHP_MSHUTDOWN_FUNCTION(http_client_curl)
{
+ php_persistent_handle_cleanup(ZEND_STRL("http\\Client\\Curl"), NULL, 0 TSRMLS_CC);
+ php_persistent_handle_cleanup(ZEND_STRL("http\\Client\\Curl\\Request"), NULL, 0 TSRMLS_CC);
+
php_http_options_dtor(&php_http_curle_options);
+
return SUCCESS;
}