1
0
Fork 0

Update bundled CAfile and other cleanups

pull/4759/head
Jordi Boggiano 2016-01-10 16:37:46 +00:00
parent f8dff0867c
commit 86a911150b
8 changed files with 761 additions and 644 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,6 @@ use Composer\Util\RemoteFilesystem;
use Composer\Util\StreamContextFactory; use Composer\Util\StreamContextFactory;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
/** /**
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>

View File

@ -17,7 +17,6 @@ use Composer\Factory;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\RemoteFilesystem; use Composer\Util\RemoteFilesystem;
use Composer\Downloader\FilesystemException; use Composer\Downloader\FilesystemException;
use Composer\Downloader\TransportException;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;

View File

@ -13,7 +13,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Config; use Composer\Config;
use Composer\Factory;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;

View File

@ -25,6 +25,7 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Composer\EventDispatcher\EventDispatcher; use Composer\EventDispatcher\EventDispatcher;
use Composer\Autoload\AutoloadGenerator; use Composer\Autoload\AutoloadGenerator;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
use Composer\Downloader\TransportException;
use Seld\JsonLint\JsonParser; use Seld\JsonLint\JsonParser;
/** /**
@ -174,7 +175,7 @@ class Factory
if (!isset($repo['type'])) { if (!isset($repo['type'])) {
throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined'); throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
} }
$name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index; //CHECK: Why is scheme stripped? $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
while (isset($repos[$name])) { while (isset($repos[$name])) {
$name .= '2'; $name .= '2';
} }
@ -205,6 +206,8 @@ class Factory
$localConfig = static::getComposerFile(); $localConfig = static::getComposerFile();
} }
$rfs = Factory::createRemoteFilesystem($io);
if (is_string($localConfig)) { if (is_string($localConfig)) {
$composerFile = $localConfig; $composerFile = $localConfig;
@ -516,12 +519,12 @@ class Factory
public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array()) public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
{ {
$disableTls = false; $disableTls = false;
if ((isset($config) && $config->get('disable-tls') === true) || $io->getInputOption('disable-tls')) { if (isset($config) && $config->get('disable-tls') === true) {
$io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>'); $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
$disableTls = true; $disableTls = true;
} elseif (!extension_loaded('openssl')) { } elseif (!extension_loaded('openssl')) {
throw new \RuntimeException('The openssl extension is required for SSL/TLS protection but is not available. ' throw new \RuntimeException('The openssl extension is required for SSL/TLS protection but is not available. '
. 'You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.'); . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
} }
$remoteFilesystemOptions = array(); $remoteFilesystemOptions = array();
if ($disableTls === false) { if ($disableTls === false) {
@ -533,7 +536,7 @@ class Factory
try { try {
$remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls); $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
} catch (TransportException $e) { } catch (TransportException $e) {
if (preg_match('|cafile|', $e->getMessage())) { if (preg_match('{cafile}', $e->getMessage())) {
$io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>'); $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
$io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>'); $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
if (PHP_VERSION_ID < 50600) { if (PHP_VERSION_ID < 50600) {

View File

@ -86,20 +86,4 @@ abstract class BaseIO implements IOInterface
// setup process timeout // setup process timeout
ProcessExecutor::setTimeout((int) $config->get('process-timeout')); ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
} }
/**
* {@inheritDoc}
*/
public function getInputOption($optionName)
{
return $this->input->getOption($optionName);
}
/**
* {@inheritDoc}
*/
public function getInputArgument($ArgumentName)
{
return $this->input->getArgument($argumentName);
}
} }

View File

@ -179,22 +179,4 @@ interface IOInterface
* @param Config $config * @param Config $config
*/ */
public function loadConfiguration(Config $config); public function loadConfiguration(Config $config);
/**
* Get the value of an input option
*
* @param string $optionName The name of the option whose value is to be retrieved
*
* @return mixed
*/
public function getInputOption($optionName);
/**
* Get the value of an input argument
*
* @param string $argumentName The name of the argument whose value is to be retrieved
*
* @return mixed
*/
public function getInputArgument($argumentName);
} }

View File

@ -118,20 +118,4 @@ class NullIO extends BaseIO
{ {
return null; return null;
} }
/**
* {@inheritDoc}
*/
public function getInputOption($optionName)
{
return null;
}
/**
* {@inheritDoc}
*/
public function getInputArgument($ArgumentName)
{
return null;
}
} }