From 9a69886a92606fc5a2ae0ffd9653dd3d3a681488 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 5 Apr 2013 12:48:15 +0200 Subject: [PATCH] Add default http options to stream context, fixes #1774 --- src/Composer/Util/StreamContextFactory.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Composer/Util/StreamContextFactory.php b/src/Composer/Util/StreamContextFactory.php index fb0875643..907447067 100644 --- a/src/Composer/Util/StreamContextFactory.php +++ b/src/Composer/Util/StreamContextFactory.php @@ -30,7 +30,11 @@ final class StreamContextFactory */ public static function getContext(array $defaultOptions = array(), array $defaultParams = array()) { - $options = array('http' => array()); + $options = array('http' => array( + // specify defaults again to try and work better with curlwrappers enabled + 'follow_location' => 1, + 'max_redirects' => 20, + )); // Handle system proxy if (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy'])) { @@ -57,10 +61,8 @@ final class StreamContextFactory throw new \RuntimeException('You must enable the openssl extension to use a proxy over https'); } - $options['http'] = array( - 'proxy' => $proxyURL, - 'request_fulluri' => true, - ); + $options['http']['proxy'] = $proxyURL; + $options['http']['request_fulluri'] = true; if (isset($proxy['user'])) { $auth = $proxy['user'];