diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 87369dcaf..1b3ee0324 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -69,6 +69,8 @@ class CreateProjectCommand extends Command new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'), new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'), new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'), + new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'), + new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'), )) ->setHelp(<<create-project command creates a new project from a given diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index 4912351e6..e88b2cfe2 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -152,10 +152,8 @@ EOT } $rfsOptions = array(); - if ($disableTls) { - if (!is_null($config->get('cafile'))) { + if (!$disableTls && !is_null($config->get('cafile'))) { $rfsOptions = array('ssl'=>array('cafile'=>$config->get('cafile'))); - } } try { $this->rfs = new RemoteFilesystem($this->getIO(), $rfsOptions, $disableTls); diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index ac220fdf0..00b4fc0a8 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -45,6 +45,8 @@ class InstallCommand extends Command new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'), new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'), new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'), + new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'), + new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'), new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'), )) ->setHelp(<<setDescription('Search for packages') ->setDefinition(array( new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'), + new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'), + new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'), new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'), )) ->setHelp(<<get('cafile'))) { - $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$config->get('cafile'))); + $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$config->get('cafile'))); } if (!is_null($input->getOption('cafile'))) { $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$input->getOption('cafile'))); diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 4b5b6ee9c..a231c84a4 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -50,6 +50,8 @@ class ShowCommand extends Command new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'), new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'), new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'), + new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'), + new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'), )) ->setHelp(<<setHelp(<<update command reads the composer.json file from the diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index f2bccd70c..91cb0b420 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -207,10 +207,8 @@ class Factory } $rfsOptions = array(); - if ($disableTls === false) { - if (!is_null($input->getOption('cafile'))) { + if ($disableTls === false && !is_null($input->getOption('cafile'))) { $rfsOptions = array('ssl'=>array('cafile'=>$input->getOption('cafile'))); - } } $rfs = new RemoteFilesystem($io, $rfsOptions, $disableTls); }