Skip to content

Commit

Permalink
use local to store PATH_INFO/SCRIPT_NAME for the mapped app so $env m…
Browse files Browse the repository at this point in the history
…odifications in middleware should work.
  • Loading branch information
miyagawa committed Nov 25, 2009
1 parent 8ac598c commit 5e57e2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Plack/App/URLMap.pm
Expand Up @@ -53,7 +53,9 @@ sub to_app {
next unless $path =~ s!\Q$location\E!!;
next unless $path eq '' or $path =~ m!/!;

return $app->({ %$env, PATH_INFO => $path, SCRIPT_NAME => $script_name . $location });
local $env->{PATH_INFO} = $path;
local $env->{SCRIPT_NAME} = $script_name . $location;
return $app->($env);
}

return [404, [ 'Content-Type' => 'text/plain' ], [ "Not Found" ]];
Expand Down

0 comments on commit 5e57e2f

Please sign in to comment.