Permalink
Browse files

restore session_data when session regenerated

  • Loading branch information...
1 parent 5809e44 commit c8177afb23f08fcdafd9ff84ea599e804e3e1748 @nekoya nekoya committed Sep 6, 2009
Showing with 9 additions and 0 deletions.
  1. +1 −0 lib/Ark/Plugin/Session/Backend.pm
  2. +8 −0 t/plugin_session.t
@@ -69,6 +69,7 @@ sub regenerate {
$self->initialize_session_data;
$self->set_session_data($self->session_id => $session_data);
+ $self->session_data($session_data);
}
sub initialize_session_data {
View
@@ -43,6 +43,12 @@ use Test::Base;
$c->session->regenerate;
$c->res->body('regenerated');
}
+
+ sub regen_and_incr :Local {
+ my ($self, $c) = @_;
+ $c->forward('regen');
+ $c->forward('incr');
+ }
}
plan 'no_plan';
@@ -85,6 +91,8 @@ use Ark::Test 'TestApp',
is get('/incr'), 2, 'session continued ok';
isnt $sid, $new_sid, 'but session_id updated ok';
+ is get('/regen_and_incr'), 3, 'modified session data and regenerated sid on the same request ok';
+
# old sid is now removed
my $request = HTTP::Request->new(GET => '/incr');
$request->header( Cookie => "testapp_session=$sid" );

0 comments on commit c8177af

Please sign in to comment.