Skip to content

Commit

Permalink
bug #34251 [HttpClient] expose only gzip when doing transparent compr…
Browse files Browse the repository at this point in the history
…ession (nicolas-grekas)

This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] expose only gzip when doing transparent compression

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Closes #34083
| License       | MIT
| Doc PR        | -

Commits
-------

6571ddd [HttpClient] expose only gzip when doing transparent compression
  • Loading branch information
nicolas-grekas committed Nov 6, 2019
2 parents ddf9e0f + 6571ddd commit 4f04bed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpClient/CurlHttpClient.php
Expand Up @@ -210,8 +210,8 @@ public function request(string $method, string $url, array $options = []): Respo
$curlopts[CURLOPT_NOSIGNAL] = true;
}

if (!isset($options['normalized_headers']['accept-encoding'])) {
$curlopts[CURLOPT_ENCODING] = ''; // Enable HTTP compression
if (!isset($options['normalized_headers']['accept-encoding']) && CURL_VERSION_LIBZ & self::$curlVersion['features']) {
$curlopts[CURLOPT_ENCODING] = 'gzip'; // Expose only one encoding, some servers mess up when more are provided
}

foreach ($options['headers'] as $header) {
Expand Down

0 comments on commit 4f04bed

Please sign in to comment.