Comparison

mod_firewall/mod_firewall.lua @ 2561:3da0e3c917cc

mod_firewall: Accept backslash escapes in definitions
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Feb 2017 09:49:09 +0000
parent 2558:2b533a7b5236
child 2562:78efd064aef3
comparison
equal deleted inserted replaced
2560:fda47e2135e5 2561:3da0e3c917cc
69 return [["..tostring(]]..expr..[[).."]]; 69 return [["..tostring(]]..expr..[[).."]];
70 end) 70 end)
71 :gsub("$(%b<>)", function (expr) 71 :gsub("$(%b<>)", function (expr)
72 expr = expr:sub(2,-2); 72 expr = expr:sub(2,-2);
73 local default = "<undefined>"; 73 local default = "<undefined>";
74 expr = expr:gsub("||(%b\"\")$", function (s) 74 expr = expr:gsub("||(%b\"\")$", function (default_string)
75 default = s:sub(2,-2); 75 default = stripslashes(default_string:sub(2,-2));
76 return ""; 76 return "";
77 end); 77 end);
78 local func_chain = expr:match("|[%w|]+$"); 78 local func_chain = expr:match("|[%w|]+$");
79 if func_chain then 79 if func_chain then
80 expr = expr:sub(1, -1-#func_chain); 80 expr = expr:sub(1, -1-#func_chain);