diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index e36c860b8..3192f47d3 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -41,13 +41,14 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { + $protocol = extension_loaded('openssl') ? 'https' : 'http'; $rfs = new RemoteFilesystem($this->getIO()); - $latest = trim($rfs->getContents('getcomposer.org', 'http://getcomposer.org/version', false)); + $latest = trim($rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false)); if (Composer::VERSION !== $latest) { $output->writeln(sprintf("Updating to version %s.", $latest)); - $remoteFilename = 'http://getcomposer.org/composer.phar'; + $remoteFilename = $protocol . '://getcomposer.org/composer.phar'; $localFilename = $_SERVER['argv'][0]; $tempFilename = basename($localFilename, '.phar').'-temp.phar';