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=9ec3485a5743706061b9fee10a5fdd5a048efc96;hp=5b5e460d18d0859bc396e4dea15f501aa564afdd;hb=f1ff0f22ff66f5d1621e6cd8381db49381437334;hpb=bf2bce672ebec6c0122d133aa86c325e2173c30c diff --git a/FastMmap.pm b/FastMmap.pm index 5b5e460..9ec3485 100644 --- a/FastMmap.pm +++ b/FastMmap.pm @@ -9,7 +9,7 @@ use URI; use URI::Find; use File::Temp 'tempdir'; -our $VERSION = '0.04'; +our $VERSION = '0.06'; __PACKAGE__->mk_classdata('_session'); __PACKAGE__->mk_accessors('sessionid'); @@ -46,16 +46,18 @@ sub finalize { $set = 0 if $cookie->value eq $sid; } $c->response->cookies->{session} = { value => $sid } if $set; - my $finder = URI::Find->new( - sub { - my ( $uri, $orig ) = @_; - my $base = $c->request->base; - return $orig unless $orig =~ /^$base/; - return $orig if $uri->path =~ /\/-\//; - return $c->uri($orig); - } - ); - $finder->find( \$c->response->{output} ); + unless ($c->config->{no_url_rewrite}) { + my $finder = URI::Find->new( + sub { + my ( $uri, $orig ) = @_; + my $base = $c->request->base; + return $orig unless $orig =~ /^$base/; + return $orig if $uri->path =~ /\/-\//; + return $c->uri($orig); + } + ); + $finder->find( \$c->res->{output} ) if $c->res->output; + } } return $c->NEXT::finalize(@_); } @@ -83,7 +85,10 @@ sub session { my $c = shift; return $c->{session} if $c->{session}; my $sid = $c->sessionid; - if ( $sid && ( $c->{session} = $c->_session->get($sid) ) ) { + if ( $sid + && $c->_session + && ( $c->{session} = $c->_session->get($sid) ) ) + { $c->log->debug(qq/Found session "$sid"/) if $c->debug; return $c->{session}; } @@ -142,13 +147,40 @@ sub uri { return $uri; } +=head2 CONFIG OPTIONS + +=head3 no_url_rewrite + +To disable automatic storing of sessions in the url, +you can disable the url rewriting for session by setting +this to a true value. + +=head3 cache_root + +The root directory for the session cache. defaults to a +tempdir. + +=head3 default_expires_in + +how many seconds until the session expires. defaults to 1 day + +=head3 auto_purge_interval + +How often should the system purge sessions. Defaults to 1 time +per day. + +=head3 auto_purge_on_set + +Is auto purge enabled? defaults to true. + =head1 SEE ALSO -L. +L L. =head1 AUTHOR Sebastian Riedel, C +Marcus Ramberg C =head1 COPYRIGHT