diff options
author | Kim Alvefur <zash@zash.se> | 2021-02-18 10:41:04 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-02-18 10:41:04 +0100 |
commit | 0e6a6fff961c238057e93c5ff90e69b6dce0afb0 (patch) | |
tree | 52bb44287aa2167e3a875aebb7a787c315c15717 /plugins | |
parent | 231e87ab054addeb2433ecf6f87b54c641bd8865 (diff) | |
download | prosody-0e6a6fff961c238057e93c5ff90e69b6dce0afb0.tar.gz prosody-0e6a6fff961c238057e93c5ff90e69b6dce0afb0.zip |
mod_http: Optimize proxy IP check
No need to do a subnet match comparison to see if two IP addresses match
exactly.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 3d2c4443..b9c0c1a4 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -223,6 +223,9 @@ module.add_host(module); -- set up handling on global context too local trusted_proxies = module:get_option_set("trusted_proxies", { "127.0.0.1", "::1" })._items; local function is_trusted_proxy(ip) + if trusted_proxies[ip] then + return true; + end local parsed_ip = new_ip(ip) for trusted_proxy in trusted_proxies do if match_ip(parsed_ip, parse_cidr(trusted_proxy)) then |