is specified by <em>NAME</em> and the value is
<em>VAL</em>. The <em>domain</em> field is the domain of the
cookie, such as '.apache.org', the optional <em>lifetime</em>
- is the lifetime of the cookie in minutes, and the optional
+ is the lifetime of the cookie in minutes (0 means expires at end
+ of session), and the optional
<em>path</em> is the path of the cookie. If <em>secure</em>
is set to 'secure', 'true' or '1', the cookie is only transmitted via secured
connections. If <em>httponly</em> is set to 'HttpOnly', 'true' or '1', the
if (expires) {
apr_time_exp_t tms;
- apr_time_exp_gmt(&tms, r->request_time
- + apr_time_from_sec((60 * atol(expires))));
- exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d "
- "%.2d:%.2d:%.2d GMT",
- apr_day_snames[tms.tm_wday],
- tms.tm_mday,
- apr_month_snames[tms.tm_mon],
- tms.tm_year+1900,
- tms.tm_hour, tms.tm_min, tms.tm_sec);
+ long exp_min;
+
+ exp_min = atol(expires);
+ if (exp_min) {
+ apr_time_exp_gmt(&tms, r->request_time
+ + apr_time_from_sec((60 * exp_min)));
+ exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d "
+ "%.2d:%.2d:%.2d GMT",
+ apr_day_snames[tms.tm_wday],
+ tms.tm_mday,
+ apr_month_snames[tms.tm_mon],
+ tms.tm_year+1900,
+ tms.tm_hour, tms.tm_min, tms.tm_sec);
+ }
}
cookie = apr_pstrcat(rmain->pool,
var, "=", val,
"; path=", path ? path : "/",
"; domain=", domain,
- expires ? "; expires=" : NULL,
- expires ? exp_time : NULL,
+ expires ? (exp_time ? "; expires=" : "")
+ : NULL,
+ expires ? (exp_time ? exp_time : "")
+ : NULL,
(secure && (!strcasecmp(secure, "true")
|| !strcmp(secure, "1")
|| !strcasecmp(secure,