mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 19:32:18 +00:00
Avoids URL/percent encoding of unreserved characters. Fixes #936
This commit is contained in:
parent
6f1f87d700
commit
86cf5a1393
2 changed files with 6 additions and 2 deletions
|
|
@ -1,5 +1,9 @@
|
|||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o [NSE][GH#936] Function url.escape no longer encodes so-called "unreserved"
|
||||
characters, including hyphen, period, underscore, and tilde, as per RFC 3986.
|
||||
[nnposter]
|
||||
|
||||
o [NSE][GH#935] Function http.pipeline_go no longer assumes that persistent
|
||||
connections are supported on HTTP 1.0 target (unless the target explicitly
|
||||
declares otherwise), as per RFC 7230. [nnposter]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue