@@ -93,12 +93,14 @@ public function testGetRequest()
93
93
$ this ->assertEquals ('http://example.com/ ' , $ client ->getRequest ()->getUri (), '->getCrawler() returns the Request of the last request ' );
94
94
}
95
95
96
- public function testGetRequestWithIpAsHost ()
96
+ public function testGetRequestWithIpAsHttpHost ()
97
97
{
98
98
$ client = new TestClient ();
99
99
$ client ->request ('GET ' , 'https://example.com/foo ' , array (), array (), array ('HTTP_HOST ' => '127.0.0.1 ' ));
100
100
101
- $ this ->assertEquals ('https://127.0.0.1/foo ' , $ client ->getRequest ()->getUri ());
101
+ $ this ->assertEquals ('https://example.com/foo ' , $ client ->getRequest ()->getUri ());
102
+ $ headers = $ client ->getRequest ()->getServer ();
103
+ $ this ->assertEquals ('127.0.0.1 ' , $ headers ['HTTP_HOST ' ]);
102
104
}
103
105
104
106
public function testGetResponse ()
@@ -212,24 +214,6 @@ public function testRequestURIConversion()
212
214
$ this ->assertEquals ('http://www.example.com/http ' , $ client ->getRequest ()->getUri (), '->request() uses the previous request for relative URLs ' );
213
215
}
214
216
215
- public function testRequestURIConversionByServerHost ()
216
- {
217
- $ client = new TestClient ();
218
-
219
- $ server = array ('HTTP_HOST ' => 'www.exampl+e.com:8000 ' );
220
- $ parameters = array ();
221
- $ files = array ();
222
-
223
- $ client ->request ('GET ' , 'http://exampl+e.com ' , $ parameters , $ files , $ server );
224
- $ this ->assertEquals ('http://www.exampl+e.com:8000 ' , $ client ->getRequest ()->getUri (), '->request() uses HTTP_HOST to add port ' );
225
-
226
- $ client ->request ('GET ' , 'http://exampl+e.com:8888 ' , $ parameters , $ files , $ server );
227
- $ this ->assertEquals ('http://www.exampl+e.com:8000 ' , $ client ->getRequest ()->getUri (), '->request() uses HTTP_HOST to modify existing port ' );
228
-
229
- $ client ->request ('GET ' , 'http://exampl+e.com:8000 ' , $ parameters , $ files , $ server );
230
- $ this ->assertEquals ('http://www.exampl+e.com:8000 ' , $ client ->getRequest ()->getUri (), '->request() uses HTTP_HOST respects correct set port ' );
231
- }
232
-
233
217
public function testRequestReferer ()
234
218
{
235
219
$ client = new TestClient ();
@@ -572,7 +556,7 @@ public function testInsulatedRequests()
572
556
public function testGetServerParameter ()
573
557
{
574
558
$ client = new TestClient ();
575
- $ this ->assertEquals ('localhost ' , $ client ->getServerParameter ('HTTP_HOST ' ));
559
+ $ this ->assertEquals ('' , $ client ->getServerParameter ('HTTP_HOST ' ));
576
560
$ this ->assertEquals ('Symfony2 BrowserKit ' , $ client ->getServerParameter ('HTTP_USER_AGENT ' ));
577
561
$ this ->assertEquals ('testvalue ' , $ client ->getServerParameter ('testkey ' , 'testvalue ' ));
578
562
}
@@ -581,7 +565,7 @@ public function testSetServerParameter()
581
565
{
582
566
$ client = new TestClient ();
583
567
584
- $ this ->assertEquals ('localhost ' , $ client ->getServerParameter ('HTTP_HOST ' ));
568
+ $ this ->assertEquals ('' , $ client ->getServerParameter ('HTTP_HOST ' ));
585
569
$ this ->assertEquals ('Symfony2 BrowserKit ' , $ client ->getServerParameter ('HTTP_USER_AGENT ' ));
586
570
587
571
$ client ->setServerParameter ('HTTP_HOST ' , 'testhost ' );
@@ -595,7 +579,7 @@ public function testSetServerParameterInRequest()
595
579
{
596
580
$ client = new TestClient ();
597
581
598
- $ this ->assertEquals ('localhost ' , $ client ->getServerParameter ('HTTP_HOST ' ));
582
+ $ this ->assertEquals ('' , $ client ->getServerParameter ('HTTP_HOST ' ));
599
583
$ this ->assertEquals ('Symfony2 BrowserKit ' , $ client ->getServerParameter ('HTTP_USER_AGENT ' ));
600
584
601
585
$ client ->request ('GET ' , 'https://www.example.com/https/www.example.com ' , array (), array (), array (
@@ -605,10 +589,10 @@ public function testSetServerParameterInRequest()
605
589
'NEW_SERVER_KEY ' => 'new-server-key-value ' ,
606
590
));
607
591
608
- $ this ->assertEquals ('localhost ' , $ client ->getServerParameter ('HTTP_HOST ' ));
592
+ $ this ->assertEquals ('' , $ client ->getServerParameter ('HTTP_HOST ' ));
609
593
$ this ->assertEquals ('Symfony2 BrowserKit ' , $ client ->getServerParameter ('HTTP_USER_AGENT ' ));
610
594
611
- $ this ->assertEquals ('http://testhost /https/www.example.com ' , $ client ->getRequest ()->getUri ());
595
+ $ this ->assertEquals ('http://www.example.com /https/www.example.com ' , $ client ->getRequest ()->getUri ());
612
596
613
597
$ server = $ client ->getRequest ()->getServer ();
614
598
0 commit comments