mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 05:31:31 +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 cookie = ""
|
||||
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"]
|
||||
if not path or not ckpath
|
||||
or ckpath == path
|
||||
or ckpath:sub(-1) == "/" and ckpath == path:sub(1, ckpath:len())
|
||||
or ckpath .. "/" == path:sub(1, ckpath:len()+1)
|
||||
then
|
||||
if i ~= 1 then cookie = cookie .. " " end
|
||||
cookie = cookie .. ck["name"] .. "=" .. ck["value"] .. ";"
|
||||
cookie = cookie .. ck["name"] .. "=" .. ck["value"] .. "; "
|
||||
end
|
||||
end
|
||||
return cookie
|
||||
return cookie:gsub("; $","")
|
||||
end
|
||||
|
||||
-- HTTP cache.
|
||||
|
||||
Reference in New Issue
Block a user