8000 fixed protocol-relative URLs · webmozart/symfony@d9cf28d · GitHub
[go: up one dir, main page]

Skip to content

Commit d9cf28d

Browse files
committed
fixed protocol-relative URLs
1 parent 289da16 commit d9cf28d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,8 @@ protected function requestFromRequest(Request $request, $changeHistory = true)
613613
private function updateServerFromUri($server, $uri)
614614
{
615615
$server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST);
616-
$server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME);
616+
$scheme = parse_url($uri, PHP_URL_SCHEME);
617+
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme;
617618
unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']);
618619

619620
return $server;

src/Symfony/Component/BrowserKit/Tests/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ public function testFollowRedirectWithMaxRedirects()
399399
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows relative URLs');
400400

401401
$client = new TestClient();
402-
$client->setNextResponse(new Response('', 302, array('Location' => 'https://www.example.org/')));
402+
$client->setNextResponse(new Response('', 302, array('Location' => '//www.example.org/')));
403403
$client->request('GET', 'https://www.example.com/');
404404

405405
$this->assertEquals('https://www.example.org/', $client->getRequest()->getUri(), '->followRedirect() follows protocol-relative URLs');

0 commit comments

Comments
 (0)
0