diff options
-rw-r--r-- | dpi/cookies.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dpi/cookies.c b/dpi/cookies.c index 0e100a8d..05846d5f 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -329,6 +329,8 @@ static void Cookies_init() Cookies_tm_init(&tm); tm.tm_sec += strtol(piece, NULL, 10); cookie->expires_at = mktime(&tm); + } else { + cookie->expires_at = (time_t) -1; } cookie->name = dStrdup(dStrsep(&line_marker, "\t")); cookie->value = dStrdup(line_marker ? line_marker : ""); @@ -559,8 +561,9 @@ static void Cookies_add_cookie(CookieData_t *cookie) /* Don't add an expired cookie. Whether expiring now == expired, exactly, * is arguable, but we definitely do not want to add a Max-Age=0 cookie. */ - if (difftime(cookie->expires_at, time(NULL)) <= 0) { - _MSG("Goodbye, expired cookie %s=%s d:%s p:%s\n", cookie->name, + if ((cookie->expires_at == (time_t) -1) || + (difftime(cookie->expires_at, time(NULL)) <= 0)) { + _MSG("Goodbye, cookie %s=%s d:%s p:%s\n", cookie->name, cookie->value, cookie->domain, cookie->path); Cookies_free_cookie(cookie); } else { |