Skip to content

Commit

Permalink
Merge branch 'QA_5_0'
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Feb 11, 2020
2 parents 55fcbe1 + 71a02a9 commit 349a2f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libraries/classes/Util.php
Expand Up @@ -3181,8 +3181,9 @@ public static function getProtoFromForwardedHeader(string $headerContents): stri
$keyName,
$value,
] = $keyValueArray;
$value = trim(strtolower($value));
if (strtolower(trim($keyName)) === 'proto' && in_array($value, ['http', 'https'])) {
return empty($value) ? '' : $value;
return $value;
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions test/classes/UtilTest.php
Expand Up @@ -1820,6 +1820,18 @@ public function providerForwardedHeaders(): array
'for=192.0.2.60;proto=http;by=203.0.113.43',
'http',
],
[
'for=192.0.2.60;proto=htTp;by=203.0.113.43',
'http',
],
[
'for=192.0.2.60;proto=HTTP;by=203.0.113.43',
'http',
],
[
'for=192.0.2.60;proto= http;by=203.0.113.43',
'http',
],
[
'for=12.34.45.67;secret="special;proto=abc;test=1";proto=http,for=23.45.67.89',
'http',
Expand Down

0 comments on commit 349a2f1

Please sign in to comment.