From cfa57758add4c2fa6f28ea83a6499897d5b538e7 Mon Sep 17 00:00:00 2001 From: nnposter Date: Wed, 19 Apr 2017 18:39:20 +0000 Subject: [PATCH] Changes the redirect rule to return false in case of a missing path. This change aligns the code with the corresponding comment. Fixes #830 --- nselib/http.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nselib/http.lua b/nselib/http.lua index 94afdff97..c4233dfac 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1518,10 +1518,12 @@ local redirect_ok_rules = { -- make sure we're actually being redirected somewhere and not to the same url function (url, host, port) + -- url.path must be set if returning true -- path cannot be unchanged unless host has changed - -- loc.path must be set if returning true - if ( not url.path or url.path == "/" ) and url.host == ( host.targetname or host.ip) then return false end - if not url.path then return true end + -- TODO: Since we do not know here what the actual old path was then + -- the effectiveness of this code is a bit unclear. + if not url.path then return false end + if url.path == "/" and url.host == (host.targetname or host.ip) then return false end return true end, }