@@ -2248,17 +2248,22 @@ public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expec
22482248 $ request = new Request ();
22492249 $ request ->server ->set ('SERVER_PROTOCOL ' , $ serverProtocol );
22502250 $ request ->server ->set ('REMOTE_ADDR ' , '1.1.1.1 ' );
2251- $ request ->headers ->set ('Via ' , $ via );
2251+
2252+ if (null !== $ via ) {
2253+ $ request ->headers ->set ('Via ' , $ via );
2254+ }
22522255
22532256 $ this ->assertSame ($ expected , $ request ->getProtocolVersion ());
22542257 }
22552258
22562259 public function protocolVersionProvider ()
22572260 {
22582261 return [
2259- 'untrusted without via ' => ['HTTP/2.0 ' , false , '' , 'HTTP/2.0 ' ],
2262+ 'untrusted with empty via ' => ['HTTP/2.0 ' , false , '' , 'HTTP/2.0 ' ],
2263+ 'untrusted without via ' => ['HTTP/2.0 ' , false , null , 'HTTP/2.0 ' ],
22602264 'untrusted with via ' => ['HTTP/2.0 ' , false , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/2.0 ' ],
2261- 'trusted without via ' => ['HTTP/2.0 ' , true , '' , 'HTTP/2.0 ' ],
2265+ 'trusted with empty via ' => ['HTTP/2.0 ' , true , '' , 'HTTP/2.0 ' ],
2266+ 'trusted without via ' => ['HTTP/2.0 ' , true , null , 'HTTP/2.0 ' ],
22622267 'trusted with via ' => ['HTTP/2.0 ' , true , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/1.0 ' ],
22632268 '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 ' ],
22642269 'trusted with broken via ' => ['HTTP/2.0 ' , true , 'HTTP/1^0 foo ' , 'HTTP/2.0 ' ],
0 commit comments