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