This "bug" is actually Apache's fault. The problem occurs when you use
mod_rewrite to hide that you're using dispatch.cgi. When you use
"RewriteRule ^(.*)$ dispatch.cgi" the following happens:

* SCRIPT_NAME is set to /dispatch.cgi (since that's the actual script
which gets ran)
* REDIRECT_SCRIPT_NAME is set to whatever SCRIPT_NAME was before
* PATH_INFO is emptied

I've also tested this on 1.5 and it has the same problem. However, if
you use server/fastcgi.rb (not Rack as I've been testing with) you can
set the ENV['FORCE_ROOT'] to 1 and it will re-set SCRIPT_NAME and
PATH_INFO using REQUEST_URI, which will (partly) solve the problem.

Right now, we have no FORCE_ROOT in Rack, but here's a simple fix:

* Change .htaccess to "RewriteRule ^(.*)$ dispatch.cgi/$1" (You might
need to drop to slash).
* Add a middleware which sets SCRIPT_NAME to REDIRECT_SCRIPT_NAME

This isn't really our problem, but rather Apache (which should be able
to alias CGI-scripts with the correct headers). It probably won't
happen, so I guess we have to add some nasty hacks into Rack.

I haven't tried this on any other servers (LightTPD/Nginx), but as
long as there is no URL-rewriting (I know LightTPD can do it with
FastCGI) it's probably no problem (maybe not even with, if it's smart

Here is a simple app which shows @env (and works on both 1.5 and 2.0): It would be great if you could test it on
different setups and see which requires special treatment. Check out
the Rack-spec for how the variables should be set:

On Wed, Jul 16, 2008 at 5:07 PM, Eric Mill <[EMAIL PROTECTED]> wrote:
> Bluebie -- I tried doing this with FastCGI with the same settings
> (changed .htaccess to point to dispatch.fcgi, changed dispatch file to
> use, got the exact same results.  FastCGI
> will also suffer from these bugs.
> -- Eric
> On Mon, Jul 14, 2008 at 7:40 PM, Bluebie, Jenna
> <[EMAIL PROTECTED]> wrote:
> > We are talking about cgi here, not fast cgi. Specifically CGI's interactions
> > with mod_rewrite in apache.
> > _______________________________________________
> > Camping-list mailing list
> >
> >
> >
> _______________________________________________
> Camping-list mailing list

Magnus Holm
Camping-list mailing list

Reply via email to