X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-Session-State-Cookie.git;a=blobdiff_plain;f=FastMmap.pm;h=7e48d932f0853924b47bd01657d4a5534798e1f8;hp=9eb86dae91726c68308e1717e45c70247f1188d2;hb=2ab0230bd699dd6c99c49057131db0970277f20e;hpb=bfeb5ca092922fe84d69717450e7dd4e7363b070 diff --git a/FastMmap.pm b/FastMmap.pm index 9eb86da..7e48d93 100644 --- a/FastMmap.pm +++ b/FastMmap.pm @@ -9,7 +9,7 @@ use URI; use URI::Find; use File::Temp 'tempdir'; -our $VERSION = '0.07'; +our $VERSION = '0.11'; __PACKAGE__->mk_classdata('_session'); __PACKAGE__->mk_accessors('sessionid'); @@ -53,7 +53,12 @@ sub finalize { if ( my $cookie = $c->request->cookies->{session} ) { $set = 0 if $cookie->value eq $sid; } - $c->response->cookies->{session} = { value => $sid } if $set; + if ( $set ) { + $c->response->cookies->{session} = { + value => $sid, + expires => $c->config->{session}->{expires} . 's' + }; + } if ( $c->config->{session}->{rewrite} ) { my $finder = URI::Find->new( sub { @@ -64,7 +69,7 @@ sub finalize { return $c->uri($orig); } ); - $finder->find( \$c->res->{output} ) if $c->res->output; + $finder->find( \$c->res->{body} ) if $c->res->body; } } return $c->NEXT::finalize(@_); @@ -115,7 +120,7 @@ sub session { sub setup { my $self = shift; $self->config->{session}->{storage} ||= '/tmp/session'; - $self->config->{session}->{expires} ||= 60 * 60 * 24; + $self->config->{session}->{expires} ||= '1d'; $self->config->{session}->{rewrite} ||= 0; $self->_session(