Closed knutov closed 11 years ago
But in this example everything saved correctly. Looks like it can be problem of Dancer, not sure.
get '/b' => sub {
return session('abc');
};
hook 'before' => sub {
my $a = request->path_info;
if ( not request->path_info =~ m{^/[a|b|c|save]} ){
session abc => $a ;
return redirect '/save?a='.$a;
}
};
get '/save' => sub {
session abc => param "a";
return redirect '/b';
};
I see. It's a problem in how Dancer hooks interact.
Now that D1 is maintained maybe I can patch it for better session cookie support.
David On May 5, 2013 12:49 PM, "Nick S. Knutov" notifications@github.com wrote:
But in this example everything saved correctly. Looks like it can be problem of Dancer, not sure.
get '/b' => sub { return session('abc');}; hook 'before' => sub { my $a = request->path_info; if ( not request->path_info =~ m{^/[a|b|c|save]} ){ session abc => $a ; return redirect '/save?a='.$a; }}; get '/save' => sub { session abc => param "a"; return redirect '/b';};
— Reply to this email directly or view it on GitHubhttps://github.com/dagolden/Dancer-Session-Cookie/issues/6#issuecomment-17454596 .
I've sent a Dancer pull request that should allow this to be fixed: https://github.com/PerlDancer/Dancer/pull/921
Big thanks, now everything works.
Please merge pull request https://github.com/dagolden/Dancer-Session-Cookie/pull/7 with test for this case.
Released new version to CPAN. Thank you for your help.
get /XXX
returns redirect to/b
get /b
returns '' (empty string, instead of '/XXX')get /c
returns$VAR1 = bless( { 'id' => '24803856430730319597546959455691532' }, 'Dancer::Session::Cookie' );
Looks like session is not stored in case of redirect in
hook 'before'
. But everything ok in this place if downgrade to 0.15.Additionally, if modify source code
you can see the session is empty.