bug #34251 [HttpClient] expose only gzip when doing transparent compression (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
-------

6571dddc4c [HttpClient] expose only gzip when doing transparent compression
This commit is contained in:
Nicolas Grekas 2019-11-06 13:01:29 +01:00
commit 4f04bedd00

View File

@ -210,8 +210,8 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
$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) {