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 a99a480

Browse filesBrowse files
minor #33452 [HttpClient] Fix a bug preventing Server Pushes to be handled properly (dunglas)
This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] Fix a bug preventing Server Pushes to be handled properly | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a Follows #33444. Commits ------- e1fbaeb [HttpClient] Fix a bug preventing Server Pushes to be handled properly
2 parents f48ebfa + e1fbaeb commit a99a480
Copy full SHA for a99a480

File tree

1 file changed

+7
-3
lines changed
Filter options

1 file changed

+7
-3
lines changed

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

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

108108
if (!isset($options['normalized_headers']['user-agent'])) {
109-
$options['normalized_headers']['user-agent'][] = 'Symfony HttpClient/Curl';
110-
$options['headers'][] = 'User-Agent: Symfony HttpClient/Curl';
109+
$options['normalized_headers']['user-agent'][] = $options['headers'][] = 'User-Agent: Symfony HttpClient/Curl';
111110
}
112111

113112
if ($pushedResponse = $this->multi->pushedResponses[$url] ?? null) {
@@ -364,7 +363,12 @@ private static function acceptPushForRequest(string $method, array $options, Pus
364363
}
365364

366365
foreach (['authorization', 'cookie', 'range', 'proxy-authorization'] as $k) {
367-
if (($pushedResponse->requestHeaders[$k] ?? null) !== ($options['normalized_headers'][$k] ?? null)) {
366+
$normalizedHeaders = $options['normalized_headers'][$k] ?? [];
367+
foreach ($normalizedHeaders as $i => $v) {
368+
$normalizedHeaders[$i] = substr($v, \strlen($k) + 2);
369+
}
370+
371+
if (($pushedResponse->requestHeaders[$k] ?? []) !== $normalizedHeaders) {
368372
return false;
369373
}
370374
}

0 commit comments

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