[BrowserKit] Fix #10641 : BrowserKit is broken when using ip as host
This commit is contained in:
parent
8aa194c0a6
commit
e946da303d
@ -304,7 +304,7 @@ abstract class Client
|
||||
$uri = $this->getAbsoluteUri($uri);
|
||||
|
||||
if (isset($server['HTTP_HOST'])) {
|
||||
$uri = preg_replace('{^(https?\://)'.parse_url($uri, PHP_URL_HOST).'}', '\\1'.$server['HTTP_HOST'], $uri);
|
||||
$uri = preg_replace('{^(https?\://)'.parse_url($uri, PHP_URL_HOST).'}', '${1}'.$server['HTTP_HOST'], $uri);
|
||||
}
|
||||
|
||||
if (isset($server['HTTPS'])) {
|
||||
|
@ -103,6 +103,14 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://example.com/', $client->getRequest()->getUri(), '->getCrawler() returns the Request of the last request');
|
||||
}
|
||||
|
||||
public function testGetRequestWithIpAsHost()
|
||||
{
|
||||
$client = new TestClient();
|
||||
$client->request('GET', 'https://example.com/foo', array(), array(), array('HTTP_HOST' => '127.0.0.1'));
|
||||
|
||||
$this->assertEquals('https://127.0.0.1/foo', $client->getRequest()->getUri());
|
||||
}
|
||||
|
||||
public function testGetResponse()
|
||||
{
|
||||
$client = new TestClient();
|
||||
|
Reference in New Issue
Block a user