1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Add HTTPS_PROXY_REQUEST_FULLURI to disable the request_fulluri only for https requests, fixes #1946, fixes #1839

This commit is contained in:
Jordi Boggiano 2013-05-30 14:58:26 +02:00
parent c0679232e2
commit 1debe22412
6 changed files with 65 additions and 21 deletions

View file

@ -33,7 +33,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
*/
public function testGetContext($expectedOptions, $defaultOptions, $expectedParams, $defaultParams)
{
$context = StreamContextFactory::getContext($defaultOptions, $defaultParams);
$context = StreamContextFactory::getContext('http://example.org', $defaultOptions, $defaultParams);
$options = stream_context_get_options($context);
$params = stream_context_get_params($context);
@ -60,7 +60,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
$_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/';
$_SERVER['HTTP_PROXY'] = 'http://proxyserver/';
$context = StreamContextFactory::getContext(array('http' => array('method' => 'GET')));
$context = StreamContextFactory::getContext('http://example.org', array('http' => array('method' => 'GET')));
$options = stream_context_get_options($context);
$this->assertEquals(array('http' => array(
@ -77,7 +77,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
{
$_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/';
$context = StreamContextFactory::getContext(array('http' => array('method' => 'GET', 'header' => array("X-Foo: bar"), 'request_fulluri' => false)));
$context = StreamContextFactory::getContext('http://example.org', array('http' => array('method' => 'GET', 'header' => array("X-Foo: bar"), 'request_fulluri' => false)));
$options = stream_context_get_options($context);
$this->assertEquals(array('http' => array(
@ -94,7 +94,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
{
$_SERVER['http_proxy'] = 'http://username:password@proxyserver.net';
$context = StreamContextFactory::getContext(array('http' => array('method' => 'GET')));
$context = StreamContextFactory::getContext('http://example.org', array('http' => array('method' => 'GET')));
$options = stream_context_get_options($context);
$this->assertEquals(array('http' => array(
@ -115,7 +115,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
$_SERVER['http_proxy'] = $proxy;
if (extension_loaded('openssl')) {
$context = StreamContextFactory::getContext();
$context = StreamContextFactory::getContext('http://example.org');
$options = stream_context_get_options($context);
$this->assertEquals(array('http' => array(
@ -161,7 +161,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
)
)
);
$context = StreamContextFactory::getContext($options);
$context = StreamContextFactory::getContext('http://example.org', $options);
$ctxoptions = stream_context_get_options($context);
$this->assertEquals(join("\n", $ctxoptions['http']['header']), join("\n", $expectedOptions['http']['header']));
}