changeset 998:6fdcebbd2284

mod_firewall: Fix conditions with spaces
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 May 2013 10:32:48 +0100
parents 69dd4e4e54a2
children 197af8440ffb
files mod_firewall/mod_firewall.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
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?(.+)$"));