[Catalyst-commits] r12495 - in Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3: lib t/aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Wed Dec 30 16:11:15 GMT 2009


Author: t0m
Date: 2009-12-30 16:11:15 +0000 (Wed, 30 Dec 2009)
New Revision: 12495

Modified:
   Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/lib/Catalyst.pm
   Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/t/aggregate/live_component_controller_action_chained.t
Log:
Change the tests and what I thought were the approriate bits of the code. However this doesn't work, so I'm missing something, or something deeper is at play here

Modified: Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/lib/Catalyst.pm	2009-12-30 16:08:56 UTC (rev 12494)
+++ Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/lib/Catalyst.pm	2009-12-30 16:11:15 UTC (rev 12495)
@@ -1258,7 +1258,7 @@
     }
 
     if ( blessed($path) ) { # action object
-        my $captures = [ map { s|/|%2F|; $_; }
+        my $captures = [ map { s|/|%252F|; $_; }
                         ( scalar @args && ref $args[0] eq 'ARRAY'
                          ? @{ shift(@args) }
                          : ()) ];
@@ -1279,7 +1279,7 @@
 
     carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
     s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
-    s|/|%2F| for @args;
+    s|/|%252F| for @args;
 
     unshift(@args, $path);
 

Modified: Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/t/aggregate/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/t/aggregate/live_component_controller_action_chained.t	2009-12-30 16:08:56 UTC (rev 12494)
+++ Catalyst-Runtime/5.80/branches/slash_in_pathparts_take3/t/aggregate/live_component_controller_action_chained.t	2009-12-30 16:11:15 UTC (rev 12495)
@@ -1067,13 +1067,15 @@
     # Test round tripping, specifically the / character %2F in uri_for:
     # not being able to feed it back action + captureargs and args into uri for
     # and result in the original request uri is a major piece of suck ;)
+    # Note - for extra fun, in path parts, / must be double encoded to
+    #        %252F, see notes re the RFC in Engine::CGI
     foreach my $thing (
         ['foo', 'bar'],
-        ['foo%2Fbar', 'baz'],
-        ['foo', 'bar%2Fbaz'],
-        ['foo%2Fbar', 'baz%2Fquux'],
-        ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz' => 'quux%2Ffrood'}],
-        ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz%2Ffnoo' => 'quux%2Ffrood'}],
+        ['foo%252Fbar', 'baz'],
+        ['foo', 'bar%252Fbaz'],
+        ['foo%252Fbar', 'baz%252Fquux'],
+        ['foo%252Fbar', 'baz%252Fquux', { foo => 'bar', 'baz' => 'quux%2Ffrood'}],
+        ['foo%252Fbar', 'baz%252Fquux', { foo => 'bar', 'baz%2Ffnoo' => 'quux%2Ffrood'}],
     ) {
         my $path = '/chained/roundtrip_urifor/' .
             $thing->[0] . '/' . $thing->[1];
@@ -1085,7 +1087,8 @@
             'request ' . $path . ' ok');
         # Just check that the path matches, as who the hell knows or cares
         # where the app is based (live tests etc)
-        ok( index($content, $path) > 1, 'uri can round trip through uri_for' );
+        ok( index($content, $path) > 1, 'uri can round trip through uri_for' )
+            or warn("Got back '$content', sent '$path'");
     }
 }
 




More information about the Catalyst-commits mailing list