@@ -334,6 +334,7 @@ public function test304()
334
334
public function testRedirects ()
335
335
{
336
336
$ client = $ this ->getHttpClient (__FUNCTION__ );
337
+ $ localhost = gethostbyname ('localhost ' );
337
338
$ response = $ client ->request ('POST ' , 'http://localhost:8057/301 ' , [
338
339
'auth_basic ' => 'foo:bar ' ,
339
340
'body ' => function () {
@@ -351,7 +352,7 @@ public function testRedirects()
351
352
352
353
$ expected = [
353
354
'HTTP/1.1 301 Moved Permanently ' ,
354
- ' Location: http://127.0.0.1 :8057/302 ' ,
355
+ " Location: http:// $ localhost :8057/302 " ,
355
356
'Content-Type: application/json ' ,
356
357
'HTTP/1.1 302 Found ' ,
357
358
'Location: http://localhost:8057/ ' ,
@@ -424,6 +425,7 @@ public function testRedirect307()
424
425
public function testMaxRedirects ()
425
426
{
426
427
$ client = $ this ->getHttpClient (__FUNCTION__ );
428
+ $ localhost = gethostbyname ('localhost ' );
427
429
$ response = $ client ->request ('GET ' , 'http://localhost:8057/301 ' , [
428
430
'max_redirects ' => 1 ,
429
431
'auth_basic ' => 'foo:bar ' ,
@@ -441,7 +443,7 @@ public function testMaxRedirects()
441
443
442
444
$ expected = [
443
445
'HTTP/1.1 301 Moved Permanently ' ,
444
- ' Location: http://127.0.0.1 :8057/302 ' ,
446
+ " Location: http:// $ localhost :8057/302 " ,
445
447
'Content-Type: application/json ' ,
446
448
'HTTP/1.1 302 Found ' ,
447
449
'Location: http://localhost:8057/ ' ,
@@ -690,8 +692,9 @@ public function testOnProgressError()
690
692
public function testResolve ()
691
693
{
692
694
$ client = $ this ->getHttpClient (__FUNCTION__ );
695
+ $ localhost = gethostbyname ('localhost ' );
693
696
$ response = $ client ->request ('GET ' , 'http://symfony.com:8057/ ' , [
694
- 'resolve ' => ['symfony.com ' => ' 127.0.0.1 ' ],
697
+ 'resolve ' => ['symfony.com ' => $ localhost ],
695
698
]);
696
699
697
700
$ this ->assertSame (200 , $ response ->getStatusCode ());
@@ -705,15 +708,16 @@ public function testResolve()
705
708
public function testIdnResolve ()
706
709
{
707
710
$ client = $ this ->getHttpClient (__FUNCTION__ );
711
+ $ localhost = gethostbyname ('localhost ' );
708
712
709
713
$ response = $ client ->request ('GET ' , 'http://0-------------------------------------------------------------0.com:8057/ ' , [
710
- 'resolve ' => ['0-------------------------------------------------------------0.com ' => ' 127.0.0.1 ' ],
714
+ 'resolve ' => ['0-------------------------------------------------------------0.com ' => $ localhost ],
711
715
]);
712
716
713
717
$ this ->assertSame (200 , $ response ->getStatusCode ());
714
718
715
719
$ response = $ client ->request ('GET ' , 'http://Bücher.example:8057/ ' , [
716
- 'resolve ' => ['xn--bcher-kva.example ' => ' 127.0.0.1 ' ],
720
+ 'resolve ' => ['xn--bcher-kva.example ' => $ localhost ],
717
721
]);
718
722
719
723
$ this ->assertSame (200 , $ response ->getStatusCode ());
@@ -881,7 +885,7 @@ public function testProxy()
881
885
882
886
$ body = $ response ->toArray ();
883
887
$ this ->assertSame ('localhost:8057 ' , $ body ['HTTP_HOST ' ]);
884
- $ this ->assertMatchesRegularExpression ('#^http://(localhost|127\.0\.0 \.1):8057/$# ' , $ body ['REQUEST_URI ' ]);
888
+ $ this ->assertMatchesRegularExpression ('#^http://(localhost|127\.0\.\d+ \.1):8057/$# ' , $ body ['REQUEST_URI ' ]);
885
889
886
890
$ response = $ client ->request ('GET ' , 'http://localhost:8057/ ' , [
887
891
'proxy ' => 'http://foo:b%3Dar@localhost:8057 ' ,
0 commit comments