mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
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?
This commit is contained in:
parent
d8bcee69f3
commit
2acba62388
2 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue