From fcac8c6e28f33380b8b5ef82d8d6966245b94ce1 Mon Sep 17 00:00:00 2001 From: nnposter Date: Mon, 26 Feb 2018 00:27:36 +0000 Subject: [PATCH] Removes dot and dot-dot path segments from parsed URLs --- nselib/httpspider.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nselib/httpspider.lua b/nselib/httpspider.lua index a7139c963..32710053d 100644 --- a/nselib/httpspider.lua +++ b/nselib/httpspider.lua @@ -433,6 +433,9 @@ URL = { -- and is simpler for now. self.file = self.raw:match("^http[s]?://[^:/]*[:]?%d*(/[^#]*)") or '/' self.path = parsed.path + -- Normalize the values; removes dot and dot-dot path segments + self.file = url.absolute("", self.file) + self.path = url.absolute("", self.path) self.dir = self.path:match("^(.+%/)") or "/" -- TODO: Use public suffix list to extract domain self.domain= self.host:match("^[^%.]-%.(.*)")