From d9cf28d016bee7b78494f20d8712fa062b0b2884 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 27 Mar 2014 10:02:54 +0100 Subject: [PATCH] fixed protocol-relative URLs --- src/Symfony/Component/BrowserKit/Client.php | 3 ++- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index aa02331176..2e5aedc529 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -613,7 +613,8 @@ abstract class Client private function updateServerFromUri($server, $uri) { $server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST); - $server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME); + $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']); return $server; diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index c52e75076b..4ebe96e7e9 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -399,7 +399,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows relative URLs'); $client = new TestClient(); - $client->setNextResponse(new Response('', 302, array('Location' => 'https://www.example.org/'))); + $client->setNextResponse(new Response('', 302, array('Location' => '//www.example.org/'))); $client->request('GET', 'https://www.example.com/'); $this->assertEquals('https://www.example.org/', $client->getRequest()->getUri(), '->followRedirect() follows protocol-relative URLs');