mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 08:46:45 +00:00
Allow numeric-string port numbers as arguments to http.lua funcs
This commit is contained in:
parent
e4b3f018ff
commit
2f0e104f02
1 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue