Skip to content

Commit 5f0b62a

Browse files
[HttpClient] expose only gzip when doing transparent compression
1 parent 6519e8e commit 5f0b62a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CurlHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ public function request(string $method, string $url, array $options = []): Respo
210210
$curlopts[CURLOPT_NOSIGNAL] = true;
211211
}
212212

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

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

0 commit comments

Comments
 (0)