From e1fbaeb65cf8ecd654cba4fc7618ec7c4d5ae74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 3 Sep 2019 23:26:51 +0200 Subject: [PATCH] [HttpClient] Fix a bug preventing Server Pushes to be handled properly --- src/Symfony/Component/HttpClient/CurlHttpClient.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 0173c4fd62202..d3a02a0390136 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -106,8 +106,7 @@ public function request(string $method, string $url, array $options = []): Respo $url = implode('', $url); if (!isset($options['normalized_headers']['user-agent'])) { - $options['normalized_headers']['user-agent'][] = 'Symfony HttpClient/Curl'; - $options['headers'][] = 'User-Agent: Symfony HttpClient/Curl'; + $options['normalized_headers']['user-agent'][] = $options['headers'][] = 'User-Agent: Symfony HttpClient/Curl'; } if ($pushedResponse = $this->multi->pushedResponses[$url] ?? null) { @@ -364,7 +363,12 @@ private static function acceptPushForRequest(string $method, array $options, Pus } 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; } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy