Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

PATCH: lighttpd "fix" broke mod_rewrite + IIS in Plack #309

Open
wants to merge 1 commit into from

2 participants

@RealBorg

Don't send me a patch, open a pull request on github. Thanks

Sent from my iPhone

On Thursday, June 28, 2012 at 6:52 AM, Thomas Zehetbauer wrote:

hi,

could you please include the attached patch with the next plack release?

we already reported this problem about eight months ago:

http://grokbase.com/t/sc/catalyst/11aswtme3s/plack-hanlder-fcgi-bug

lighttpd should be fixed instead of breaking apache + IIS

https://github.com/miyagawa/Plack/pull/284

https://github.com/miyagawa/Plack/issues/299

https://github.com/miyagawa/Plack/pull/300

TIA

Tom

@KnowZero

From what was discussed prior, it seems that line is incorrectly commented on and the fix should effect every web server. During some situations of apache and all usage of IIS it backfires and destroys the PATH_INFO. So from what I was told a patch should be done to each individual middleware instead. And recover the PATH_INFO via REQUEST_URI.

I wrote a patch for IIS middleware and waiting on a commit:

https://github.com/miyagawa/Plack/pull/303/files

If Apache is needed I guess a similar middleware adjustment needs to be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/Plack/Handler/FCGI.pm
View
10 lib/Plack/Handler/FCGI.pm
@@ -111,10 +111,12 @@ sub run {
delete $env->{HTTP_CONTENT_TYPE};
delete $env->{HTTP_CONTENT_LENGTH};
- # lighttpd munges multiple slashes in PATH_INFO into one. Try recovering it
- my $uri = URI->new("http://localhost" . $env->{REQUEST_URI});
- $env->{PATH_INFO} = uri_unescape($uri->path);
- $env->{PATH_INFO} =~ s/^\Q$env->{SCRIPT_NAME}\E//;
+ if ($env->{SERVER_SOFTWARE} && $env->{SERVER_SOFTWARE} =~ m!lighttpd!) {
+ # lighttpd munges multiple slashes in PATH_INFO into one. Try recovering it
+ my $uri = URI->new("http://localhost" . $env->{REQUEST_URI});
+ $env->{PATH_INFO} = uri_unescape($uri->path);
+ $env->{PATH_INFO} =~ s/^\Q$env->{SCRIPT_NAME}\E//;
+ }
if ($env->{SERVER_SOFTWARE} && $env->{SERVER_SOFTWARE} =~ m!lighttpd[-/]1\.(\d+\.\d+)!) {
no warnings;
Something went wrong with that request. Please try again.