Skip to content

Commit ec0333c

Browse files
bug #35324 [HttpClient] Fix strict parsing of response status codes (Armando-Walmeric)
This PR was submitted for the master branch but it was squashed and merged into the 4.3 branch instead. Discussion ---------- [HttpClient] Fix strict parsing of response status codes | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | No ticket opened | License | MIT | Doc PR | No new feature If you wait a strict Http code response by the server were you request, but the server response isn't strict and only return HTTP/1.1 200 we have a problem without sense to be strict on regular expression. Commits ------- 4aa9536 [HttpClient] Fix strict parsing of response status codes
2 parents 1d25a25 + 4aa9536 commit ec0333c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private static function initialize(self $response): void
223223
private static function addResponseHeaders(array $responseHeaders, array &$info, array &$headers, string &$debug = ''): void
224224
{
225225
foreach ($responseHeaders as $h) {
226-
if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? ([12345]\d\d) .*#', $h, $m)) {
226+
if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? ([12345]\d\d)(?: |$)#', $h, $m)) {
227227
if ($headers) {
228228
$debug .= "< \r\n";
229229
$headers = [];

0 commit comments

Comments
 (0)
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