@@ -2256,17 +2256,22 @@ public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expec
22562256 $ request = new Request ();
22572257 $ request ->server ->set ('SERVER_PROTOCOL ' , $ serverProtocol );
22582258 $ request ->server ->set ('REMOTE_ADDR ' , '1.1.1.1 ' );
2259- $ request ->headers ->set ('Via ' , $ via );
2259+
2260+ if (null !== $ via ) {
2261+ $ request ->headers ->set ('Via ' , $ via );
2262+ }
22602263
22612264 $ this ->assertSame ($ expected , $ request ->getProtocolVersion ());
22622265 }
22632266
22642267 public function protocolVersionProvider ()
22652268 {
22662269 return [
2267- 'untrusted without via ' => ['HTTP/2.0 ' , false , '' , 'HTTP/2.0 ' ],
2270+ 'untrusted with empty via ' => ['HTTP/2.0 ' , false , '' , 'HTTP/2.0 ' ],
2271+ 'untrusted without via ' => ['HTTP/2.0 ' , false , null , 'HTTP/2.0 ' ],
22682272 'untrusted with via ' => ['HTTP/2.0 ' , false , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/2.0 ' ],
2269- 'trusted without via ' => ['HTTP/2.0 ' , true , '' , 'HTTP/2.0 ' ],
2273+ 'trusted with empty via ' => ['HTTP/2.0 ' , true , '' , 'HTTP/2.0 ' ],
2274+ 'trusted without via ' => ['HTTP/2.0 ' , true , null , 'HTTP/2.0 ' ],
22702275 'trusted with via ' => ['HTTP/2.0 ' , true , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/1.0 ' ],
22712276 '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 ' ],
22722277 'trusted with broken via ' => ['HTTP/2.0 ' , true , 'HTTP/1^0 foo ' , 'HTTP/2.0 ' ],
0 commit comments