From 87ca825717928d178de8a3458f163100925fb675 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 27 Jun 2024 17:05:20 +0200 Subject: [PATCH] [HttpClient][Mailer] Revert "Let curl handle transfer encoding", use HTTP/1.1 for Mailgun --- CurlHttpClient.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CurlHttpClient.php b/CurlHttpClient.php index 4c5ced3..3a2fba0 100644 --- a/CurlHttpClient.php +++ b/CurlHttpClient.php @@ -246,8 +246,9 @@ 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: ')); - } elseif (!isset($options['normalized_headers']['transfer-encoding'])) { - $curlopts[\CURLOPT_INFILESIZE] = -1; + } + if (!isset($options['normalized_headers']['transfer-encoding'])) { + $curlopts[\CURLOPT_HTTPHEADER][] = 'Transfer-Encoding:'.(isset($curlopts[\CURLOPT_INFILESIZE]) ? '' : ' chunked'); } if ('POST' !== $method) {