Permalink
Browse files

Fix PATH_INFO from REQUEST_URI from FCGI.

  • Loading branch information...
1 parent 4f68dc4 commit 9732555a2275b86c8101e7a8674b169c3db36993 @KnowZero committed Jun 29, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/Plack/Middleware/IIS6ScriptNameFix.pm
@@ -7,7 +7,11 @@ sub call {
my($self, $env) = @_;
if ($env->{SERVER_SOFTWARE} && $env->{SERVER_SOFTWARE} =~ /IIS\/[6-9]\.[0-9]/) {
- my @script_name = split(m!/!, $env->{PATH_INFO});
+
+ my($path, $query) = ( $env->{REQUEST_URI} =~ /^([^?]*)(?:\?(.*))?$/s );
+ for ($path, $query) { s/\#.*$// if defined && length } # dumb clients sending URI fragments
+
+ my @script_name = split(m!/!, URI::Escape::uri_unescape($path));
my @path_translated = split(m!/|\\\\?!, $env->{PATH_TRANSLATED});
my @path_info;

0 comments on commit 9732555

Please sign in to comment.