Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Magnus Holm
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
(http://pastie.org/235062)

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
enough).

Here is a simple app which shows @env (and works on both 1.5 and 2.0):
http://pastie.org/235078. 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:
http://rack.rubyforge.org/doc/files/SPEC.html

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 Rack::Handler::FastCGI.run, 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@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



--
Magnus Holm
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Eric Mill
Magnus, this is terrific information, thank you for looking into this.

I'm trying to follow your example - you use ApacheFixer to make a
TestingFixed class, but never use that class anywhere else.  Do you
mean for the lines in dispatch.* to use TestingFixed instead of
Testing?

I'm trying to use this to resolve my problems as we speak,
Eric

On Wed, Jul 16, 2008 at 5:08 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 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
 (http://pastie.org/235062)

 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
 enough).

 Here is a simple app which shows @env (and works on both 1.5 and 2.0):
 http://pastie.org/235078. 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:
 http://rack.rubyforge.org/doc/files/SPEC.html

 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 Rack::Handler::FastCGI.run, 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@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Magnus Holm
Simply replace Testing with TestingFixed in dispatch.cgi:11 and
dispatch.fcgi:13 to see the diffenrence :-)

On Wed, Jul 16, 2008 at 11:28 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Magnus, this is terrific information, thank you for looking into this.

 I'm trying to follow your example - you use ApacheFixer to make a
 TestingFixed class, but never use that class anywhere else.  Do you
 mean for the lines in dispatch.* to use TestingFixed instead of
 Testing?

 I'm trying to use this to resolve my problems as we speak,
 Eric

 On Wed, Jul 16, 2008 at 5:08 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 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
 (http://pastie.org/235062)

 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
 enough).

 Here is a simple app which shows @env (and works on both 1.5 and 2.0):
 http://pastie.org/235078. 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:
 http://rack.rubyforge.org/doc/files/SPEC.html

 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 Rack::Handler::FastCGI.run, 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@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Magnus Holm
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Eric Mill
Unfortunately this isn't working.  I'm checking my ENV and
REDIRECT_SCRIPT_NAME isn't set to anything.  I'm using the Rack spec
to try to figure out an alternative.

Right now, requests to / go to a Camping error page which says
/index.html not found!  and requests to /login (which should go to
a different controller) says /login.html not found!.  PATH_INFO has
been set to /login.html in this case.

I also tried setting SCRIPT_NAME to be whatever REQUEST_URI is, but
this has the same effect as using the REDIRECT_SCRIPT_NAME approach.

Continuing to investigate,
Eric

On Wed, Jul 16, 2008 at 5:31 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 Simply replace Testing with TestingFixed in dispatch.cgi:11 and
 dispatch.fcgi:13 to see the diffenrence :-)

 On Wed, Jul 16, 2008 at 11:28 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Magnus, this is terrific information, thank you for looking into this.

 I'm trying to follow your example - you use ApacheFixer to make a
 TestingFixed class, but never use that class anywhere else.  Do you
 mean for the lines in dispatch.* to use TestingFixed instead of
 Testing?

 I'm trying to use this to resolve my problems as we speak,
 Eric

 On Wed, Jul 16, 2008 at 5:08 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 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
 (http://pastie.org/235062)

 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
 enough).

 Here is a simple app which shows @env (and works on both 1.5 and 2.0):
 http://pastie.org/235078. 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:
 http://rack.rubyforge.org/doc/files/SPEC.html

 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 Rack::Handler::FastCGI.run, 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@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Eric Mill
Also worth noting is that PATH_INFO isn't emptied - it's set to / or
/login, the correct request path.

-- Eric

On Wed, Jul 16, 2008 at 5:40 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Unfortunately this isn't working.  I'm checking my ENV and
 REDIRECT_SCRIPT_NAME isn't set to anything.  I'm using the Rack spec
 to try to figure out an alternative.

 Right now, requests to / go to a Camping error page which says
 /index.html not found!  and requests to /login (which should go to
 a different controller) says /login.html not found!.  PATH_INFO has
 been set to /login.html in this case.

 I also tried setting SCRIPT_NAME to be whatever REQUEST_URI is, but
 this has the same effect as using the REDIRECT_SCRIPT_NAME approach.

 Continuing to investigate,
 Eric

 On Wed, Jul 16, 2008 at 5:31 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 Simply replace Testing with TestingFixed in dispatch.cgi:11 and
 dispatch.fcgi:13 to see the diffenrence :-)

 On Wed, Jul 16, 2008 at 11:28 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Magnus, this is terrific information, thank you for looking into this.

 I'm trying to follow your example - you use ApacheFixer to make a
 TestingFixed class, but never use that class anywhere else.  Do you
 mean for the lines in dispatch.* to use TestingFixed instead of
 Testing?

 I'm trying to use this to resolve my problems as we speak,
 Eric

 On Wed, Jul 16, 2008 at 5:08 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 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
 (http://pastie.org/235062)

 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
 enough).

 Here is a simple app which shows @env (and works on both 1.5 and 2.0):
 http://pastie.org/235078. 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:
 http://rack.rubyforge.org/doc/files/SPEC.html

 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 Rack::Handler::FastCGI.run, 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@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Julian Tarkhanov

On 16 jul 2008, at 23:40, Eric Mill wrote:


Unfortunately this isn't working.  I'm checking my ENV and
REDIRECT_SCRIPT_NAME isn't set to anything.  I'm using the Rack spec
to try to figure out an alternative.


Rails resolves this somehow, they mount dispatch.fcgi as / 
dispatch.fcgi and use it as rewrite target.

___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Eric Mill
The 500-handling I'm used to appears to be gone.  What's the best approach here?

-- Eric

On Wed, Jul 16, 2008 at 6:08 PM, Eric Mill [EMAIL PROTECTED] wrote:
 I think I've got it working, with this as the 'fixer' call:

  def call(env)
env['SCRIPT_NAME'] = '/'
env['PATH_INFO'] = env['REDIRECT_URL']
@app.call(env)
  end

 I think you might have meant REDIRECT_URL and not REDIRECT_SCRIPT_NAME?

 Thank you Magnus!

 -- Eric

 On Wed, Jul 16, 2008 at 5:51 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Also worth noting is that PATH_INFO isn't emptied - it's set to / or
 /login, the correct request path.

 -- Eric

 On Wed, Jul 16, 2008 at 5:40 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Unfortunately this isn't working.  I'm checking my ENV and
 REDIRECT_SCRIPT_NAME isn't set to anything.  I'm using the Rack spec
 to try to figure out an alternative.

 Right now, requests to / go to a Camping error page which says
 /index.html not found!  and requests to /login (which should go to
 a different controller) says /login.html not found!.  PATH_INFO has
 been set to /login.html in this case.

 I also tried setting SCRIPT_NAME to be whatever REQUEST_URI is, but
 this has the same effect as using the REDIRECT_SCRIPT_NAME approach.

 Continuing to investigate,
 Eric

 On Wed, Jul 16, 2008 at 5:31 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 Simply replace Testing with TestingFixed in dispatch.cgi:11 and
 dispatch.fcgi:13 to see the diffenrence :-)

 On Wed, Jul 16, 2008 at 11:28 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Magnus, this is terrific information, thank you for looking into this.

 I'm trying to follow your example - you use ApacheFixer to make a
 TestingFixed class, but never use that class anywhere else.  Do you
 mean for the lines in dispatch.* to use TestingFixed instead of
 Testing?

 I'm trying to use this to resolve my problems as we speak,
 Eric

 On Wed, Jul 16, 2008 at 5:08 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 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
 (http://pastie.org/235062)

 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
 enough).

 Here is a simple app which shows @env (and works on both 1.5 and 2.0):
 http://pastie.org/235078. 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:
 http://rack.rubyforge.org/doc/files/SPEC.html

 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 Rack::Handler::FastCGI.run, 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@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




___

Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Eric Mill
I think I've got it working, with this as the 'fixer' call:

  def call(env)
env['SCRIPT_NAME'] = '/'
env['PATH_INFO'] = env['REDIRECT_URL']
@app.call(env)
  end

I think you might have meant REDIRECT_URL and not REDIRECT_SCRIPT_NAME?

Thank you Magnus!

-- Eric

On Wed, Jul 16, 2008 at 5:51 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Also worth noting is that PATH_INFO isn't emptied - it's set to / or
 /login, the correct request path.

 -- Eric

 On Wed, Jul 16, 2008 at 5:40 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Unfortunately this isn't working.  I'm checking my ENV and
 REDIRECT_SCRIPT_NAME isn't set to anything.  I'm using the Rack spec
 to try to figure out an alternative.

 Right now, requests to / go to a Camping error page which says
 /index.html not found!  and requests to /login (which should go to
 a different controller) says /login.html not found!.  PATH_INFO has
 been set to /login.html in this case.

 I also tried setting SCRIPT_NAME to be whatever REQUEST_URI is, but
 this has the same effect as using the REDIRECT_SCRIPT_NAME approach.

 Continuing to investigate,
 Eric

 On Wed, Jul 16, 2008 at 5:31 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 Simply replace Testing with TestingFixed in dispatch.cgi:11 and
 dispatch.fcgi:13 to see the diffenrence :-)

 On Wed, Jul 16, 2008 at 11:28 PM, Eric Mill [EMAIL PROTECTED] wrote:
 Magnus, this is terrific information, thank you for looking into this.

 I'm trying to follow your example - you use ApacheFixer to make a
 TestingFixed class, but never use that class anywhere else.  Do you
 mean for the lines in dispatch.* to use TestingFixed instead of
 Testing?

 I'm trying to use this to resolve my problems as we speak,
 Eric

 On Wed, Jul 16, 2008 at 5:08 PM, Magnus Holm [EMAIL PROTECTED] wrote:
 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
 (http://pastie.org/235062)

 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
 enough).

 Here is a simple app which shows @env (and works on both 1.5 and 2.0):
 http://pastie.org/235078. 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:
 http://rack.rubyforge.org/doc/files/SPEC.html

 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 Rack::Handler::FastCGI.run, 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@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Troubleshooting: Camping 2.0 on CGI on a shared host

2008-07-16 Thread Bluebie, Jenna

Just add it :)
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list