From ac4fe58a21ae2e8c60eba43bb4544005d73afe23 Mon Sep 17 00:00:00 2001 From: sophron Date: Sat, 6 Jul 2013 14:01:01 +0000 Subject: [PATCH] Added an option to turn off http caching while crawling. --- nselib/httpspider.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nselib/httpspider.lua b/nselib/httpspider.lua index 9698c1279..1e8ea27d9 100644 --- a/nselib/httpspider.lua +++ b/nselib/httpspider.lua @@ -506,6 +506,7 @@ Crawler = { -- scriptname - should be set to SCRIPT_NAME to enable -- script specific arguments. -- redirect_ok - redirect_ok closure to pass to http.get function + -- no_cache - no_cache option to pass to http.get function -- @return o new instance of Crawler or nil on failure new = function(self, host, port, url, options) local o = { @@ -523,7 +524,7 @@ Crawler = { o:loadLibraryArguments() o:loadDefaultArguments() - local response = http.get(o.host, o.port, '/', { timeout = o.options.timeout, redirect_ok = o.options.redirect_ok } ) + local response = http.get(o.host, o.port, '/', { timeout = o.options.timeout, redirect_ok = o.options.redirect_ok, no_cache = o.options.no_cache } ) if ( not(response) or 'table' ~= type(response) ) then return @@ -692,14 +693,14 @@ Crawler = { end if is_web_file then stdnse.print_debug(2, "%s: Using GET: %s", LIBRARY_NAME, file) - response = http.get(url:getHost(), url:getPort(), url:getFile(), { timeout = self.options.timeout, redirect_ok = self.options.redirect_ok } ) + response = http.get(url:getHost(), url:getPort(), url:getFile(), { timeout = self.options.timeout, redirect_ok = self.options.redirect_ok, no_cache = self.options.no_cache } ) else stdnse.print_debug(2, "%s: Using HEAD: %s", LIBRARY_NAME, file) response = http.head(url:getHost(), url:getPort(), url:getFile()) end else -- fetch the url, and then push it to the processed table - response = http.get(url:getHost(), url:getPort(), url:getFile(), { timeout = self.options.timeout, redirect_ok = self.options.redirect_ok } ) + response = http.get(url:getHost(), url:getPort(), url:getFile(), { timeout = self.options.timeout, redirect_ok = self.options.redirect_ok, no_cache = self.options.no_cache } ) end self.processed[tostring(url)] = true