Commit c3a9273b authored by skummer's avatar skummer

ZP-328 #comment process X-Forwarded-For header and use as remote IP if enabled...

ZP-328 #comment process X-Forwarded-For header and use as remote IP if enabled in config (default disabled) #time 1h

git-svn-id: https://z-push.org/svn/z-push/trunk@1666 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 576591ef
...@@ -53,9 +53,11 @@ ...@@ -53,9 +53,11 @@
// Try to set unlimited timeout // Try to set unlimited timeout
define('SCRIPT_TIMEOUT', 0); define('SCRIPT_TIMEOUT', 0);
//Max size of attachments to display inline. Default is 2 MB // Max size of attachments to display inline. Default is 2 MB
define('MAX_EMBEDDED_SIZE', 2097152); define('MAX_EMBEDDED_SIZE', 2097152);
// When accessing through a proxy, the "X-Forwarded-For" header contains the original remote IP
define('USE_X_FORWARDED_FOR_HEADER', false);
/********************************************************************************** /**********************************************************************************
* Default FileStateMachine settings * Default FileStateMachine settings
...@@ -249,4 +251,4 @@ ...@@ -249,4 +251,4 @@
*/ */
); );
?> ?>
\ No newline at end of file
...@@ -211,6 +211,14 @@ class Request { ...@@ -211,6 +211,14 @@ class Request {
} }
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Request::ProcessHeaders() ASVersion: %s", self::$asProtocolVersion)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("Request::ProcessHeaders() ASVersion: %s", self::$asProtocolVersion));
if (defined('USE_X_FORWARDED_FOR_HEADER') && USE_X_FORWARDED_FOR_HEADER == true && isset(self::$headers["x-forwarded-for"])) {
$forwardedIP = self::filterEvilInput(self::$headers["x-forwarded-for"], self::NUMBERSDOT_ONLY);
if ($forwardedIP) {
self::$remoteAddr = $forwardedIP;
ZLog::Write(LOGLEVEL_INFO, sprintf("'X-Forwarded-for' indicates remote IP: %s", self::$remoteAddr));
}
}
} }
/** /**
......
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