Skip Menu |

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 30087
Status: resolved
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: syber.rus [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 5.7010
Fixed in: (no value)



Subject: Catalyst dev server converts encoded '+' (%2B) into spaces in query string.
All '+' symbols in form inputs with request method 'GET' are converted to spaces in catalyst dev server. For example (C++ developer) /product/search?query=C%2B%2B+developer $c->req->param('query') == 'C developer'; Patch and test patch are attached.
Subject: Catalyst-Engine-pm_diff.txt
--- Catalyst-Runtime-5.7010-JaQZZ3/lib/Catalyst/Engine.pm Wed Aug 22 09:43:27 2007 +++ Catalyst-Runtime-5.7010-fixed/lib/Catalyst/Engine.pm Thu Oct 18 12:08:41 2007 @@ -654,8 +654,8 @@ sub unescape_uri { my ( $self, $str ) = @_; - $str =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; $str =~ s/\+/ /g; + $str =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; return $str; }
Subject: live_engine_request_uri-t_diff.txt
--- Catalyst-Runtime-5.7010-JaQZZ3/t/live_engine_request_uri.t Wed Aug 22 09:43:26 2007 +++ Catalyst-Runtime-5.7010-fixed/t/live_engine_request_uri.t Thu Oct 18 12:11:05 2007 @@ -6,7 +6,7 @@ use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 44; +use Test::More tests => 49; use Catalyst::Test 'TestApp'; use Catalyst::Request; @@ -58,6 +58,15 @@ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->{uri}->query, 'text=Catalyst%20Rocks', 'Query string ok' ); is( $creq->{parameters}->{text}, 'Catalyst Rocks', 'Unescaped param ok' ); +} + +# test that query params are unescaped properly with '+' +{ + ok( my $response = request('http://localhost/engine/request/uri?text=C%2B%2B+lang'), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); + is( $creq->{uri}->query, 'text=C%2B%2B+lang', 'Query string ok' ); + is( $creq->{parameters}->{text}, 'C++ lang', 'Unescaped param ok' ); } # test that uri_with adds params
From: ash <+> cpan org
On Thu Oct 18 04:57:03 2007, SYBER wrote: Show quoted text
> All '+' symbols in form inputs with request method 'GET' are converted > to spaces in catalyst dev server. > For example (C++ developer) > /product/search?query=C%2B%2B+developer > $c->req->param('query') == 'C developer'; > > Patch and test patch are attached.
The bug had already been fixed in the SVN version. The test was appreciated and has been applied. Expect this to be fixed in 5.7011, which should be going to CPAN today.
From: ash <+> cpan org
On Thu Oct 18 04:57:03 2007, SYBER wrote: Show quoted text
> All '+' symbols in form inputs with request method 'GET' are converted > to spaces in catalyst dev server. > For example (C++ developer) > /product/search?query=C%2B%2B+developer > $c->req->param('query') == 'C developer'; > > Patch and test patch are attached.
The bug had already been fixed in the SVN version. The test was appreciated and has been applied. Expect this to be fixed in 5.7011, which should be going to CPAN today.
Fixed in version 5.7011 uploaded to CPAN October 18th, 2007.