Fix line endings
parent
d0f6b679bc
commit
db03b7bbbd
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue