Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Fixes for cookiejar #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions httpauthpkg/cookiejar.nim
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ proc parseSetCookie*(header: string): Cookie =
if not (val.endswith(" GMT") or val.endswith(" UTC")):
continue
result.session = false
var exp = parse(val, "ddd, dd MMM yyyy HH:mm:ss")
let zone = utc()
var exp = parse(val, "ddd, dd MMM yyyy HH:mm:ss", zone)
# parse(v, "ddd, dd MMM yy HH:mm:SS")
exp.isDST = false
exp.timezone = 0
exp.timezone = zone
result.expires = toTime exp
of "secure":
result.secure = true
Expand All @@ -102,11 +103,11 @@ proc add_cookies*(jar: var CookieJar, raw_cookies: seq[string], domain, path: st
for rc in raw_cookies:
var cookie = parseSetCookie(rc)

if cookie.domain == nil:
if cookie.domain.len == 0:
cookie.domain = domain
cookie.host_only = true

if cookie.path == nil:
if cookie.path.len == 0:
cookie.path = path

if cookie.session or (cookie.expires > getTime()):
Expand Down