diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index ea42c9a89672c4f9fd97d6fdcbe06b4ddd8b4570..2bbb70db0f82e2a67936f51bf69a9e98bddaffbb 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 ab5fe15444130b2e602c2465e38ff9cd8efb92a0..92a2cc01dd2d5f543cac574f0aea772254a96443 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())