From 59511d97ee4a93dd34bd56e0607f18d71edd7a9c Mon Sep 17 00:00:00 2001 From: Mitar Date: Fri, 27 Nov 2015 01:01:56 -0800 Subject: [PATCH 1/2] Also allow empty value for no-HTTPS. This makes it work better with old version of Nginx. --- lib/private/appframework/http/request.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index ea42c9a896..2bbb70db0f 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'; } From e0e51fd79fded941ce307e3b937e5f634b4e0550 Mon Sep 17 00:00:00 2001 From: Mitar Date: Fri, 27 Nov 2015 02:45:49 -0800 Subject: [PATCH 2/2] Added tests. --- tests/lib/appframework/http/RequestTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index ab5fe15444..92a2cc01dd 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())