From: Stefan Seifert Date: Thu, 30 Jun 2011 13:24:10 +0000 (+0000) Subject: Move call to _save_session_expires to finalize_session X-Git-Tag: v0.32^2~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=94222de2be3cabb5236edfd948be1dea662e7a43;p=catagits%2FCatalyst-Plugin-Session.git 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 headers. 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. --- diff --git a/lib/Catalyst/Plugin/Session.pm b/lib/Catalyst/Plugin/Session.pm index cf7522a..f7aed87 100644 --- a/lib/Catalyst/Plugin/Session.pm +++ b/lib/Catalyst/Plugin/Session.pm @@ -102,8 +102,10 @@ sub prepare_action { 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 @@ sub finalize_session { $c->maybe::next::method(@_); + $c->_save_session_expires; $c->_save_session_id; $c->_save_session; $c->_save_flash;