Mercurial > prosody-modules
comparison mod_firewall/mod_firewall.lua @ 2546:6e4494772328
mod_firewall: Add stripslashes() function
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 23 Feb 2017 13:57:48 +0000 |
parents | 223eea31588d |
children | eb4f45bd7fef |
comparison
equal
deleted
inserted
replaced
2545:9b46d24edf0d | 2546:6e4494772328 |
---|---|
123 :gsub("$$(%a+)", extra or {}) | 123 :gsub("$$(%a+)", extra or {}) |
124 :gsub([[^""%.%.]], "") | 124 :gsub([[^""%.%.]], "") |
125 :gsub([[%.%.""$]], "")); | 125 :gsub([[%.%.""$]], "")); |
126 end | 126 end |
127 | 127 |
128 local escape_chars = { | |
129 a = "\a", b = "\b", f = "\f", n = "\n", r = "\r", t = "\t", | |
130 v = "\v", ["\\"] = "\\", ["\""] = "\"", ["\'"] = "\'" | |
131 }; | |
132 function stripslashes(s) | |
133 return (s:gsub("\\(.)", escape_chars)); | |
134 end | |
135 | |
128 -- Dependency locations: | 136 -- Dependency locations: |
129 -- <type lib> | 137 -- <type lib> |
130 -- <type global> | 138 -- <type global> |
131 -- function handler() | 139 -- function handler() |
132 -- <local deps> | 140 -- <local deps> |