1
0
Fork 0

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

pull/2745/head
Pádraic Brady 2014-02-23 22:49:26 +00:00
parent 0a8180674e
commit 49590af656
3 changed files with 8 additions and 5 deletions

View File

@ -50,7 +50,6 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$this->rfs = new RemoteFilesystem($this->getIO());
$this->process = new ProcessExecutor($this->getIO()); $this->process = new ProcessExecutor($this->getIO());
$output->write('Checking platform settings: '); $output->write('Checking platform settings: ');
@ -157,7 +156,7 @@ EOT
$remoteFilesystemOptions = array('ssl'=>array('cafile'=>$config->get('cafile'))); $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$config->get('cafile')));
} }
try { try {
$remoteFilesystem = new RemoteFilesystem($this->getIO(), $remoteFilesystemOptions, $disableTls); $this->rfs = new RemoteFilesystem($this->getIO(), $remoteFilesystemOptions, $disableTls);
} catch (TransportException $e) { } catch (TransportException $e) {
if (preg_match('|cafile|', $e->getMessage())) { if (preg_match('|cafile|', $e->getMessage())) {
$result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>'; $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
@ -169,7 +168,7 @@ EOT
} }
try { 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) { } catch (\Exception $e) {
array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage()); array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
} }

View File

@ -50,7 +50,7 @@ class ConfigValidator
// validate json schema // validate json schema
$laxValid = false; $laxValid = false;
try { try {
$json = new JsonFile($file, new RemoteFilesystem($this->io)); $json = new JsonFile($file, new RemoteFilesystem($this->io)); //TODO
$manifest = $json->read(); $manifest = $json->read();
$json->validateSchema(JsonFile::LAX_SCHEMA); $json->validateSchema(JsonFile::LAX_SCHEMA);

View File

@ -342,7 +342,11 @@ class RemoteFilesystem
// Setup remaining TLS options - the matching may need monitoring, esp. www vs none in CN // Setup remaining TLS options - the matching may need monitoring, esp. www vs none in CN
if ($disableTls === false) { 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']['CN_match'] = $host;
$this->options['ssl']['SNI_server_name'] = $host; $this->options['ssl']['SNI_server_name'] = $host;
} }