Skip Menu |
 

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 24951
Status: resolved
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.7005
Fixed in: (no value)



Subject: [PATCH] Catalyst::Engine::CGI misbehaves when REDIRECT_URL is set but PATH_INFO is not
Download (untitled) / with headers
text/plain 876b
[This is actually against 5.7006, but RT doesn't show that version...] My ISP allows persistent apps only via .fcgi files (via Apache mod_fastcgi). To avoid seeing "index.fcgi" in the URL, I use the following in my .htaccess RewriteRule ^(.*)$ index.fcgi [QSA,L] That correctly sets $ENV{REDIRECT_URL} (to, say, "/about") but leaves $ENV{PATH_INFO} undefined. Consequently the $c->req->base url is not computed correctly, and $c->uri_for() goes haywire. The attached patch detects this scenario and does the following: * sets the $base_path to the dir of the $ENV{SCRIPT_NAME} * computes the missing $ENV{PATH_INFO} by using $ENV{REDIRECT_URL} minus the newly-computed base I'm not sure that this is the best possible solution, but it works for me. Note that I've wrapped the s/// variables in \Q...\E to prevent interpretation of, say ".*" characters in the URL.
Subject: engine-cgi.patch
Download engine-cgi.patch
text/x-diff 700b
--- /home/equilibrious/SALG/par/lib/Catalyst/Engine/CGI.pm 2007-02-14 09:06:16.000000000 -0800 +++ /home/equilibrious/SALG/lib/Catalyst/Engine/CGI.pm 2007-02-14 09:30:03.000000000 -0800 @@ -116,7 +116,12 @@ my $base_path; if ( exists $ENV{REDIRECT_URL} ) { $base_path = $ENV{REDIRECT_URL}; - $base_path =~ s/$ENV{PATH_INFO}$//; + if ($ENV{PATH_INFO}) { + $base_path =~ s/\Q$ENV{PATH_INFO}\E$//; + } elsif ($ENV{SCRIPT_NAME}) { + ($base_path = $ENV{SCRIPT_NAME}) =~ s{[^/]+\z}{}xms; + ($ENV{PATH_INFO} = $ENV{REDIRECT_URL}) =~ s{\A\Q$base_path\E}{}xms; + } } else { $base_path = $ENV{SCRIPT_NAME} || '/';
Hi - is this still a problem, and would it be possible for you to provide a test for the issue?
Download (untitled) / with headers
text/plain 341b
I cannot replicate this issue for love nor money, and I'm fairly sure it will be cured by recent changes in Catalyst. I'd still love to hear about if this is a problem for you (or just get a more full description of how I might replicate it), but without that, and as this bug is over 2 years old, I'm afraid I'm just going to resolve it..
Download (untitled) / with headers
text/plain 331b
Oops. It was pointed out on the mailing list that your bug had two halves, and the latter half (unquoted special characters) is trivial to reproduce. I did so, and I have fixed it: http://dev.catalystframework.org/svnweb/Catalyst/revision?rev=13166 I would still love a way to demonstrate the original issue you were having....
Download (untitled) / with headers
text/plain 491b
On Sun Apr 18 19:07:27 2010, BOBTFISH wrote: Show quoted text
> Oops. > > It was pointed out on the mailing list that your bug had two halves, and > the latter half (unquoted special characters) is trivial to reproduce. > > I did so, and I have fixed it: > > http://dev.catalystframework.org/svnweb/Catalyst/revision?rev=13166 > > I would still love a way to demonstrate the original issue you were > having....
Thanks. Sorry, that was 3 years ago. I switched jobs and haven't used FastCGI since then.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.