Merge pull request #20782 from mitar/better-https
Also allow empty value for no-HTTPS
This commit is contained in:
commit
bdbefe17d6
|
@ -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…
Reference in New Issue