[Catalyst-commits] r13505 - in
Catalyst-Plugin-Session-State-URI/trunk:
lib/Catalyst/Plugin/Session/State t
cng at dev.catalyst.perl.org
cng at dev.catalyst.perl.org
Thu Aug 19 20:12:09 GMT 2010
Author: cng
Date: 2010-08-19 21:12:09 +0100 (Thu, 19 Aug 2010)
New Revision: 13505
Added:
Catalyst-Plugin-Session-State-URI/trunk/t/live_post.t
Modified:
Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm
Log:
Switch to query_parameters to avoid race condition reading body params
Modified: Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm 2010-08-19 18:52:26 UTC (rev 13504)
+++ Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm 2010-08-19 20:12:09 UTC (rev 13505)
@@ -320,7 +320,7 @@
if ( my $param = $c->_session_plugin_config->{param} )
{ # use param style rewriting
- if ( my $sid = $c->request->param($param) ) {
+ if ( my $sid = $c->request->query_parameters->{$param} ) {
$c->_sessionid_from_uri($sid);
$c->_tried_loading_session_id(0);
$c->log->debug(qq/Found sessionid "$sid" in query parameters/)
Added: Catalyst-Plugin-Session-State-URI/trunk/t/live_post.t
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/t/live_post.t (rev 0)
+++ Catalyst-Plugin-Session-State-URI/trunk/t/live_post.t 2010-08-19 20:12:09 UTC (rev 13505)
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use lib "t/lib";
+
+use Test::More;
+
+BEGIN {
+ eval {
+ require Catalyst::Plugin::Session::State::Cookie;
+ Catalyst::Plugin::Session::State::Cookie->VERSION(0.03);
+ } or plan skip_all => "Catalyst::Plugin::Session::State::Cookie 0.03 or higher is required for this test";
+
+ eval { require Test::WWW::Mechanize::Catalyst }
+ or plan skip_all => "Test::WWW::Mechanize::Catalyst is required for this test";
+
+ plan tests => 2;
+}
+
+use Test::WWW::Mechanize::Catalyst "TestApp";
+
+{
+ my $m = Test::WWW::Mechanize::Catalyst->new( cookie_jar => undef );
+
+ $m->post_ok("http://localhost/uri/body_param", { body_param=>'value' }, "post request");
+ $m->content_contains( "http://localhost/foo/bar?param=value", "param in body" );
+
+}
More information about the Catalyst-commits
mailing list