@@ -2230,17 +2230,22 @@ public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expec
22302230 $ request = new Request ();
22312231 $ request ->server ->set ('SERVER_PROTOCOL ' , $ serverProtocol );
22322232 $ request ->server ->set ('REMOTE_ADDR ' , '1.1.1.1 ' );
2233- $ request ->headers ->set ('Via ' , $ via );
2233+
2234+ if (null !== $ via ) {
2235+ $ request ->headers ->set ('Via ' , $ via );
2236+ }
22342237
22352238 $ this ->assertSame ($ expected , $ request ->getProtocolVersion ());
22362239 }
22372240
22382241 public function protocolVersionProvider ()
22392242 {
22402243 return [
2241- 'untrusted without via ' => ['HTTP/2.0 ' , false , '' , 'HTTP/2.0 ' ],
2244+ 'untrusted with empty via ' => ['HTTP/2.0 ' , false , '' , 'HTTP/2.0 ' ],
2245+ 'untrusted without via ' => ['HTTP/2.0 ' , false , null , 'HTTP/2.0 ' ],
22422246 'untrusted with via ' => ['HTTP/2.0 ' , false , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/2.0 ' ],
2243- 'trusted without via ' => ['HTTP/2.0 ' , true , '' , 'HTTP/2.0 ' ],
2247+ 'trusted with empty via ' => ['HTTP/2.0 ' , true , '' , 'HTTP/2.0 ' ],
2248+ 'trusted without via ' => ['HTTP/2.0 ' , true , null , 'HTTP/2.0 ' ],
22442249 'trusted with via ' => ['HTTP/2.0 ' , true , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/1.0 ' ],
22452250 '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 ' ],
22462251 'trusted with broken via ' => ['HTTP/2.0 ' , true , 'HTTP/1^0 foo ' , 'HTTP/2.0 ' ],
0 commit comments