diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 83084d0ae..5904e6a94 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -27,6 +27,7 @@ use Composer\Util\RemoteFilesystem; class ComposerRepository extends ArrayRepository implements NotifiableRepositoryInterface, StreamableRepositoryInterface { protected $config; + protected $options; protected $url; protected $io; protected $cache; @@ -46,7 +47,12 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']); } + if (!isset($repoConfig['options'])) { + $repoConfig['options'] = array(); + } + $this->config = $config; + $this->options = $repoConfig['options']; $this->url = $repoConfig['url']; $this->io = $io; $this->cache = new Cache($io, $config->get('home').'/cache/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url)); @@ -199,7 +205,7 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository $jsonUrl = $this->url . '/packages.json'; } - $json = new JsonFile($jsonUrl, new RemoteFilesystem($this->io)); + $json = new JsonFile($jsonUrl, new RemoteFilesystem($this->io, $this->options)); $data = $json->read(); if (!empty($data['notify'])) { diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index e82313033..f2dfaf842 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -30,15 +30,17 @@ class RemoteFilesystem private $result; private $progress; private $lastProgress; + private $options; /** * Constructor. * * @param IOInterface $io The IO instance */ - public function __construct(IOInterface $io) + public function __construct(IOInterface $io, $options = array()) { $this->io = $io; + $this->options = $options; } /** @@ -241,6 +243,8 @@ class RemoteFilesystem $options['http']['header'] .= "Authorization: Basic $authStr\r\n"; } + $options = array_merge_recursive($options, $this->options); + return $options; } }