[Catalyst-commits] r14046 - Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin

nine at dev.catalyst.perl.org nine at dev.catalyst.perl.org
Thu Jun 30 13:24:10 GMT 2011

Author: nine
Date: 2011-06-30 13:24:10 +0000 (Thu, 30 Jun 2011)
New Revision: 14046

Move call to _save_session_expires to finalize_session

_save_session_expires got called in finalize_header, because it
implicitly also extends the session expiry which in turn influences a
possible session cookie which has to be finalized before finalizing

This patch moves the call to _save_session_expires to finalize_session
with the rest of the _save_* calls and only leaves updating the
session_expiry in finalize_header. This is needed as base for a patch to
Catalyst::Plugin::SubRequest which will allow starting new sessions from
within a subrequest.

Modified: Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin/Session.pm
--- Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin/Session.pm	2011-06-17 16:12:39 UTC (rev 14045)
+++ Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin/Session.pm	2011-06-30 13:24:10 UTC (rev 14046)
@@ -102,8 +102,10 @@
 sub finalize_headers {
     my $c = shift;
-    # fix cookie before we send headers
-    $c->_save_session_expires;
+    # Force extension of session_expires before finalizing headers, so a possible cookie will be
+    # up to date. First call to session_expires will extend the expiry, subsequent calls will
+    # just return the previously extended value.
+    $c->session_expires;
     return $c->maybe::next::method(@_);
@@ -124,6 +126,7 @@
+    $c->_save_session_expires;

More information about the Catalyst-commits mailing list