1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Index: t/05env.t
===================================================================
--- t/05env.t  (revision 11438)
+++ t/05env.t  (working copy)
@@ -24,7 +24,7 @@
 is( $ENV{GATEWAY_INTERFACE}, 'CGI/1.1', 'GATEWAY_INTERFACE' );
 is( $ENV{HTTP_HOST}, 'www.host.com:80', 'HTTP_HOST' );
 is( $ENV{HTTP_X_TEST}, 'Test', 'HTTP_X_TEST' );
-is( decode('UTF-8', $ENV{PATH_INFO}), '/foo%2FБЯ陰茎', 'PATH_INFO');
+is( decode('UTF-8', $ENV{PATH_INFO}), '/foo/БЯ陰茎', 'PATH_INFO');
 is( $ENV{QUERY_STRING}, 'a=1&b=2', 'QUERY_STRING' );
 is( $ENV{SCRIPT_NAME}, '/cgi-bin/script.cgi', 'SCRIPT_NAME' );
 is( $ENV{REQUEST_METHOD}, 'GET', 'REQUEST_METHOD' );
Index: lib/HTTP/Request/AsCGI.pm
===================================================================
--- lib/HTTP/Request/AsCGI.pm  (revision 11438)
+++ lib/HTTP/Request/AsCGI.pm  (working copy)
@@ -75,7 +75,12 @@
         @_
     };
 
-    $environment->{PATH_INFO} = _uri_safe_unescape($environment->{PATH_INFO});
+    # RFC 3875 says PATH_INFO is not URI-encoded. That's really
+    # annoying for applications that you can't tell "%2F" vs "/", but
+    # doing the partial decoding then makes it impossible to tell
+    # "%252F" vs "%2F". Encoding everything is more compatible to what
+    # web servers like Apache or lighttpd do, anyways.
+    $environment->{PATH_INFO} = URI::Escape::uri_unescape($environment->{PATH_INFO});
 
     foreach my $field ( $request->headers->header_field_names ) {