Use getHttpProtocol instead of $_SERVER

This commit is contained in:
Lukas Reschke 2015-10-30 18:05:30 +01:00
parent 6911d8f0a4
commit bafb86fb9f
3 changed files with 6 additions and 6 deletions

View File

@ -252,11 +252,10 @@ class DIContainer extends SimpleContainer implements IAppContainer {
});
$this->registerService('Protocol', function($c){
if(isset($_SERVER['SERVER_PROTOCOL'])) {
return new Http($_SERVER, $_SERVER['SERVER_PROTOCOL']);
} else {
return new Http($_SERVER);
}
/** @var \OC\Server $server */
$server = $c->query('ServerContainer');
$protocol = $server->getRequest()->getHttpProtocol();
return new Http($_SERVER, $protocol);
});
$this->registerService('Dispatcher', function($c) {

View File

@ -112,6 +112,7 @@ class Http extends BaseHttp {
* @param Http::CONSTANT $status the constant from the Http class
* @param \DateTime $lastModified formatted last modified date
* @param string $ETag the etag
* @return string
*/
public function getStatusHeader($status, \DateTime $lastModified=null,
$ETag=null) {

View File

@ -74,7 +74,7 @@ class OC_Response {
* @param int $status a HTTP status code, see also the STATUS constants
*/
static public function setStatus($status) {
$protocol = $_SERVER['SERVER_PROTOCOL'];
$protocol = \OC::$server->getRequest()->getHttpProtocol();
switch($status) {
case self::STATUS_NOT_MODIFIED:
$status = $status . ' Not Modified';