summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-11-02 10:13:41 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-11-02 10:13:41 +0100
commitb6ca23afe13304f904811d510a8e843a4ea832e9 (patch)
treeb1c7b9b34938936513ee9731892a3cea09784689
parent2afc14e19578c67a2cc4a631d12bc5d5f630735e (diff)
parentbafb86fb9fce1ad4457c6e2f7aba9604e33908ce (diff)
downloadnextcloud-server-b6ca23afe13304f904811d510a8e843a4ea832e9.tar.gz
nextcloud-server-b6ca23afe13304f904811d510a8e843a4ea832e9.zip
Merge pull request #20189 from owncloud/use-get-http-protocol
Use getHttpProtocol instead of $_SERVER
-rw-r--r--lib/private/appframework/dependencyinjection/dicontainer.php9
-rw-r--r--lib/private/appframework/http.php1
-rw-r--r--lib/private/response.php2
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php
index b71ca71391d..b0be4045541 100644
--- a/lib/private/appframework/dependencyinjection/dicontainer.php
+++ b/lib/private/appframework/dependencyinjection/dicontainer.php
@@ -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) {
diff --git a/lib/private/appframework/http.php b/lib/private/appframework/http.php
index 89f6f70f4e7..e64759fa924 100644
--- a/lib/private/appframework/http.php
+++ b/lib/private/appframework/http.php
@@ -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) {
diff --git a/lib/private/response.php b/lib/private/response.php
index 2cd1d990e51..b0eb8adc4d5 100644
--- a/lib/private/response.php
+++ b/lib/private/response.php
@@ -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';