Mercurial > prosody-modules
comparison mod_firewall/conditions.lib.lua @ 2127:59023dffbdd4
mod_firewall: Allow underscore in mark names (thanks Ge0rG)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 18 Mar 2016 09:45:02 +0000 |
| parents | edf5cf3c474b |
| children | 21bc4d7cddae |
comparison
equal
deleted
inserted
replaced
| 2126:b0d711cd3da5 | 2127:59023dffbdd4 |
|---|---|
| 185 function condition_handlers.LIMIT(name) | 185 function condition_handlers.LIMIT(name) |
| 186 return ("not throttle_%s:poll(1)"):format(name), { "throttle:"..name }; | 186 return ("not throttle_%s:poll(1)"):format(name), { "throttle:"..name }; |
| 187 end | 187 end |
| 188 | 188 |
| 189 function condition_handlers.ORIGIN_MARKED(name_and_time) | 189 function condition_handlers.ORIGIN_MARKED(name_and_time) |
| 190 local name, time = name_and_time:match("^%s*(%w+)%s+%(([^)]+)s%)%s*$"); | 190 local name, time = name_and_time:match("^%s*([%w_]+)%s+%(([^)]+)s%)%s*$"); |
| 191 if not name then | 191 if not name then |
| 192 name = name_and_time:match("^%s*(%w+)%s*$"); | 192 name = name_and_time:match("^%s*([%w_]+)%s*$"); |
| 193 end | 193 end |
| 194 if not name then | 194 if not name then |
| 195 error("Error parsing mark name, see documentation for usage examples"); | 195 error("Error parsing mark name, see documentation for usage examples"); |
| 196 end | 196 end |
| 197 if time then | 197 if time then |
