From: Michael Wallner Date: Mon, 30 Jul 2012 18:29:59 +0000 (+0000) Subject: ensure we're talking to curl ops X-Git-Tag: RELEASE_2_1_0_RC3~10^2^2~119 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7bcfee9d63fd596119c5ba29f6f2e193f34e0f45;p=m6w6%2Fext-http ensure we're talking to curl ops --- diff --git a/php_http_curl_client_pool.c b/php_http_curl_client_pool.c index 21d3314..d1873fb 100644 --- a/php_http_curl_client_pool.c +++ b/php_http_curl_client_pool.c @@ -281,6 +281,11 @@ static STATUS php_http_curl_client_pool_attach(php_http_client_pool_t *h, php_ht CURLMcode rs; TSRMLS_FETCH_FROM_CTX(h->ts); + if (r->ops != php_http_curl_client_get_ops()) { + php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT_POOL, "Cannot attach a non-curl client to this pool"); + return FAILURE; + } + if (SUCCESS != php_http_curl_client_prepare(r, m)) { return FAILURE; } @@ -298,10 +303,15 @@ static STATUS php_http_curl_client_pool_detach(php_http_client_pool_t *h, php_ht { php_http_curl_client_pool_t *curl = h->ctx; php_http_curl_client_t *recurl = r->ctx; - CURLMcode rs = curl_multi_remove_handle(curl->handle, recurl->handle); + CURLMcode rs; TSRMLS_FETCH_FROM_CTX(h->ts); - if (CURLM_OK == rs) { + if (r->ops != php_http_curl_client_get_ops()) { + php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT_POOL, "Cannot attach a non-curl client to this pool"); + return FAILURE; + } + + if (CURLM_OK == (rs = curl_multi_remove_handle(curl->handle, recurl->handle))) { return SUCCESS; } else { php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT_POOL, "Could not detach request from pool: %s", curl_multi_strerror(rs));