X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_client_curl.c;h=e92834dd98f0936733b8d92804d2902ad08bc425;hp=501681d3ec9e96df9a5101c04e72a3d504055ee7;hb=791511f3bc18cdc68b3f27b43d9396cf56d99e5a;hpb=9467cc0206e131f51106ef0f3c4ff4769f7b4767 diff --git a/php_http_client_curl.c b/php_http_client_curl.c index 501681d..e92834d 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; } @@ -1742,6 +1743,9 @@ static STATUS php_http_client_curl_handler_prepare(php_http_client_curl_handler_ } } + /* apply options */ + php_http_options_apply(&php_http_curle_options, enqueue->options, curl); + /* request headers */ php_http_message_update_headers(msg); if (zend_hash_num_elements(&msg->hdrs)) { @@ -1797,8 +1801,6 @@ static STATUS php_http_client_curl_handler_prepare(php_http_client_curl_handler_ curl_easy_setopt(curl->handle, CURLOPT_POSTFIELDSIZE, 0L); } - php_http_options_apply(&php_http_curle_options, enqueue->options, curl); - return SUCCESS; }