Software /
code /
prosody
Diff
net/http/server.lua @ 11409:d30c44a829c1
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?
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 27 Feb 2021 21:37:16 +0100 |
parent | 11373:ad3b5384fc03 |
child | 11527:eaff6e548f12 |
line wrap: on
line diff
--- a/net/http/server.lua Sat Feb 27 21:07:36 2021 +0100 +++ b/net/http/server.lua Sat Feb 27 21:37:16 2021 +0100 @@ -113,6 +113,7 @@ 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 @@ 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