[HttpClient] fix PHP warning + accept status code >= 600
This commit is contained in:
parent
9bcf9c1e02
commit
c764b5c36e
@ -312,8 +312,15 @@ final class CurlResponse implements ResponseInterface
|
||||
}
|
||||
|
||||
if ("\r\n" !== $data) {
|
||||
// Regular header line: add it to the list
|
||||
self::addResponseHeaders([substr($data, 0, -2)], $info, $headers);
|
||||
try {
|
||||
// Regular header line: add it to the list
|
||||
self::addResponseHeaders([substr($data, 0, -2)], $info, $headers);
|
||||
} catch (TransportException $e) {
|
||||
$multi->handlesActivity[$id][] = null;
|
||||
$multi->handlesActivity[$id][] = $e;
|
||||
|
||||
return \strlen($data);
|
||||
}
|
||||
|
||||
if (0 !== strpos($data, 'HTTP/')) {
|
||||
if (0 === stripos($data, 'Location:')) {
|
||||
|
@ -253,7 +253,7 @@ trait ResponseTrait
|
||||
private static function addResponseHeaders(array $responseHeaders, array &$info, array &$headers, string &$debug = ''): void
|
||||
{
|
||||
foreach ($responseHeaders as $h) {
|
||||
if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? ([12345]\d\d)(?: |$)#', $h, $m)) {
|
||||
if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? ([1-9]\d\d)(?: |$)#', $h, $m)) {
|
||||
if ($headers) {
|
||||
$debug .= "< \r\n";
|
||||
$headers = [];
|
||||
|
Reference in New Issue
Block a user