mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Avoid a crash by making sure response *has* a location header
This commit is contained in:
@@ -58,6 +58,7 @@ action = function (host, port)
|
|||||||
if string.match(result, "^HTTP/1.[01] 3%d%d") then
|
if string.match(result, "^HTTP/1.[01] 3%d%d") then
|
||||||
|
|
||||||
local location = string.match(result, "\n[Ll][Oo][Cc][Aa][Tt][Ii][Oo][Nn]:[ \t]*(.-)\r?\n")
|
local location = string.match(result, "\n[Ll][Oo][Cc][Aa][Tt][Ii][Oo][Nn]:[ \t]*(.-)\r?\n")
|
||||||
|
if location then
|
||||||
local parsed = url.parse(location)
|
local parsed = url.parse(location)
|
||||||
-- Check for a redirect to the same port, but with HTTPS scheme.
|
-- Check for a redirect to the same port, but with HTTPS scheme.
|
||||||
if parsed.scheme == 'https' and tonumber(parsed.port or 443) == port.number and (
|
if parsed.scheme == 'https' and tonumber(parsed.port or 443) == port.number and (
|
||||||
@@ -73,4 +74,5 @@ action = function (host, port)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user