X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_pool_api.c;h=7dc809ba665f60883958d4748d92abf006f857a6;hb=f6280c0f47b07d5c6079f7074491b6173c89599f;hp=437530350af87b17d01aa332b11ba424209b726b;hpb=77b24e0e5f85b64a168a4ea4ce83db9339b1f31b;p=m6w6%2Fext-http diff --git a/http_request_pool_api.c b/http_request_pool_api.c index 4375303..7dc809b 100644 --- a/http_request_pool_api.c +++ b/http_request_pool_api.c @@ -18,8 +18,10 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif - #include "php.h" + +#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) + #include "php_http.h" #include "php_http_std_defs.h" #include "php_http_api.h" @@ -28,8 +30,6 @@ #include "php_http_request_object.h" #include "php_http_requestpool_object.h" -#ifdef ZEND_ENGINE_2 - #ifndef HTTP_DEBUG_REQPOOLS # define HTTP_DEBUG_REQPOOLS 0 #endif @@ -59,7 +59,6 @@ PHP_HTTP_API http_request_pool *_http_request_pool_init(http_request_pool *pool } } - pool->sent = 0; pool->unfinished = 0; zend_llist_init(&pool->handles, sizeof(zval *), (llist_dtor_func_t) ZVAL_PTR_DTOR, 0); zend_llist_init(&pool->bodies, sizeof(http_request_body *), (llist_dtor_func_t) http_request_pool_freebody, 0); @@ -160,14 +159,8 @@ PHP_HTTP_API void _http_request_pool_detach_all(http_request_pool *pool TSRMLS_D PHP_HTTP_API STATUS _http_request_pool_send(http_request_pool *pool TSRMLS_DC) { #if HTTP_DEBUG_REQPOOLS - fprintf(stderr, "Attempt to send requests of pool %p\n", pool); + fprintf(stderr, "Attempt to send %d requests of pool %p\n", zend_llist_count(&pool->handles), pool); #endif - if (pool->sent) { - http_error(E_WARNING, HTTP_E_CURL, "HttpRequestPools can only be used once"); - return FAILURE; - } else { - pool->sent = 1; - } while (http_request_pool_perform(pool)) { #if HTTP_DEBUG_REQPOOLS fprintf(stderr, "%d unfinished requests of pool %p remaining\n", pool->unfinished, pool); @@ -247,7 +240,7 @@ static int http_request_pool_compare_handles(void *h1, void *h2) } /* }}} */ -#endif /* ZEND_ENGINE_2 */ +#endif /* ZEND_ENGINE_2 && HTTP_HAVE_CURL */ /*