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 https://github.com/symfony/symfony/pull/33444.
Commits
-------
e1fbaeb65c
[HttpClient] Fix a bug preventing Server Pushes to be handled properly
This commit is contained in:
commit
a99a4801a2
@ -106,8 +106,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
|
|||||||
$url = implode('', $url);
|
$url = implode('', $url);
|
||||||
|
|
||||||
if (!isset($options['normalized_headers']['user-agent'])) {
|
if (!isset($options['normalized_headers']['user-agent'])) {
|
||||||
$options['normalized_headers']['user-agent'][] = 'Symfony HttpClient/Curl';
|
$options['normalized_headers']['user-agent'][] = $options['headers'][] = 'User-Agent: Symfony HttpClient/Curl';
|
||||||
$options['headers'][] = 'User-Agent: Symfony HttpClient/Curl';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pushedResponse = $this->multi->pushedResponses[$url] ?? null) {
|
if ($pushedResponse = $this->multi->pushedResponses[$url] ?? null) {
|
||||||
@ -364,7 +363,12 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (['authorization', 'cookie', 'range', 'proxy-authorization'] as $k) {
|
foreach (['authorization', 'cookie', 'range', 'proxy-authorization'] as $k) {
|
||||||
if (($pushedResponse->requestHeaders[$k] ?? null) !== ($options['normalized_headers'][$k] ?? null)) {
|
$normalizedHeaders = $options['normalized_headers'][$k] ?? [];
|
||||||
|
foreach ($normalizedHeaders as $i => $v) {
|
||||||
|
$normalizedHeaders[$i] = substr($v, \strlen($k) + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($pushedResponse->requestHeaders[$k] ?? []) !== $normalizedHeaders) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user