mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 21:51:28 +00:00
Modifies the cookie header assembling logic to make it more compliant with RFC 6265, Section 4.2.1, which does not allow the trailing semicolon. Patch by nnposter.
This commit is contained in:
@@ -894,18 +894,17 @@ end
|
|||||||
local function buildCookies(cookies, path)
|
local function buildCookies(cookies, path)
|
||||||
local cookie = ""
|
local cookie = ""
|
||||||
if type(cookies) == 'string' then return cookies end
|
if type(cookies) == 'string' then return cookies end
|
||||||
for i, ck in ipairs(cookies or {}) do
|
for _, ck in ipairs(cookies or {}) do
|
||||||
local ckpath = ck["path"]
|
local ckpath = ck["path"]
|
||||||
if not path or not ckpath
|
if not path or not ckpath
|
||||||
or ckpath == path
|
or ckpath == path
|
||||||
or ckpath:sub(-1) == "/" and ckpath == path:sub(1, ckpath:len())
|
or ckpath:sub(-1) == "/" and ckpath == path:sub(1, ckpath:len())
|
||||||
or ckpath .. "/" == path:sub(1, ckpath:len()+1)
|
or ckpath .. "/" == path:sub(1, ckpath:len()+1)
|
||||||
then
|
then
|
||||||
if i ~= 1 then cookie = cookie .. " " end
|
cookie = cookie .. ck["name"] .. "=" .. ck["value"] .. "; "
|
||||||
cookie = cookie .. ck["name"] .. "=" .. ck["value"] .. ";"
|
end
|
||||||
end
|
end
|
||||||
end
|
return cookie:gsub("; $","")
|
||||||
return cookie
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- HTTP cache.
|
-- HTTP cache.
|
||||||
|
|||||||
Reference in New Issue
Block a user