You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2013/10/13 15:07:19 UTC

svn commit: r1531683 - in /httpd/httpd/trunk: CHANGES modules/session/mod_session.c

Author: minfrin
Date: Sun Oct 13 13:07:19 2013
New Revision: 1531683

URL: http://svn.apache.org/r1531683
Log:
mod_session: Reset the max-age on session save. PR 47476.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/session/mod_session.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1531683&r1=1531682&r2=1531683&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Oct 13 13:07:19 2013
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_session: Reset the max-age on session save. PR 47476. [Alexey
+     Varlamov <alexey.v.varlamov gmail com>]
+
   *) mod_session: After parsing the value of the header specified by the
      SessionHeader directive, remove the value from the response. PR 55279.
      [Graham Leggett]

Modified: httpd/httpd/trunk/modules/session/mod_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session.c?rev=1531683&r1=1531682&r2=1531683&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/session/mod_session.c (original)
+++ httpd/httpd/trunk/modules/session/mod_session.c Sun Oct 13 13:07:19 2013
@@ -144,9 +144,11 @@ static apr_status_t ap_session_load(requ
         }
     }
 
-    /* make sure the expiry is set, if present */
-    if (!zz->expiry && dconf->maxage) {
-        zz->expiry = now + dconf->maxage * APR_USEC_PER_SEC;
+    /* make sure the expiry and maxage are set, if present */
+    if (dconf->maxage) {
+        if (!zz->expiry) {
+            zz->expiry = now + dconf->maxage * APR_USEC_PER_SEC;
+        }
         zz->maxage = dconf->maxage;
     }
 
@@ -194,6 +196,11 @@ static apr_status_t ap_session_save(requ
             z->maxage = dconf->maxage;
         }
 
+        /* reset the expiry before saving if present */
+        if (z->dirty && z->maxage) {
+            z->expiry = now + z->maxage * APR_USEC_PER_SEC;
+        } 
+
         /* encode the session */
         rv = ap_run_session_encode(r, z);
         if (OK != rv) {