fixed too greedy replacements
This commit is contained in:
parent
d9cf28d016
commit
65b98102d1
|
@ -304,11 +304,11 @@ abstract class Client
|
|||
$uri = $this->getAbsoluteUri($uri);
|
||||
|
||||
if (isset($server['HTTP_HOST'])) {
|
||||
$uri = str_replace(parse_url($uri, PHP_URL_HOST), $server['HTTP_HOST'], $uri);
|
||||
$uri = preg_replace('{^(https?\://)'.parse_url($uri, PHP_URL_HOST).'}', '\\1'.$server['HTTP_HOST'], $uri);
|
||||
}
|
||||
|
||||
if (isset($server['HTTPS'])) {
|
||||
$uri = str_replace(parse_url($uri, PHP_URL_SCHEME), $server['HTTPS'] ? 'https' : 'http', $uri);
|
||||
$uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
|
||||
}
|
||||
|
||||
$server = array_merge($this->server, $server);
|
||||
|
|
|
@ -593,7 +593,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST'));
|
||||
$this->assertEquals('Symfony2 BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
||||
|
||||
$client->request('GET', 'https://www.example.com/foo', array(), array(), array(
|
||||
$client->request('GET', 'https://www.example.com/https/www.example.com', array(), array(), array(
|
||||
'HTTP_HOST' => 'testhost',
|
||||
'HTTP_USER_AGENT' => 'testua',
|
||||
'HTTPS' => false,
|
||||
|
@ -603,7 +603,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST'));
|
||||
$this->assertEquals('Symfony2 BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
||||
|
||||
$this->assertEquals('http://testhost/foo', $client->getRequest()->getUri());
|
||||
$this->assertEquals('http://testhost/https/www.example.com', $client->getRequest()->getUri());
|
||||
|
||||
$server = $client->getRequest()->getServer();
|
||||
|
||||
|
|
Reference in New Issue