summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-11-27 14:24:23 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-11-27 14:24:23 +0100
commitbdbefe17d6ae2d41d990db7bf4c905ff4f40b46b (patch)
tree3d3e3339f12e6c322ec5d5b503fc705253f165eb
parentdf4bd322b20009b50b9cdb8897cf5295732147ae (diff)
parente0e51fd79fded941ce307e3b937e5f634b4e0550 (diff)
downloadnextcloud-server-bdbefe17d6ae2d41d990db7bf4c905ff4f40b46b.tar.gz
nextcloud-server-bdbefe17d6ae2d41d990db7bf4c905ff4f40b46b.zip
Merge pull request #20782 from mitar/better-https
Also allow empty value for no-HTTPS
-rw-r--r--lib/private/appframework/http/request.php3
-rw-r--r--tests/lib/appframework/http/RequestTest.php20
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index ea42c9a8967..2bbb70db0f8 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -541,7 +541,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
if (isset($this->server['HTTPS'])
&& $this->server['HTTPS'] !== null
- && $this->server['HTTPS'] !== 'off') {
+ && $this->server['HTTPS'] !== 'off'
+ && $this->server['HTTPS'] !== '') {
return 'https';
}
diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php
index ab5fe154441..92a2cc01dd2 100644
--- a/tests/lib/appframework/http/RequestTest.php
+++ b/tests/lib/appframework/http/RequestTest.php
@@ -648,6 +648,26 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('http', $request->getServerProtocol());
}
+ public function testGetServerProtocolWithHttpsServerValueEmpty() {
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('overwriteprotocol')
+ ->will($this->returnValue(''));
+
+ $request = new Request(
+ [
+ 'server' => [
+ 'HTTPS' => ''
+ ],
+ ],
+ $this->secureRandom,
+ $this->config,
+ $this->stream
+ );
+ $this->assertSame('http', $request->getServerProtocol());
+ }
+
public function testGetServerProtocolDefault() {
$this->config
->expects($this->once())