From: Michael Wallner Date: Thu, 5 Feb 2015 15:25:27 +0000 (+0100) Subject: since we use the curl write handler we can use curl's decoder X-Git-Tag: RELEASE_2_3_0_RC1~56 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=225ce54f0baaf9f840c952d9f2e7bfc52aae0981 since we use the curl write handler we can use curl's decoder --- diff --git a/php_http_client_curl.c b/php_http_client_curl.c index 501681d..8aaeaa0 100644 --- a/php_http_client_curl.c +++ b/php_http_client_curl.c @@ -948,9 +948,10 @@ static STATUS php_http_curle_option_set_lastmodified(php_http_option_t *opt, zva static STATUS php_http_curle_option_set_compress(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; + CURL *ch = curl->handle; - if (Z_BVAL_P(val)) { - curl->options.headers = curl_slist_append(curl->options.headers, "Accept-Encoding: gzip;q=1.0,deflate;q=0.5"); + if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_ACCEPT_ENCODING, Z_BVAL_P(val) ? "" : NULL)) { + return FAILURE; } return SUCCESS; }