Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

deal with FastCGI path normalization with lighttpd/nginx

  • Loading branch information...
commit f06ec0787cd4c5c2cabb9311b6bcc41a8b76546c 1 parent 690c4ac
Tatsuhiko Miyagawa authored

Showing 1 changed file with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. +8 0 lib/Plack/Handler/AnyEvent/FCGI.pm
8 lib/Plack/Handler/AnyEvent/FCGI.pm
@@ -8,6 +8,8 @@ use AnyEvent;
8 8 use AnyEvent::FCGI;
9 9 use Plack::Util;
10 10 use IO::Handle::Util qw(io_from_write_cb);
  11 +use URI;
  12 +use URI::Escape;
11 13
12 14 sub new {
13 15 my($class, %args) = @_;
@@ -48,6 +50,12 @@ sub _on_request {
48 50 my($self, $app, $request) = @_;
49 51
50 52 my $env = $request->params;
  53 +
  54 + # deal with ligttpd/nginx path normalization
  55 + my $uri = URI->new("http://localhost" . $env->{REQUEST_URI});
  56 + $env->{PATH_INFO} = URI::Escape::uri_unescape($uri->path);
  57 + $env->{PATH_INFO} =~ s/^\Q$env->{SCRIPT_NAME}\E//;
  58 +
51 59 $env = {
52 60 %$env,
53 61 'psgi.version' => [1,1],

0 comments on commit f06ec07

Please sign in to comment.
Something went wrong with that request. Please try again.