# HG changeset patch # User corvid # Date 1263256034 0 # Node ID bd36920f32d4d7eeabe8a63ee14cd9c1dd841d86 # Parent df7b789ea491ac5355d1f0f7d98b0a3ec03ea308 don't bother to save expired cookies diff -r df7b789ea491 -r bd36920f32d4 dpi/cookies.c --- a/dpi/cookies.c Mon Jan 11 21:52:49 2010 +0100 +++ b/dpi/cookies.c Tue Jan 12 00:27:14 2010 +0000 @@ -343,6 +343,7 @@ int i, fd; CookieNode *node; CookieData_t *cookie; + time_t now; #ifndef HAVE_LOCKF struct flock lck; @@ -351,6 +352,8 @@ if (disabled) return; + now = time(NULL); + rewind(file_stream); fd = fileno(file_stream); if (ftruncate(fd, 0) == -1) @@ -360,7 +363,7 @@ /* Iterate cookies per domain, saving and freeing */ while ((node = dList_nth_data(cookies, 0))) { for (i = 0; (cookie = dList_nth_data(node->dlist, i)); ++i) { - if (!cookie->session_only) { + if (!cookie->session_only && (cookie->expires_at > now)) { fprintf(file_stream, "%s\tTRUE\t%s\t%s\t%ld\t%s\t%s\n", cookie->domain, cookie->path,