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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user