diff options
-rw-r--r-- | lib/private/appframework/http/request.php | 3 | ||||
-rw-r--r-- | tests/lib/appframework/http/RequestTest.php | 20 |
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()) |