# HG changeset patch # User Kim Alvefur # Date 1613641264 -3600 # Node ID c81b6b8c6b193f1aa7541f3e752d7b15afcc8f10 # Parent f9edf26c66fccd229ee660f74d317fd8a5b24476 mod_http: Optimize proxy IP check No need to do a subnet match comparison to see if two IP addresses match exactly. diff -r f9edf26c66fc -r c81b6b8c6b19 plugins/mod_http.lua --- a/plugins/mod_http.lua Thu Feb 18 10:05:30 2021 +0100 +++ b/plugins/mod_http.lua Thu Feb 18 10:41:04 2021 +0100 @@ -223,6 +223,9 @@ 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