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

Commit4bfb8da

Browse files
thecaliskanEmre Çalışkan
authored and
Emre Çalışkan
committed
fixed Via regex
1 parent62c4b11 commit4bfb8da

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

‎src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ public function isMethodCacheable(): bool
14661466
publicfunctiongetProtocolVersion(): ?string
14671467
{
14681468
if ($this->isFromTrustedProxy()) {
1469-
preg_match('~^(HTTP/)?([1-9]\.[0-9])~',$this->headers->get('Via') ??'',$matches);
1469+
preg_match('~^(HTTP/)?([1-9]\.[0-9])\b~',$this->headers->get('Via') ??'',$matches);
14701470

14711471
if ($matches) {
14721472
return'HTTP/'.$matches[2];

‎src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,8 @@ public static function protocolVersionProvider()
24022402
'trusted with via and protocol name' => ['HTTP/2.0',true,'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)','HTTP/1.0'],
24032403
'trusted with broken via' => ['HTTP/2.0',true,'HTTP/1^0 foo','HTTP/2.0'],
24042404
'trusted with partially-broken via' => ['HTTP/2.0',true,'1.0 fred, foo','HTTP/1.0'],
2405+
'trusted with simple via' => ['HTTP/2.0',true,'HTTP/1.0','HTTP/1.0'],
2406+
'trusted with only version via' => ['HTTP/2.0',true,'1.0','HTTP/1.0'],
24052407
];
24062408
}
24072409

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp