changeset 2967:135ca695fcbf

mod_http_logging: Use 'ip' field provided by mod_http if available
author Kim Alvefur <zash@zash.se>
date Fri, 30 Mar 2018 13:36:38 +0200 (2018-03-30)
parents 678be8ea4d38
children 569b98d6fca1
files mod_http_logging/mod_http_logging.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_logging/mod_http_logging.lua	Fri Mar 30 13:35:43 2018 +0200
+++ b/mod_http_logging/mod_http_logging.lua	Fri Mar 30 13:36:38 2018 +0200
@@ -24,7 +24,7 @@
 local function log_response(response, body)
 	local len = tostring(get_content_len(response, body) or "-");
 	local request = response.request;
-	local ip = request.conn:ip();
+	local ip = request.ip or request.conn:ip();
 	local req = string.format("%s %s HTTP/%s", request.method, request.path, request.httpversion);
 	local date = os.date("%d/%m/%Y:%H:%M:%S %z");
 	module:log("info", "%s - - [%s] \"%s\" %d %s", ip, date, req, response.status_code, len);