1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-26 17:39:03 +00:00

Disables default use of persistent connections with HTTP 1.0 targets. Fixes #935

This commit is contained in:
nnposter
2017-07-22 00:23:10 +00:00
parent c5c144f0ec
commit 6f1f87d700
2 changed files with 10 additions and 11 deletions

View File

@@ -872,7 +872,7 @@ end
-- If the value is not available, an arbitrary value is used. If the connection
-- is not explicitly closed by the server, this same value is attempted.
--
-- @param response The http response - Might be a table or a raw response
-- @param response The HTTP response table
-- @return The max number of requests on a keep-alive connection
local function getPipelineMax(response)
-- Allow users to override this with a script-arg
@@ -883,16 +883,11 @@ local function getPipelineMax(response)
end
if response then
if response.header and response.header.connection ~= "close" then
if response.header["keep-alive"] then
local max = string.match( response.header["keep-alive"], "max=(%d*)")
if(max == nil) then
return 40
end
return tonumber(max)
else
return 40
end
local hdr = response.header or {}
local opts = stdnse.strsplit("%s+", (hdr.connection or ""):lower())
if stdnse.contains(opts, "close") then return 1 end
if response.version >= "1.1" or stdnse.contains(opts, "keep-alive") then
return tonumber((hdr["keep-alive"] or ""):match("max=(%d+)")) or 40
end
end
return 1