diff --git a/nselib/http.lua b/nselib/http.lua index 8781c5064..b0e9ebd22 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1286,6 +1286,10 @@ function redirect_ok(host, port) } local counter = MAX_REDIRECT_COUNT + -- convert a numeric port to a table + if ( "number" == type(port) ) then + port = { number = port } + end return function(url) if ( counter == 0 ) then return false end counter = counter - 1 diff --git a/nselib/httpspider.lua b/nselib/httpspider.lua index 966e8dbef..916f71dcc 100644 --- a/nselib/httpspider.lua +++ b/nselib/httpspider.lua @@ -636,11 +636,12 @@ Crawler = { -- were we redirected? if ( response.location ) then -- was the link absolute? - if ( response.location:match("^http") ) then - url = URL:new(response.location) + local link = response.location[#response.location] + if ( link:match("^http") ) then + url = URL:new(link) -- guess not else - url.path = response.location + url.path = link end end -- if we have a response, proceed scraping it