Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Session and adding cookie headers

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


moseley at hank

Nov 6, 2009, 5:26 PM

Post #1 of 2 (218 views)
Permalink
Session and adding cookie headers

Is it the intended behavior to set a cookie any time the session is
*fetched* even if nothing is set in the session?

With a new app with these added plugins:

Cache
Session
Session::Store::Cache
Session::State::Cookie

And if I just add my $ses = $c->session; to the index action in root then
that causes a Set-Cookie header to be set in the response. (And if cookies
are disabled on a browser then a new session id is created every request,
and expires is written to the store).

Not a big deal, but just curious if that was by design or just a side-effect
of how the session code works.

I typically use session cookies and don't set a cookie header in the
response if a valid session id was in the request cookie.



--
Bill Moseley
moseley[at]hank.org


edmund.vonderburg at gmail

Nov 7, 2009, 12:21 PM

Post #2 of 2 (181 views)
Permalink
Re: Session and adding cookie headers [In reply to]

2009/11/7 Bill Moseley <moseley[at]hank.org>:
> Is it the intended behavior  to set a cookie any time the session is *fetched* even if nothing is set in the session?

I wouldn't say that it is intended behaviour, but it is behaviour that
is used in the C::P::Session test suite.

When you check for a session using $c->session a session is created
and then persisted on the browser using a cookie. There is no logic to
check if there is anything interesting stored in the session (ie that
it is not a 'null session').

You might want to look at the following code which I wrote a while
back and added to the repo but never released to CPAN - it would just
muddy the waters:

http://dev.catalystframework.org/repos/Catalyst/Catalyst-Plugin-Session/0.00/branches/high_performance/

It tries not to do anything silly :)

Cheers,
Edmund.

> --
> Bill Moseley
> moseley[at]hank.org
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.