Commit 3dfa3443 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1373 Modify custom header so it matches the apache modphp version.

Released under the Affero GNU General Public License (AGPL) version 3.
parent e4f164c3
......@@ -254,13 +254,22 @@ class Request {
}
}
if (defined('USE_CUSTOM_REMOTE_IP_HEADER') && USE_CUSTOM_REMOTE_IP_HEADER !== false && isset(self::$headers[strtolower(USE_CUSTOM_REMOTE_IP_HEADER)])) {
$remoteIP = self::filterIP(self::$headers[strtolower(USE_CUSTOM_REMOTE_IP_HEADER)]);
if (defined('USE_CUSTOM_REMOTE_IP_HEADER') && USE_CUSTOM_REMOTE_IP_HEADER !== false) {
// make custom header compatible with Apache modphp (see ZP-1332)
$header = $apacheHeader = strtolower(USE_CUSTOM_REMOTE_IP_HEADER);
if (substr($apacheHeader, 0, 5) === 'http_') {
$apacheHeader = substr($apacheHeader, 5);
}
$apacheHeader = str_replace("_", "-", $apacheHeader);
if (isset(self::$headers[$header]) || isset(self::$headers[$apacheHeader])) {
$remoteIP = isset(self::$headers[$header]) ? self::$headers[$header] : self::$headers[$apacheHeader];
$remoteIP = self::filterIP($remoteIP);
if ($remoteIP) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Using custom header '%s' to determine remote IP: %s - connect is coming from IP: %s", USE_CUSTOM_REMOTE_IP_HEADER, $remoteIP, self::$remoteAddr));
self::$remoteAddr = $remoteIP;
}
}
}
// Mobile devices send Authorization header using UTF-8 charset. Outlook sends it using ISO-8859-1 encoding.
// For the successful authentication the user and password must be UTF-8 encoded. Try to determine which
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment