aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_bosh.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-15 17:22:49 +0100
committerKim Alvefur <zash@zash.se>2018-03-15 17:22:49 +0100
commit4cdc813fed0cd2dfa6c3c9954650d581b9b90ee3 (patch)
tree347ac5acccc29008853044f7066673341fc1e7b6 /plugins/mod_bosh.lua
parentcdd71f28aca6e776e54f7518069122b5dd637bf0 (diff)
downloadprosody-4cdc813fed0cd2dfa6c3c9954650d581b9b90ee3.tar.gz
prosody-4cdc813fed0cd2dfa6c3c9954650d581b9b90ee3.zip
mod_http: Set request.ip on all HTTP requests (moves code out of mod_bosh) (fixes #540)
Diffstat (limited to 'plugins/mod_bosh.lua')
-rw-r--r--plugins/mod_bosh.lua18
1 files changed, 1 insertions, 17 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index 5e7701a3..880a8235 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -46,22 +46,6 @@ local cross_domain = module:get_option("cross_domain_bosh", false);
if cross_domain == true then cross_domain = "*"; end
if type(cross_domain) == "table" then cross_domain = table.concat(cross_domain, ", "); end
-local trusted_proxies = module:get_option_set("trusted_proxies", { "127.0.0.1", "::1" })._items;
-
-local function get_ip_from_request(request)
- local ip = request.conn:ip();
- local forwarded_for = request.headers.x_forwarded_for;
- if forwarded_for then
- forwarded_for = forwarded_for..", "..ip;
- for forwarded_ip in forwarded_for:gmatch("[^%s,]+") do
- if not trusted_proxies[forwarded_ip] then
- ip = forwarded_ip;
- end
- end
- end
- return ip;
-end
-
local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
-- All sessions, and sessions that have no requests open
@@ -307,7 +291,7 @@ function stream_callbacks.streamopened(context, attr)
requests = { }, send_buffer = {}, reset_stream = bosh_reset_stream,
close = bosh_close_stream, dispatch_stanza = core_process_stanza, notopen = true,
log = logger.init("bosh"..sid), secure = consider_bosh_secure or request.secure,
- ip = get_ip_from_request(request);
+ ip = request.ip;
};
sessions[sid] = session;