mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 21:21:31 +00:00
Corrects URL-Redirection in Relative Paths closes #918
This commit is contained in:
@@ -1571,13 +1571,13 @@ function parse_redirect(host, port, path, response)
|
|||||||
if ( not(u.host) ) then
|
if ( not(u.host) ) then
|
||||||
-- we're dealing with a relative url
|
-- we're dealing with a relative url
|
||||||
u.host = stdnse.get_hostname(host)
|
u.host = stdnse.get_hostname(host)
|
||||||
u.path = ((u.path:sub(1,1) == "/" and "" ) or "/" ) .. u.path -- ensuring leading slash
|
|
||||||
end
|
end
|
||||||
-- do port fixup
|
-- do port fixup
|
||||||
u.port = u.port or get_default_port(u.scheme) or port.number
|
u.port = u.port or get_default_port(u.scheme) or port.number
|
||||||
if ( not(u.path) ) then
|
if ( not(u.path) ) then
|
||||||
u.path = "/"
|
u.path = "/"
|
||||||
end
|
end
|
||||||
|
u.path = url.absolute(path, u.path)
|
||||||
if ( u.query ) then
|
if ( u.query ) then
|
||||||
u.path = ("%s?%s"):format( u.path, u.query )
|
u.path = ("%s?%s"):format( u.path, u.query )
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user