X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FCGI.pm;h=17e4eed375c3c28922f15f7b517fd5230a34abc8;hb=c82ed742c266d6ad53cf3f18214d392cd6d188f7;hp=d2d041e244c6ab20773d8eaf79ceb32adb94ded0;hpb=294f78ca00792c3014ef0b70808fcb04ebe13c9c;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/CGI.pm b/lib/Catalyst/Engine/CGI.pm index d2d041e..17e4eed 100644 --- a/lib/Catalyst/Engine/CGI.pm +++ b/lib/Catalyst/Engine/CGI.pm @@ -94,10 +94,10 @@ sub prepare_headers { local (*ENV) = $self->env || \%ENV; # Read headers from %ENV - while ( my ( $header, $value ) = each %ENV ) { + foreach my $header ( keys %ENV ) { next unless $header =~ /^(?:HTTP|CONTENT|COOKIE)/i; ( my $field = $header ) =~ s/^HTTPS?_//; - $c->req->headers->header( $field => $value ); + $c->req->headers->header( $field => $ENV{$header} ); } } @@ -112,7 +112,14 @@ sub prepare_path { my $scheme = $c->request->secure ? 'https' : 'http'; my $host = $ENV{HTTP_HOST} || $ENV{SERVER_NAME}; my $port = $ENV{SERVER_PORT} || 80; - my $base_path = $ENV{SCRIPT_NAME} || '/'; + my $base_path; + if ( exists $ENV{REDIRECT_URL} ) { + $base_path = $ENV{REDIRECT_URL}; + $base_path =~ s/$ENV{PATH_INFO}$//; + } + else { + $base_path = $ENV{SCRIPT_NAME} || '/'; + } # If we are running as a backend proxy, get the true hostname PROXY_CHECK: @@ -130,7 +137,7 @@ sub prepare_path { $port = $c->request->secure ? 443 : 80; } - my $path = $base_path . $ENV{PATH_INFO}; + my $path = $base_path . ( $ENV{PATH_INFO} || '' ); $path =~ s{^/+}{}; my $uri = URI->new;