1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 00:49:01 +00:00

Includes port information in the Host header for non-standard ports. Fixes #766

This commit is contained in:
nnposter
2017-04-01 14:33:54 +00:00
parent 1bdbc2a680
commit 11a8c315ed

View File

@@ -114,6 +114,7 @@ local coroutine = require "coroutine"
local nmap = require "nmap"
local os = require "os"
local sasl = require "sasl"
local shortport = require "shortport"
local slaxml = require "slaxml"
local stdnse = require "stdnse"
local string = require "string"
@@ -159,7 +160,14 @@ end
--- Get a value suitable for the Host header field.
-- See RFC 2616 sections 14.23 and 5.2.
local function get_host_field(host, port)
return stdnse.get_hostname(host)
if not host then return nil end
local ssl = shortport.ssl(host, port)
local pn = port.number
if not ssl and pn == 80 or ssl and pn == 443 then
return stdnse.get_hostname(host)
else
return stdnse.get_hostname(host) .. ":" .. pn
end
end
-- Skip *( SP | HT ) starting at offset. See RFC 2616, section 2.2.