aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/server.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-02-27 21:37:16 +0100
committerKim Alvefur <zash@zash.se>2021-02-27 21:37:16 +0100
commit2acba6238860aaf3e323b12ddcd6d89d6644b486 (patch)
tree71f368914e78246814265e0cf28e168908db1af0 /net/http/server.lua
parentd8bcee69f3b287f8948604e72f76cf543cac33a0 (diff)
downloadprosody-2acba6238860aaf3e323b12ddcd6d89d6644b486.tar.gz
prosody-2acba6238860aaf3e323b12ddcd6d89d6644b486.zip
net.http.server: Set request.ip so mod_http doesn't have to
Because it already sets request.secure, which depends on the connection, just like the IP, so it makes sense to do both in the same place. Dealing with proxies can be left to mod_http for now, but maybe it could move into some util some day?
Diffstat (limited to 'net/http/server.lua')
-rw-r--r--net/http/server.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index df87283a..ab71dbc9 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -113,6 +113,7 @@ local function noop() end
function listener.onconnect(conn)
local session = { conn = conn };
local secure = conn:ssl() and true or nil;
+ local ip = conn:ip();
session.thread = async.runner(function (request)
local wait, done;
if request.partial == true then
@@ -127,6 +128,7 @@ function listener.onconnect(conn)
end, runner_callbacks, session);
local function success_cb(request)
--log("debug", "success_cb: %s", request.path);
+ request.ip = ip;
request.secure = secure;
session.thread:run(request);
end