summaryrefslogtreecommitdiff
path: root/dpi/cookies.c
diff options
context:
space:
mode:
Diffstat (limited to 'dpi/cookies.c')
-rw-r--r--dpi/cookies.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/dpi/cookies.c b/dpi/cookies.c
index a3cb53cb..95b2a9a3 100644
--- a/dpi/cookies.c
+++ b/dpi/cookies.c
@@ -805,6 +805,9 @@ static CookieData_t *Cookies_parse(char *cookie_str, const char *server_date)
/* Get the value for the attribute and store it */
if (first_attr) {
+ time_t now;
+ struct tm *tm;
+
if (*str != '=' || *attr == '\0') {
/* disregard nameless cookie */
dFree(attr);
@@ -815,8 +818,8 @@ static CookieData_t *Cookies_parse(char *cookie_str, const char *server_date)
cookie->value = Cookies_parse_value(&str);
/* let's arbitrarily initialise with a year for now */
- time_t now = time(NULL);
- struct tm *tm = gmtime(&now);
+ now = time(NULL);
+ tm = gmtime(&now);
++tm->tm_year;
cookie->expires_at = mktime(tm);
if (cookie->expires_at == (time_t) -1)
@@ -847,10 +850,12 @@ static CookieData_t *Cookies_parse(char *cookie_str, const char *server_date)
dFree(value);
} else if (dStrAsciiCasecmp(attr, "Expires") == 0) {
if (!max_age) {
+ struct tm *tm;
+
value = Cookies_parse_value(&str);
Cookies_unquote_string(value);
_MSG("Expires attribute gives %s\n", value);
- struct tm *tm = Cookies_parse_date(value);
+ tm = Cookies_parse_date(value);
if (tm) {
tm->tm_sec += Cookies_server_timediff(server_date);
cookie->expires_at = mktime(tm);
@@ -1037,15 +1042,15 @@ static uint_t Cookies_internal_dots_required(const char *host)
if (tld_len > 0) {
/* These TLDs were chosen by examining the current publicsuffix list
- * in September 2011 and picking out those where it was simplest for
- * them to describe the situation by beginning with a "*.[tld]" rule.
+ * in October 2012 and picking out those where it was simplest for
+ * them to describe the situation by beginning with a "*.[tld]" rule
+ * or every rule was "[something].[tld]".
*/
- const char *const tlds[] = {"ar","au","bd","bn","bt","ck","cy",
- "er","et","fj","fk","gt","gu","id",
- "il","jm","ke","kh","kw","ml","mm","mt",
- "mz","ni","np","nz","om","pg","py","qa",
- "sv","tr","uk","uy","ve","ye","yu","za",
- "zm","zw"};
+ const char *const tlds[] = {"ar","au","bd","bn","ck","cy","er","et",
+ "fj","fk","gt","gu","il","jm","ke","kh",
+ "kp","kw","lb","lr","mm","mt","mz","ni",
+ "np","nz","om","pg","py","sv","tr","uk",
+ "ve","ye","za","zm","zw"};
uint_t i, tld_num = sizeof(tlds) / sizeof(tlds[0]);
for (i = 0; i < tld_num; i++) {