From 49590af656bc7f17fc8f8a7752b6ad4cade46325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draic=20Brady?= Date: Sun, 23 Feb 2014 22:49:26 +0000 Subject: [PATCH] $originUrl passed to RemoteFilesystem is actually a HOST string already (so far!) --- src/Composer/Command/DiagnoseCommand.php | 5 ++--- src/Composer/Util/ConfigValidator.php | 2 +- src/Composer/Util/RemoteFilesystem.php | 6 +++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index 1d2450630..284ff3afd 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -50,7 +50,6 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { - $this->rfs = new RemoteFilesystem($this->getIO()); $this->process = new ProcessExecutor($this->getIO()); $output->write('Checking platform settings: '); @@ -157,7 +156,7 @@ EOT $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$config->get('cafile'))); } try { - $remoteFilesystem = new RemoteFilesystem($this->getIO(), $remoteFilesystemOptions, $disableTls); + $this->rfs = new RemoteFilesystem($this->getIO(), $remoteFilesystemOptions, $disableTls); } catch (TransportException $e) { if (preg_match('|cafile|', $e->getMessage())) { $result[] = '[' . get_class($e) . '] ' . $e->getMessage() . ''; @@ -169,7 +168,7 @@ EOT } try { - $json = $remoteFilesystem->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false, array(), $disableTls); + $json = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false, array(), $disableTls); } catch (\Exception $e) { array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage()); } diff --git a/src/Composer/Util/ConfigValidator.php b/src/Composer/Util/ConfigValidator.php index 5bd915388..408342940 100644 --- a/src/Composer/Util/ConfigValidator.php +++ b/src/Composer/Util/ConfigValidator.php @@ -50,7 +50,7 @@ class ConfigValidator // validate json schema $laxValid = false; try { - $json = new JsonFile($file, new RemoteFilesystem($this->io)); + $json = new JsonFile($file, new RemoteFilesystem($this->io)); //TODO $manifest = $json->read(); $json->validateSchema(JsonFile::LAX_SCHEMA); diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index ff2e94c31..6d809830f 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -342,7 +342,11 @@ class RemoteFilesystem // Setup remaining TLS options - the matching may need monitoring, esp. www vs none in CN if ($disableTls === false) { - $host = parse_url($originUrl, PHP_URL_HOST); + if (!preg_match("|^https?://|", $originUrl)) { + $host = $originUrl; + } else { + $host = parse_url($originUrl, PHP_URL_HOST); + } $this->options['ssl']['CN_match'] = $host; $this->options['ssl']['SNI_server_name'] = $host; }