Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitcc519aa

Browse files
bug#36823 [HttpClient] fix PHP warning + accept status code >= 600 (nicolas-grekas)
This PR was merged into the 4.4 branch.Discussion----------[HttpClient] fix PHP warning + accept status code >= 600| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#36717| License | MIT| Doc PR | -This fixes the PHP warning reported in the linked issue.This also relaxes the accepted status codes, withhttps://www.linkedin.com/company/linkedin/ as an example that returns a non-conformant one (`999`).These are now handled as 5xx codes, ie they trigger a ServerException.Commits-------c764b5c [HttpClient] fix PHP warning + accept status code >= 600
2 parentsbce3760 +c764b5c commitcc519aa

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,15 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
312312
}
313313

314314
if ("\r\n" !==$data) {
315-
// Regular header line: add it to the list
316-
self::addResponseHeaders([substr($data,0, -2)],$info,$headers);
315+
try {
316+
// Regular header line: add it to the list
317+
self::addResponseHeaders([substr($data,0, -2)],$info,$headers);
318+
}catch (TransportException$e) {
319+
$multi->handlesActivity[$id][] =null;
320+
$multi->handlesActivity[$id][] =$e;
321+
322+
return\strlen($data);
323+
}
317324

318325
if (0 !==strpos($data,'HTTP/')) {
319326
if (0 ===stripos($data,'Location:')) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private static function initialize(self $response): void
253253
privatestaticfunctionaddResponseHeaders(array$responseHeaders,array &$info,array &$headers,string &$debug =''):void
254254
{
255255
foreach ($responseHeadersas$h) {
256-
if (11 <=\strlen($h) &&'/' ===$h[4] &&preg_match('#^HTTP/\d+(?:\.\d+)? ([12345]\d\d)(?: |$)#',$h,$m)) {
256+
if (11 <=\strlen($h) &&'/' ===$h[4] &&preg_match('#^HTTP/\d+(?:\.\d+)? ([1-9]\d\d)(?: |$)#',$h,$m)) {
257257
if ($headers) {
258258
$debug .="<\r\n";
259259
$headers = [];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp