diff mod_firewall/mod_firewall.lua @ 998:6fdcebbd2284

mod_firewall: Fix conditions with spaces
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 May 2013 10:32:48 +0100
parents 37af655ca575
children 197af8440ffb
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Tue May 07 09:31:57 2013 +0100
+++ b/mod_firewall/mod_firewall.lua	Tue May 07 10:32:48 2013 +0100
@@ -240,9 +240,9 @@
 				condition = (condition:sub(1,s-1)..condition:sub(e+1, -1)):match("^%s*(.-)%s*$");
 				negated = true;
 			end
-			condition = condition:gsub(" ", "");
+			condition = condition:gsub(" ", "_");
 			if not condition_handlers[condition] then
-				return nil, ("Unknown condition on line %d: %s"):format(line_no, condition);
+				return nil, ("Unknown condition on line %d: %s"):format(line_no, (condition:gsub("_", " ")));
 			end
 			-- Get the code for this condition
 			local ok, condition_code, condition_deps = pcall(condition_handlers[condition], line:match(":%s?(.+)$"));