1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-26 01:19:03 +00:00

Changes the port type returned from url.parse() to an actual integer, as

opposed to a string that represents an integer. Fixes #833, fixes #817.
This commit is contained in:
nnposter
2017-04-19 17:02:32 +00:00
parent 339283d4b0
commit af6bbc35bb
6 changed files with 15 additions and 11 deletions

View File

@@ -183,8 +183,8 @@ function parse(url, default)
if not authority then return parsed end
authority = string.gsub(authority,"^([^@]*)@",
function(u) parsed.userinfo = u; return "" end)
authority = string.gsub(authority, ":([0-9]*)$",
function(p) if p ~= "" then parsed.port = p end; return "" end)
authority = string.gsub(authority, ":(%d+)$",
function(p) parsed.port = tonumber(p); return "" end)
if authority ~= "" then parsed.host = authority end
local userinfo = parsed.userinfo
if not userinfo then return parsed end