From: Tatsuhiko Miyagawa Date: Mon, 11 Jan 2010 22:59:17 +0000 (+0000) Subject: Retrieve REQUEST_URI before calling ->canonical since that decodes URI X-Git-Tag: v1.2~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b3996e05bfe1215120fa89374d981709bf45c6bb;hp=903274b10a16afd05e83800ea7fc0a1cd9c993b9;p=catagits%2FHTTP-Request-AsCGI.git Retrieve REQUEST_URI before calling ->canonical since that decodes URI safe characters, so we can properly test those REQUEST_URI undecoded-ness. Required for Catalyst and Plack to retrieve as raw value as possible. --- diff --git a/lib/HTTP/Request/AsCGI.pm b/lib/HTTP/Request/AsCGI.pm index 099ce1d..274dda9 100644 --- a/lib/HTTP/Request/AsCGI.pm +++ b/lib/HTTP/Request/AsCGI.pm @@ -54,6 +54,9 @@ sub new { $uri->port(80) unless $uri->port; $uri->host_port($host) unless !$host || ( $host eq $uri->host_port ); + # Get it before canonicalized so REQUEST_URI can be as raw as possible + my $request_uri = $uri->path_query; + $uri = $uri->canonical; my $environment = { @@ -70,7 +73,7 @@ sub new { REMOTE_ADDR => '127.0.0.1', REMOTE_HOST => 'localhost', REMOTE_PORT => int( rand(64000) + 1000 ), # not in RFC 3875 - REQUEST_URI => $uri->path_query, # not in RFC 3875 + REQUEST_URI => $request_uri, # not in RFC 3875 REQUEST_METHOD => $request->method, @_ };