Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
HTTP Host header is missing port info #766
According to RFC 2616, Section 14.23:
HTTP requests generated by
local function get_host_field(host, port) return stdnse.get_hostname(host) end
I am proposing to rectify the issue by making the function more compliant with the RFC as follows:
local function get_host_field(host, port) 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
Please let me know if you have any questions or concerns. Otherwise I will commit the change in a few weeks.
As a side note, a similar logic where default port numbers are being derived from the scheme exists in several other areas. I will put together a follow-up patch to abstract out the logic.