Преглед изворни кода

$originUrl passed to RemoteFilesystem is actually a HOST string already (so far!)

Pádraic Brady пре 11 година
родитељ
комит
49590af656

+ 2 - 3
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[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
@@ -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());
         }

+ 1 - 1
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);

+ 5 - 1
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;
         }