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=ed6325d1f9c55ca86938ebea476d41f97a76151b;hp=e9ae6ceb1e20156830e260c8c5f31399215d12b0;hb=ad142f4c9b9237b88a8872032591711050c17d3b;hpb=617a86d64440ced92e5d0d938440d8eb555c3505 diff --git a/FastMmap.pm b/FastMmap.pm index e9ae6ce..ed6325d 100644 --- a/FastMmap.pm +++ b/FastMmap.pm @@ -9,7 +9,7 @@ use URI; use URI::Find; use File::Temp 'tempdir'; -our $VERSION = '0.05'; +our $VERSION = '0.06'; __PACKAGE__->mk_classdata('_session'); __PACKAGE__->mk_accessors('sessionid'); @@ -37,8 +37,10 @@ Fast sessions. sub finalize { my $c = shift; - my $redirect = $c->response->redirect; - $c->response->redirect( $c->uri($redirect) ) if $redirect; + unless ($c->config->{no_url_rewrite}) { + my $redirect = $c->response->redirect; + $c->response->redirect( $c->uri($redirect) ) if $redirect; + } if ( my $sid = $c->sessionid ) { $c->_session->set( $sid, $c->session ); my $set = 1; @@ -46,16 +48,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->res->{output} ) if $c->res->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(@_); } @@ -145,9 +149,35 @@ 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