Index: t/live_engine_request_uri.t =================================================================== --- t/live_engine_request_uri.t (revision 8571) +++ t/live_engine_request_uri.t (working copy) @@ -4,7 +4,7 @@ use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 66; +use Test::More tests => 75; use Catalyst::Test 'TestApp'; use Catalyst::Request; @@ -50,6 +50,27 @@ is( $creq->uri, 'https://localhost/engine/request/uri', 'HTTPS uri ok' ); } +# test req->base and c->uri_for work correctly after an internally redirected request +{ + my $path = '/engine/request/uri/Rx(here)'; + my $uri = 'http://localhost' . $path; + local $ENV{REDIRECT_URL} = $path; + local $ENV{PATH_INFO} = $path; + + ok( my $response = request($uri), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); + is( $creq->path, 'engine/request/uri/Rx(here)', 'URI contains correct path' ); + is( $creq->base, 'http://localhost/', 'Base is correct' ); + ok( my $context = Catalyst->new({ request => $creq, }), "Created a context object from request" ); + is( $context->uri_for("/bar/baz")->as_string, "http://localhost/bar/baz", + "uri_for creates correct URI from app root" ); + is( $context->uri_for("foo/qux")->as_string, "http://localhost/foo/qux", + "uri_for creates correct URI" ); + is( $creq->path, 'engine/request/uri/Rx(here)', + 'URI contains correct path' ); +} + # test that we can use semi-colons as separators { my $parameters = { Index: lib/Catalyst/Engine/CGI.pm =================================================================== --- lib/Catalyst/Engine/CGI.pm (revision 8571) +++ lib/Catalyst/Engine/CGI.pm (working copy) @@ -114,7 +114,7 @@ my $base_path; if ( exists $ENV{REDIRECT_URL} ) { $base_path = $ENV{REDIRECT_URL}; - $base_path =~ s/$ENV{PATH_INFO}$//; + $base_path =~ s/\Q$ENV{PATH_INFO}\E$//; } else { $base_path = $ENV{SCRIPT_NAME} || '/'; Index: Changes =================================================================== --- Changes (revision 8571) +++ Changes (working copy) @@ -6,6 +6,7 @@ - Fix some Win32 test failures - Add pt translation of error message (wreis) - Make :Chained('../action') work (Florian Ragwitz) + - Escape PATH_INFO in C::Engine::CGI's base_path s/// under REDIRECT_URL. 5.7099_03 2008-07-20 10:10:00 - Fix regressions for regexp fallback in model(), view() and controller()