From 2c98b309a81c0e04f04d5ecb55b5e34ef84bb1b5 Mon Sep 17 00:00:00 2001 From: vinamra Date: Sat, 24 Jun 2017 19:04:06 +0000 Subject: [PATCH] Corrects URL-Redirection in Relative Paths closes #918 --- nselib/http.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nselib/http.lua b/nselib/http.lua index b49da424e..2a95cbda6 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1571,13 +1571,13 @@ function parse_redirect(host, port, path, response) if ( not(u.host) ) then -- we're dealing with a relative url u.host = stdnse.get_hostname(host) - u.path = ((u.path:sub(1,1) == "/" and "" ) or "/" ) .. u.path -- ensuring leading slash end -- do port fixup u.port = u.port or get_default_port(u.scheme) or port.number if ( not(u.path) ) then u.path = "/" end + u.path = url.absolute(path, u.path) if ( u.query ) then u.path = ("%s?%s"):format( u.path, u.query ) end