@@ -2248,17 +2248,22 @@ public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expec
2248
2248
$ request = new Request ();
2249
2249
$ request ->server ->set ('SERVER_PROTOCOL ' , $ serverProtocol );
2250
2250
$ 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
+ }
2252
2255
2253
2256
$ this ->assertSame ($ expected , $ request ->getProtocolVersion ());
2254
2257
}
2255
2258
2256
2259
public function protocolVersionProvider ()
2257
2260
{
2258
2261
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 ' ],
2260
2264
'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 ' ],
2262
2267
'trusted with via ' => ['HTTP/2.0 ' , true , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/1.0 ' ],
2263
2268
'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 ' ],
2264
2269
'trusted with broken via ' => ['HTTP/2.0 ' , true , 'HTTP/1^0 foo ' , 'HTTP/2.0 ' ],
0 commit comments