Merge pull request #20782 from mitar/better-https

Also allow empty value for no-HTTPS
remotes/origin/fix-delete-homeidr-on-userdelete
Thomas Müller 11 years ago
commit bdbefe17d6
  1. 3
      lib/private/appframework/http/request.php
  2. 20
      tests/lib/appframework/http/RequestTest.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';
}

@ -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())

Loading…
Cancel
Save