@@ -306,14 +306,29 @@ public function testMarshalHostAndPortWillDetectPortInIpv6StyleHost()
306
306
$ this ->assertNull ($ uri ->getPort ());
307
307
}
308
308
309
- public function testMarshalUriDetectsHttpsSchemeFromServerValue ()
309
+ /**
310
+ * @return array
311
+ */
312
+ public function httpsParamProvider ()
313
+ {
314
+ return [
315
+ 'lowercase ' => ['https ' ],
316
+ 'uppercase ' => ['HTTPS ' ],
317
+ ];
318
+ }
319
+
320
+ /**
321
+ * @dataProvider httpsParamProvider
322
+ * @param string $param
323
+ */
324
+ public function testMarshalUriDetectsHttpsSchemeFromServerValue ($ param )
310
325
{
311
326
$ request = new ServerRequest ();
312
327
$ request = $ request ->withUri (new Uri ('http://example.com/ ' ));
313
328
$ request = $ request ->withHeader ('Host ' , 'example.com ' );
314
329
315
330
$ server = [
316
- ' HTTPS ' => true ,
331
+ $ param => true ,
317
332
];
318
333
319
334
$ uri = marshalUriFromSapi ($ server , $ request ->getHeaders ());
@@ -322,14 +337,34 @@ public function testMarshalUriDetectsHttpsSchemeFromServerValue()
322
337
$ this ->assertSame ('https ' , $ uri ->getScheme ());
323
338
}
324
339
325
- public function testMarshalUriUsesHttpSchemeIfHttpsServerValueEqualsOff ()
340
+ /**
341
+ * @return iterable
342
+ */
343
+ public function httpsDisableParamProvider ()
344
+ {
345
+ foreach ($ this ->httpsParamProvider () as $ key => $ data ) {
346
+ $ param = array_shift ($ data );
347
+ foreach (['lowercase-off ' , 'uppercase-off ' ] as $ type ) {
348
+ $ key = sprintf ('%s-%s ' , $ key , $ type );
349
+ $ value = false !== strpos ($ type , 'lowercase ' ) ? 'off ' : 'OFF ' ;
350
+ yield $ key => [$ param , $ value ];
351
+ }
352
+ }
353
+ }
354
+
355
+ /**
356
+ * @dataProvider httpsDisableParamProvider
357
+ * @param string $param
358
+ * @param string $value
359
+ */
360
+ public function testMarshalUriUsesHttpSchemeIfHttpsServerValueEqualsOff ($ param , $ value )
326
361
{
327
362
$ request = new ServerRequest ();
328
363
$ request = $ request ->withUri (new Uri ('http://example.com/ ' ));
329
364
$ request = $ request ->withHeader ('Host ' , 'example.com ' );
330
365
331
366
$ server = [
332
- ' HTTPS ' => ' off ' ,
367
+ $ param => $ value ,
333
368
];
334
369
335
370
$ uri = marshalUriFromSapi ($ server , $ request ->getHeaders ());
@@ -338,12 +373,16 @@ public function testMarshalUriUsesHttpSchemeIfHttpsServerValueEqualsOff()
338
373
$ this ->assertSame ('http ' , $ uri ->getScheme ());
339
374
}
340
375
341
- public function testMarshalUriDetectsHttpsSchemeFromXForwardedProtoValue ()
376
+ /**
377
+ * @dataProvider httpsParamProvider
378
+ * @param string $xForwardedProto
379
+ */
380
+ public function testMarshalUriDetectsHttpsSchemeFromXForwardedProtoValue ($ xForwardedProto )
342
381
{
343
382
$ request = new ServerRequest ();
344
383
$ request = $ request ->withUri (new Uri ('http://example.com/ ' ));
345
384
$ request = $ request ->withHeader ('Host ' , 'example.com ' );
346
- $ request = $ request ->withHeader ('X-Forwarded-Proto ' , ' https ' );
385
+ $ request = $ request ->withHeader ('X-Forwarded-Proto ' , $ xForwardedProto );
347
386
348
387
$ server = [];
349
388
0 commit comments