Skip to content

Commit

Permalink
fixing bug #6914: Config Param 'overwritecondaddr' not working
Browse files Browse the repository at this point in the history
- just ignoring/removing extra parameter 'protocol' as suggested by
  blizzz

Signed-off-by: Pavel Kryl <pavel@kryl.eu>
  • Loading branch information
pavelkryl authored and blizzz committed Jan 18, 2024
1 parent 24dc742 commit 39abec6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/private/AppFramework/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function __unset($id) {
* @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];
}
Expand Down Expand Up @@ -622,14 +622,12 @@ public function getRemoteAddress(): string {

/**
* 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;
}

/**
Expand All @@ -639,7 +637,7 @@ private function isOverwriteCondition(string $type = ''): bool {
*/
public function getServerProtocol(): string {
if ($this->config->getSystemValueString('overwriteprotocol') !== ''
&& $this->isOverwriteCondition('protocol')) {
&& $this->isOverwriteCondition()) {
return $this->config->getSystemValueString('overwriteprotocol');
}

Expand Down

0 comments on commit 39abec6

Please sign in to comment.