浏览代码

fixing bug #6914: Config Param 'overwritecondaddr' not working

- just ignoring/removing extra parameter 'protocol' as suggested by
  blizzz

Signed-off-by: Pavel Kryl <pavel@kryl.eu>
tags/v29.0.0beta1
Pavel Kryl 2 年前
父节点
当前提交
446ecbc454
共有 1 个文件被更改,包括 4 次插入6 次删除
  1. 4
    6
      lib/private/AppFramework/Http/Request.php

+ 4
- 6
lib/private/AppFramework/Http/Request.php 查看文件

@@ -294,7 +294,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @return string
*/
public function getHeader(string $name): string {
$name = strtoupper(str_replace('-', '_', $name));
$name = strtoupper(str_replace('-', '_',$name));
if (isset($this->server['HTTP_' . $name])) {
return $this->server['HTTP_' . $name];
}
@@ -622,14 +622,12 @@ class Request implements \ArrayAccess, \Countable, IRequest {

/**
* Check overwrite condition
* @param string $type
* @return bool
*/
private function isOverwriteCondition(string $type = ''): bool {
private function isOverwriteCondition(): bool {
$regex = '/' . $this->config->getSystemValueString('overwritecondaddr', '') . '/';
$remoteAddr = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '';
return $regex === '//' || preg_match($regex, $remoteAddr) === 1
|| $type !== 'protocol';
return $regex === '//' || preg_match($regex, $remoteAddr) === 1;
}

/**
@@ -639,7 +637,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
*/
public function getServerProtocol(): string {
if ($this->config->getSystemValueString('overwriteprotocol') !== ''
&& $this->isOverwriteCondition('protocol')) {
&& $this->isOverwriteCondition()) {
return $this->config->getSystemValueString('overwriteprotocol');
}


正在加载...
取消
保存