Skip to content

Commit 3af0d14

Browse files
committed
* Allow to unset cookies via negative lifetime values
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1923725 13f79535-47bb-0310-9956-ffa450edef68
1 parent eb450d3 commit 3af0d14

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*) mod_rewrite: Allow to unset cookies in the browser. [Ruediger Pluem]

docs/manual/rewrite/flags.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ security model.</dd>
223223
<dd>A value of 0 indicates that the cookie will persist only for the
224224
current browser session. This is the default value if none is
225225
specified.</dd>
226+
<dd>A negative value causes the cookie to be unset in the browser.</dd>
226227

227228
<dt>Path</dt>
228229
<dd>The path, on the current website, for which the cookie is valid,

modules/mappers/mod_rewrite.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2758,7 +2758,7 @@ static void add_cookie(request_rec *r, char *s)
27582758
long exp_min;
27592759

27602760
exp_min = atol(expires);
2761-
if (exp_min) {
2761+
if (exp_min > 0) {
27622762
apr_time_exp_gmt(&tms, r->request_time
27632763
+ apr_time_from_sec((60 * exp_min)));
27642764
exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d "
@@ -2769,6 +2769,9 @@ static void add_cookie(request_rec *r, char *s)
27692769
tms.tm_year+1900,
27702770
tms.tm_hour, tms.tm_min, tms.tm_sec);
27712771
}
2772+
else if (exp_min < 0) {
2773+
exp_time = "Thu, 01 Jan 1970 00:00:00 GMT";
2774+
}
27722775
}
27732776

27742777
cookie = apr_pstrcat(rmain->pool,

0 commit comments

Comments
 (0)