Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de1409e

Browse filesBrowse files
bug #54517 [HttpClient] Let curl handle transfer encoding (michaelhue)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [HttpClient] Let curl handle transfer encoding | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54516, Fix #54491 | License | MIT Removes the `Transfer-Encoding: chunked` header that is added for chunked request bodies. This will allow curl to handle the transfer encoding and set appropriate headers based on the HTTP protocol version it negotiated with the server, since HTTP/2 does not support chunked transfer encoding. Commits ------- 69a7867 [HttpClient] Let curl handle transfer encoding
2 parents 49e9184 + 69a7867 commit de1409e
Copy full SHA for de1409e

File tree

1 file changed

+2
-3
lines changed
Filter options

1 file changed

+2
-3
lines changed

‎src/Symfony/Component/HttpClient/CurlHttpClient.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/CurlHttpClient.php
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,8 @@ public function request(string $method, string $url, array $options = []): Respo
246246

247247
if (isset($options['normalized_headers']['content-length'][0])) {
248248
$curlopts[\CURLOPT_INFILESIZE] = (int) substr($options['normalized_headers']['content-length'][0], \strlen('Content-Length: '));
249-
}
250-
if (!isset($options['normalized_headers']['transfer-encoding'])) {
251-
$curlopts[\CURLOPT_HTTPHEADER][] = 'Transfer-Encoding:'.(isset($curlopts[\CURLOPT_INFILESIZE]) ? '' : ' chunked');
249+
} elseif (!isset($options['normalized_headers']['transfer-encoding'])) {
250+
$curlopts[\CURLOPT_INFILESIZE] = -1;
252251
}
253252

254253
if ('POST' !== $method) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.