@@ -2230,17 +2230,22 @@ public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expec
2230
2230
$ request = new Request ();
2231
2231
$ request ->server ->set ('SERVER_PROTOCOL ' , $ serverProtocol );
2232
2232
$ 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
+ }
2234
2237
2235
2238
$ this ->assertSame ($ expected , $ request ->getProtocolVersion ());
2236
2239
}
2237
2240
2238
2241
public function protocolVersionProvider ()
2239
2242
{
2240
2243
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 ' ],
2242
2246
'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 ' ],
2244
2249
'trusted with via ' => ['HTTP/2.0 ' , true , '1.0 fred, 1.1 nowhere.com (Apache/1.1) ' , 'HTTP/1.0 ' ],
2245
2250
'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 ' ],
2246
2251
'trusted with broken via ' => ['HTTP/2.0 ' , true , 'HTTP/1^0 foo ' , 'HTTP/2.0 ' ],
0 commit comments