From: Kieren Diment Date: Wed, 4 Apr 2007 00:41:39 +0000 (+0000) Subject: trailing slash for non-root deployment fix by jayk X-Git-Tag: 5.7099_04~198 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=168f570c47f586d5a7e75c4afa46b3f470ad8082;p=catagits%2FCatalyst-Runtime.git trailing slash for non-root deployment fix by jayk --- diff --git a/lib/Catalyst/Engine/CGI.pm b/lib/Catalyst/Engine/CGI.pm index 2ee2e01..61a9c27 100644 --- a/lib/Catalyst/Engine/CGI.pm +++ b/lib/Catalyst/Engine/CGI.pm @@ -135,7 +135,10 @@ sub prepare_path { $port = $c->request->secure ? 443 : 80; } - # set the request URI + # set the base URI + # base must end in a slash + $base_path .= '/' unless ( $base_path =~ /\/$/ ); + my $path = $base_path . ( $ENV{PATH_INFO} || '' ); $path =~ s{^/+}{}; @@ -158,13 +161,12 @@ sub prepare_path { $c->request->uri( bless \$uri, $uri_class ); - # set the base URI - # base must end in a slash - $base_path .= '/' unless $base_path =~ m{/$}; - - my $base_uri = $scheme . '://' . $host . $base_path; - - $c->request->base( bless \$base_uri, $uri_class ); + # sanitize the URI + $uri = $uri->canonical; + $c->request->uri($uri); + my $base = $uri->clone; + $base->path_query($base_path); + $c->request->base($base); } =head2 $self->prepare_query_parameters($c)