comparison mod_firewall/conditions.lib.lua @ 2074:86427261e3c4

mod_firewall: Use string.find in JID match, faster since the result is unused
author Kim Alvefur <zash@zash.se>
date Fri, 11 Mar 2016 18:18:35 +0100
parents de15606f3669
children baa1cb349427
comparison
equal deleted inserted replaced
2073:de15606f3669 2074:86427261e3c4
31 if pattern:find("^<.*>$") then 31 if pattern:find("^<.*>$") then
32 pattern = pattern:match("^<(.*)>$"); 32 pattern = pattern:match("^<(.*)>$");
33 else 33 else
34 pattern = pattern:gsub("%p", "%%%0"):gsub("%%(%p)", wildcard_equivs); 34 pattern = pattern:gsub("%p", "%%%0"):gsub("%%(%p)", wildcard_equivs);
35 end 35 end
36 return ("(%s and %s:match(%q))"):format(part, part, "^"..pattern.."$"); 36 return ("(%s and %s:find(%q))"):format(part, part, "^"..pattern.."$");
37 else 37 else
38 return ("%s == %q"):format(part, match); 38 return ("%s == %q"):format(part, match);
39 end 39 end
40 end 40 end
41 41