[Catalyst] Sessions not working with Store::File State Cookie

Roland Lammel rl at brabbel.net
Wed Aug 23 03:30:25 CEST 2006


I had a very strange behaviour when using the latest session plugin with
store::file and state::cookie.

These are the versions used along with Catalyst 5.70001

0.11 Catalyst::Plugin::Session
0.08 Catalyst::Plugin::Session::Store::File
0.01 Catalyst::Plugin::Session::State::Cookie

On every request a new session was created, where usually the same session
will be reused.
Digging into the code I found that the sessionid is not stored correctly in
the cookie. In Cookie.pm the sid was not set anymore when the
finalize_cookie was called. Checking the finalize method in Session.pm I
found that the session state is cleared before even finalize_cookie is
called.

After fixing this sessions still did not work. The log showed the cookie to
be used and it seemed the session has been set, but the a new session was
created again.
Although $c->sessionid($sid) is called, the session id is not set. I changed
that to use the same code of create_session_id from Session.pm

Anyone else experienced those problems? Any comments would be greatly
appreciated.

Here are the patches, I haven't had any sideeffects so far, but then again
I'm just starting with the app (first one with 5.7).

Patch to Catalyst/Plugin/Session/State/Cookie.pm:
63,64c65
<         $c->_sessionid($sid);
<         $c->set_session_id($sid);
---
>         $c->sessionid($sid);

Patch to Catalyst/Plugin/Session.pm:
99,100d98
<     $c->NEXT::finalize(@_);
<
101a100,101
>
>     $c->NEXT::finalize(@_);

Best regards

+rl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060823/005ce902/attachment.htm 


More information about the Catalyst mailing list