reset the client when destructing;
authorMichael Wallner <mike@php.net>
Tue, 20 Aug 2013 10:20:15 +0000 (10:20 +0000)
committerMichael Wallner <mike@php.net>
Tue, 20 Aug 2013 10:20:15 +0000 (10:20 +0000)
this ensures any attached requests will be
dequeued and in case of using persistent
handles can be property re-used

php_http_client.c

index 1f4e09a4dc4c10268894c6129564d17e740af87f..2306b040a1c5361b39e72308165944c5c455942f 100644 (file)
@@ -199,13 +199,12 @@ PHP_HTTP_API php_http_client_t *php_http_client_copy(php_http_client_t *from, ph
 
 PHP_HTTP_API void php_http_client_dtor(php_http_client_t *h)
 {
+       php_http_client_reset(h);
+
        if (h->ops->dtor) {
                h->ops->dtor(h);
        }
 
-       zend_llist_clean(&h->requests);
-       zend_llist_clean(&h->responses);
-
        php_resource_factory_free(&h->rf);
 }