提交的内容
This commit is contained in:
10
vendor/guzzlehttp/psr7/src/Message.php
vendored
Executable file → Normal file
10
vendor/guzzlehttp/psr7/src/Message.php
vendored
Executable file → Normal file
@ -33,7 +33,7 @@ final class Message
|
||||
}
|
||||
|
||||
foreach ($message->getHeaders() as $name => $values) {
|
||||
if (strtolower($name) === 'set-cookie') {
|
||||
if (is_string($name) && strtolower($name) === 'set-cookie') {
|
||||
foreach ($values as $value) {
|
||||
$msg .= "\r\n{$name}: ".$value;
|
||||
}
|
||||
@ -146,7 +146,7 @@ final class Message
|
||||
|
||||
// If these aren't the same, then one line didn't match and there's an invalid header.
|
||||
if ($count !== substr_count($rawHeaders, "\n")) {
|
||||
// Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
|
||||
// Folding is deprecated, see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4
|
||||
if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
|
||||
throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
|
||||
}
|
||||
@ -227,9 +227,9 @@ final class Message
|
||||
public static function parseResponse(string $message): ResponseInterface
|
||||
{
|
||||
$data = self::parseMessage($message);
|
||||
// According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space
|
||||
// between status-code and reason-phrase is required. But browsers accept
|
||||
// responses without space and reason as well.
|
||||
// According to https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2
|
||||
// the space between status-code and reason-phrase is required. But
|
||||
// browsers accept responses without space and reason as well.
|
||||
if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
|
||||
throw new \InvalidArgumentException('Invalid response string: '.$data['start-line']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user