@@ -335,6 +335,7 @@ public function test304()
335
335
public function testRedirects ()
336
336
{
337
337
$ client = $ this ->getHttpClient (__FUNCTION__ );
338
+ $ localhost = gethostbyname ('localhost ' );
338
339
$ response = $ client ->request ('POST ' , 'http://localhost:8057/301 ' , [
339
340
'auth_basic ' => 'foo:bar ' ,
340
341
'body ' => function () {
@@ -352,7 +353,7 @@ public function testRedirects()
352
353
353
354
$ expected = [
354
355
'HTTP/1.1 301 Moved Permanently ' ,
355
- ' Location: http://127.0.0.1 :8057/302 ' ,
356
+ " Location: http:// $ localhost :8057/302 " ,
356
357
'Content-Type: application/json ' ,
357
358
'HTTP/1.1 302 Found ' ,
358
359
'Location: http://localhost:8057/ ' ,
@@ -425,6 +426,7 @@ public function testRedirect307()
425
426
public function testMaxRedirects ()
426
427
{
427
428
$ client = $ this ->getHttpClient (__FUNCTION__ );
429
+ $ localhost = gethostbyname ('localhost ' );
428
430
$ response = $ client ->request ('GET ' , 'http://localhost:8057/301 ' , [
429
431
'max_redirects ' => 1 ,
430
432
'auth_basic ' => 'foo:bar ' ,
@@ -442,7 +444,7 @@ public function testMaxRedirects()
442
444
443
445
$ expected = [
444
446
'HTTP/1.1 301 Moved Permanently ' ,
445
- ' Location: http://127.0.0.1 :8057/302 ' ,
447
+ " Location: http:// $ localhost :8057/302 " ,
446
448
'Content-Type: application/json ' ,
447
449
'HTTP/1.1 302 Found ' ,
448
450
'Location: http://localhost:8057/ ' ,
@@ -691,8 +693,9 @@ public function testOnProgressError()
691
693
public function testResolve ()
692
694
{
693
695
$ client = $ this ->getHttpClient (__FUNCTION__ );
696
+ $ localhost = gethostbyname ('localhost ' );
694
697
$ response = $ client ->request ('GET ' , 'http://symfony.com:8057/ ' , [
695
- 'resolve ' => ['symfony.com ' => ' 127.0.0.1 ' ],
698
+ 'resolve ' => ['symfony.com ' => $ localhost ],
696
699
]);
697
700
698
701
$ this ->assertSame (200 , $ response ->getStatusCode ());
@@ -706,15 +709,16 @@ public function testResolve()
706
709
public function testIdnResolve ()
707
710
{
708
711
$ client = $ this ->getHttpClient (__FUNCTION__ );
712
+ $ localhost = gethostbyname ('localhost ' );
709
713
710
714
$ response = $ client ->request ('GET ' , 'http://0-------------------------------------------------------------0.com:8057/ ' , [
711
- 'resolve ' => ['0-------------------------------------------------------------0.com ' => ' 127.0.0.1 ' ],
715
+ 'resolve ' => ['0-------------------------------------------------------------0.com ' => $ localhost ],
712
716
]);
713
717
714
718
$ this ->assertSame (200 , $ response ->getStatusCode ());
715
719
716
720
$ response = $ client ->request ('GET ' , 'http://Bücher.example:8057/ ' , [
717
- 'resolve ' => ['xn--bcher-kva.example ' => ' 127.0.0.1 ' ],
721
+ 'resolve ' => ['xn--bcher-kva.example ' => $ localhost ],
718
722
]);
719
723
720
724
$ this ->assertSame (200 , $ response ->getStatusCode ());
0 commit comments