[BrowserKit] Fix browser kit redirect with ports

This commit is contained in:
Walther Lalk 2014-07-30 13:48:48 +02:00 committed by Fabien Potencier
parent e76561dbc0
commit 39973de230
2 changed files with 3 additions and 3 deletions

View File

@ -607,7 +607,7 @@ abstract class Client
private function updateServerFromUri($server, $uri)
{
$server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST);
$server['HTTP_HOST'] = $this->extractHost($uri);
$scheme = parse_url($uri, PHP_URL_SCHEME);
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme;
unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']);

View File

@ -484,11 +484,11 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$headers = array(
'HTTP_HOST' => 'www.example.com:8080',
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
'HTTPS' => false
'HTTPS' => false,
'HTTP_REFERER' => 'http://www.example.com:8080/'
);
$client = new TestClient();
$client->followRedirects(false);
$client->setNextResponse(new Response('', 302, array(
'Location' => 'http://www.example.com:8080/redirected',
)));