8000 bug #39115 [HttpClient] don't fallback to HTTP/1.1 when HTTP/2 stream… · symfony/symfony@b60bb6e · GitHub
[go: up one dir, main page]

Skip to content

Commit b60bb6e

Browse files
committed
bug #39115 [HttpClient] don't fallback to HTTP/1.1 when HTTP/2 streams break (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] don't fallback to HTTP/1.1 when HTTP/2 streams break | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix composer/composer#9481 | License | MIT | Doc PR | - With this change, I don't reproduce the failures that I describe in composer/composer#9481 when running the script in #38690 Apparently curl has an issue when both h1.1 and h2 connections are open to the same host. Instead of switching to HTTP/1.1 when retrying requests that failed because of an HTTP/2 stream error, I propose to close the http/2 connection when issuing a retry. With this change, running the mirroring script of packagist works like a charm. No need to investigate your mirrors @Seldaek, this was definitely a data corruption issue. Commits ------- 0c92bc5 [HttpClient] don't fallback to HTTP/1.1 when HTTP/2 streams break
2 parents 308231a + 0c92bc5 commit b60bb6e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Symfony/Component/HttpClient/Response/CurlResponse.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,7 @@ private static function perform(ClientState $multi, array &$responses = null): v
283283
curl_multi_remove_handle($multi->handle, $ch);
284284
$waitFor[1] = (string) ((int) $waitFor[1] - 1); // decrement the retry counter
285285
curl_setopt($ch, \CURLOPT_PRIVATE, $waitFor);
286-
287-
if ('1' === $waitFor[1]) {
288-
curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_1_1);
289-
}
286+
curl_setopt($ch, \CURLOPT_FORBID_REUSE, true);
290287

291288
if (0 === curl_multi_add_handle($multi->handle, $ch)) {
292289
continue;

0 commit comments

Comments
 (0)
0