[Catalyst-commits] r12080 - in HTTP-Request-AsCGI/trunk: .
lib/HTTP/Request t
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Mon Nov 30 20:37:21 GMT 2009
Author: t0m
Date: 2009-11-30 20:37:19 +0000 (Mon, 30 Nov 2009)
New Revision: 12080
Modified:
HTTP-Request-AsCGI/trunk/Changes
HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
HTTP-Request-AsCGI/trunk/t/05env.t
Log:
Add the HTTP::Request::AsCGI part of RT#50082
Modified: HTTP-Request-AsCGI/trunk/Changes
===================================================================
--- HTTP-Request-AsCGI/trunk/Changes 2009-11-30 18:26:34 UTC (rev 12079)
+++ HTTP-Request-AsCGI/trunk/Changes 2009-11-30 20:37:19 UTC (rev 12080)
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension HTTP::Request::AsCGI.
+ - Change how PATH_INFO is decoded so that everything is decoded, including
+ URI reserved characters (RT#50082)
+
0.9 2009-04-27
- unescape PATH_INFO more safely
Modified: HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
===================================================================
--- HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm 2009-11-30 18:26:34 UTC (rev 12079)
+++ HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm 2009-11-30 20:37:19 UTC (rev 12080)
@@ -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 ) {
Modified: HTTP-Request-AsCGI/trunk/t/05env.t
===================================================================
--- HTTP-Request-AsCGI/trunk/t/05env.t 2009-11-30 18:26:34 UTC (rev 12079)
+++ HTTP-Request-AsCGI/trunk/t/05env.t 2009-11-30 20:37:19 UTC (rev 12080)
@@ -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' );
More information about the Catalyst-commits
mailing list