Fix line endings

main
Jordi Boggiano 13 years ago
parent d0f6b679bc
commit db03b7bbbd

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

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

Loading…
Cancel
Save