Software /
code /
prosody
Comparison
plugins/mod_bosh.lua @ 4998:f6c1f98419be
mod_bosh: Use new format for headers when checking for proxies to get the originating IP
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 23 Jul 2012 23:05:32 +0200 |
parent | 4880:6d96e2e717c1 |
child | 5013:ab693eea0869 |
comparison
equal
deleted
inserted
replaced
4997:61083e2b1392 | 4998:f6c1f98419be |
---|---|
54 | 54 |
55 local trusted_proxies = module:get_option_set("trusted_proxies", {"127.0.0.1"})._items; | 55 local trusted_proxies = module:get_option_set("trusted_proxies", {"127.0.0.1"})._items; |
56 | 56 |
57 local function get_ip_from_request(request) | 57 local function get_ip_from_request(request) |
58 local ip = request.conn:ip(); | 58 local ip = request.conn:ip(); |
59 local forwarded_for = request.headers["x-forwarded-for"]; | 59 local forwarded_for = request.headers.x_forwarded_for; |
60 if forwarded_for then | 60 if forwarded_for then |
61 forwarded_for = forwarded_for..", "..ip; | 61 forwarded_for = forwarded_for..", "..ip; |
62 for forwarded_ip in forwarded_for:gmatch("[^%s,]+") do | 62 for forwarded_ip in forwarded_for:gmatch("[^%s,]+") do |
63 if not trusted_proxies[forwarded_ip] then | 63 if not trusted_proxies[forwarded_ip] then |
64 ip = forwarded_ip; | 64 ip = forwarded_ip; |