You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2025/02/11 10:29:04 UTC

svn commit: r1923725 - in /httpd/httpd/trunk: changes-entries/mod_rewrite_unset_cookie.txt docs/manual/rewrite/flags.xml modules/mappers/mod_rewrite.c

Author: rpluem
Date: Tue Feb 11 10:29:03 2025
New Revision: 1923725

URL: http://svn.apache.org/viewvc?rev=1923725&view=rev
Log:
* Allow to unset cookies via negative lifetime values

Added:
    httpd/httpd/trunk/changes-entries/mod_rewrite_unset_cookie.txt   (with props)
Modified:
    httpd/httpd/trunk/docs/manual/rewrite/flags.xml
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c

Added: httpd/httpd/trunk/changes-entries/mod_rewrite_unset_cookie.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/mod_rewrite_unset_cookie.txt?rev=1923725&view=auto
==============================================================================
--- httpd/httpd/trunk/changes-entries/mod_rewrite_unset_cookie.txt (added)
+++ httpd/httpd/trunk/changes-entries/mod_rewrite_unset_cookie.txt Tue Feb 11 10:29:03 2025
@@ -0,0 +1 @@
+  *) mod_rewrite: Allow to unset cookies in the browser. [Ruediger Pluem]

Propchange: httpd/httpd/trunk/changes-entries/mod_rewrite_unset_cookie.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: httpd/httpd/trunk/docs/manual/rewrite/flags.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/flags.xml?rev=1923725&r1=1923724&r2=1923725&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/flags.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/flags.xml Tue Feb 11 10:29:03 2025
@@ -223,6 +223,7 @@ security model.</dd>
 <dd>A value of 0 indicates that the cookie will persist only for the
 current browser session. This is the default value if none is
 specified.</dd>
+<dd>A negative value causes the cookie to be unset in the browser.</dd>
 
 <dt>Path</dt>
 <dd>The path, on the current website, for which the cookie is valid,

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1923725&r1=1923724&r2=1923725&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Tue Feb 11 10:29:03 2025
@@ -2758,7 +2758,7 @@ static void add_cookie(request_rec *r, c
                 long exp_min;
 
                 exp_min = atol(expires);
-                if (exp_min) {
+                if (exp_min > 0) {
                     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 "
@@ -2769,6 +2769,9 @@ static void add_cookie(request_rec *r, c
                                            tms.tm_year+1900,
                                            tms.tm_hour, tms.tm_min, tms.tm_sec);
                 }
+                else if (exp_min < 0) {
+                    exp_time = "Thu, 01 Jan 1970 00:00:00 GMT";
+                }
             }
 
             cookie = apr_pstrcat(rmain->pool,