Fixed X-Forwarded-Host parsing

This commit is contained in:
Vincent Petry 2014-03-05 17:04:45 +01:00
parent c7e204bd36
commit 9136e6ad30
1 changed files with 2 additions and 1 deletions

View File

@ -58,7 +58,8 @@ class OC_Request {
$host = null; $host = null;
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ",") !== false) { if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ",") !== false) {
$host = trim(array_pop(explode(",", $_SERVER['HTTP_X_FORWARDED_HOST']))); $parts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
$host = trim(current($parts));
} else { } else {
$host = $_SERVER['HTTP_X_FORWARDED_HOST']; $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
} }