1
0
Fork 0

Fix line endings

pull/308/head
Jordi Boggiano 2012-02-17 11:50:36 +01:00
parent d0f6b679bc
commit db03b7bbbd
2 changed files with 19 additions and 18 deletions

View File

@ -1,4 +1,5 @@
<?php
/*
* This file is part of Composer.
*

View File

@ -22,8 +22,8 @@ class RemoteFilesystem
private $io;
private $firstCall;
private $bytesMax;
private $originUrl;
private $fileUrl;
private $originUrl;
private $fileUrl;
private $fileName;
private $content;
private $progess;
@ -81,26 +81,26 @@ class RemoteFilesystem
{
$this->firstCall = true;
$this->bytesMax = 0;
$this->content = null;
$this->originUrl = $originUrl;
$this->fileUrl = $fileUrl;
$this->content = null;
$this->originUrl = $originUrl;
$this->fileUrl = $fileUrl;
$this->fileName = $fileName;
$this->progress = $progess;
$this->progress = $progess;
// add authorization in context
$options = array();
if ($this->io->hasAuthorization($originUrl)) {
if ($this->io->hasAuthorization($originUrl)) {
$auth = $this->io->getAuthorization($originUrl);
$authStr = base64_encode($auth['username'] . ':' . $auth['password']);
$options['http']['header'] = "Authorization: Basic $authStr\r\n";
} else if (null !== $this->io->getLastUsername()) {
$authStr = base64_encode($this->io->getLastUsername() . ':' . $this->io->getLastPassword());
$options['http'] = array('header' => "Authorization: Basic $authStr\r\n");
$this->io->setAuthorization($originUrl, $this->io->getLastUsername(), $this->io->getLastPassword());
}
$ctx = StreamContextFactory::getContext($options, array('notification' => array($this, 'callbackGet')));
} else if (null !== $this->io->getLastUsername()) {
$authStr = base64_encode($this->io->getLastUsername() . ':' . $this->io->getLastPassword());
$options['http'] = array('header' => "Authorization: Basic $authStr\r\n");
$this->io->setAuthorization($originUrl, $this->io->getLastUsername(), $this->io->getLastPassword());
}
$ctx = StreamContextFactory::getContext($options, array('notification' => array($this, 'callbackGet')));
if ($this->progress) {
$this->io->overwrite(" Downloading: <comment>connection...</comment>", false);
}
@ -110,8 +110,8 @@ class RemoteFilesystem
} else {
$result = @file_get_contents($fileUrl, false, $ctx);
$this->content = $result;
}
}
if ($this->progress) {
$this->io->overwrite(" Downloading", false);
}