[Catalyst-commits] r12758 - in Catalyst-Runtime/5.80/trunk: . lib/Catalyst/Engine t/aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Jan 28 15:47:31 GMT 2010


Author: t0m
Date: 2010-01-28 15:47:31 +0000 (Thu, 28 Jan 2010)
New Revision: 12758

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm
   Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_engine_cgi-prepare_path.t
Log:
Fix paths with URI encoding as the first path part

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2010-01-28 00:23:41 UTC (rev 12757)
+++ Catalyst-Runtime/5.80/trunk/Changes	2010-01-28 15:47:31 UTC (rev 12758)
@@ -12,6 +12,9 @@
      an action object has been fixed to not just encode the first slash in
      any set of args/captures.
 
+   - nginx and lighttpd FCGI requests with URI encoded sections as the first
+     path part have been fixed to operate correctly.
+
   New features:
    - Allow passing additional arguments to action constructors.
 

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm	2010-01-28 00:23:41 UTC (rev 12757)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm	2010-01-28 15:47:31 UTC (rev 12758)
@@ -168,7 +168,8 @@
             if (substr($req_uri, 0, 1) ne '/') {
                 my ($match) = $req_uri =~ m|^([^/]+)|;
                 my ($path_info_part) = $path_info =~ m|^(.*?\Q$match\E)|;
-                substr($req_uri, 0, length($match), $path_info_part);
+                substr($req_uri, 0, length($match), $path_info_part)
+                    if $path_info_part;
             }
             $path_info = $req_uri;
         }

Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_engine_cgi-prepare_path.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_engine_cgi-prepare_path.t	2010-01-28 00:23:41 UTC (rev 12757)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_engine_cgi-prepare_path.t	2010-01-28 15:47:31 UTC (rev 12758)
@@ -62,8 +62,18 @@
     is ''.$r->base, 'http://www.foo.com/';
 }
 
+# nginx example from espent with path /"foo"
+{
+    my $r = get_req (
+        PATH_INFO => '"foo"',
+        SCRIPT_NAME => '/',
+        REQUEST_URI => '/%22foo%22',
+    );
+    is ''.$r->path, '%22foo%22';
+    is ''.$r->uri, 'http://www.foo.com/%22foo%22';
+    is ''.$r->base, 'http://www.foo.com/';
+}
 
-
 # FIXME - Test proxy logic
 #       - Test query string
 #       - Test non standard port numbers




More information about the Catalyst-commits mailing list