1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Fix a crash in http scripts when following redirects

This commit is contained in:
dmiller
2018-11-27 04:43:16 +00:00
parent f8004b792c
commit ebf083cb0b

View File

@@ -161,7 +161,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
local number = (type(port) == "number") and port or port.number
local number
if type(port) == "number" then
number = port
port = {number=number, protocol="tcp"}
end
stdnse.debug1("get_host_field: host=%s, port=%s, number=%s", host, port, number)
if scheme then
-- Caller provided scheme. If it's default, return just the hostname.
if number == get_default_port(scheme) then