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

Allow numeric-string port numbers as arguments to http.lua funcs

This commit is contained in:
dmiller
2020-02-18 18:29:57 +00:00
parent e4b3f018ff
commit 2f0e104f02

View File

@@ -187,6 +187,12 @@ local function get_host_field(host, port, scheme)
if host_header then return host_header end
-- If there's no host, we can't invent a name.
if not host then return nil end
-- If there's no port, just return hostname.
if not port then return stdnse.get_hostname(host) end
if type(port) == "string" then
port = tonumber(port)
assert(port, "Invalid port: not a number or table")
end
if type(port) == "number" then
port = {number=port, protocol="tcp"}
end