1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-05 22:19:03 +00:00

Avoids URL/percent encoding of unreserved characters. Fixes #936

This commit is contained in:
nnposter
2017-07-22 01:10:40 +00:00
parent 6f1f87d700
commit 86cf5a1393
2 changed files with 6 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ local segment_set = make_set {
-- @param s Binary string to be encoded.
-- @return Escaped representation of string.
local function protect_segment(s)
return string.gsub(s, "([^A-Za-z0-9_])", function (c)
return string.gsub(s, "([^A-Za-z0-9_.~-])", function (c)
if segment_set[c] then return c
else return string.format("%%%02x", string.byte(c)) end
end)
@@ -108,7 +108,7 @@ end
-- @return Escaped representation of string.
-----------------------------------------------------------------------------
function escape(s)
return string.gsub(s, "([^A-Za-z0-9_])", function(c)
return string.gsub(s, "([^A-Za-z0-9_.~-])", function(c)
return string.format("%%%02x", string.byte(c))
end)
end