From 69a7867023529af868c57be763953c2b0104bdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20H=C3=BCneburg?= Date: Sun, 7 Apr 2024 15:56:47 +0200 Subject: [PATCH] [HttpClient] Let curl handle transfer encoding --- src/Symfony/Component/HttpClient/CurlHttpClient.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 3a2fba025aeff..4c5ced322d5de 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -246,9 +246,8 @@ public function request(string $method, string $url, array $options = []): Respo if (isset($options['normalized_headers']['content-length'][0])) { $curlopts[\CURLOPT_INFILESIZE] = (int) substr($options['normalized_headers']['content-length'][0], \strlen('Content-Length: ')); - } - if (!isset($options['normalized_headers']['transfer-encoding'])) { - $curlopts[\CURLOPT_HTTPHEADER][] = 'Transfer-Encoding:'.(isset($curlopts[\CURLOPT_INFILESIZE]) ? '' : ' chunked'); + } elseif (!isset($options['normalized_headers']['transfer-encoding'])) { + $curlopts[\CURLOPT_INFILESIZE] = -1; } if ('POST' !== $method) {