1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +00:00

Provides a common function, url.get_default_port(), for obtaining

the default port number for a given scheme. Fixes #781
This commit is contained in:
nnposter
2017-04-19 18:00:36 +00:00
parent af6bbc35bb
commit e80976a13a
10 changed files with 41 additions and 77 deletions

View File

@@ -59,13 +59,7 @@ local function dbgt(tbl)
end
local function getHostPort(parsed)
local host, port = parsed.host, parsed.port
-- if no port was found, try to deduce it from the scheme
if ( not(port) ) then
port = (parsed.scheme == 'https') and 443
port = port or ((parsed.scheme == 'http') and 80)
end
return host, port
return parsed.host, parsed.port or url.get_default_port(parsed.scheme)
end
local function isRedirect(status)