fixed protocol-relative URLs
This commit is contained in:
parent
289da16681
commit
d9cf28d016
@ -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;
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user