mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +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:
parent
4b8ed158cf
commit
23457a77c0
1 changed files with 10 additions and 11 deletions
|
|
@ -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
|
||||
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"] .. ";"
|
||||
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
|
||||
cookie = cookie .. ck["name"] .. "=" .. ck["value"] .. "; "
|
||||
end
|
||||
end
|
||||
end
|
||||
return cookie
|
||||
return cookie:gsub("; $","")
|
||||
end
|
||||
|
||||
-- HTTP cache.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue