Bug #729

Incorrect PATH_INFO when FastCGI is serving "/"

Added by Anonymous almost 8 years ago. Updated almost 5 years ago.

Status:FixedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:mod_fastcgi
Target version:1.4.23
Missing in 1.5.x:

Description

When mod_fastcgi is serving "/" i.e. configured as following


fastcgi.server = (
   "/" => (
      ...
   )
)

it produces wrong SCRIPT_NAME and PATH_INFO.

For example, request for /test/url is represented as


SCRIPT_NAME = "/test" 
PATH_INFO = "/url" 

while it has to be


SCRIPT_NAME = "" 
PATH_INFO = "/test/url" 

Interesting that mod_scgi doesn't have that issue.

729.patch Magnifier - One slightly hacky fix for mod_fastcgi, needs porting to mod_scgi (and more testing!) (1.16 KB) dg, 2006-11-03 20:57

Associated revisions

Revision 2421
Added by stbuehler about 5 years ago

Fix workaround for incorrect path info/scriptname if fastcgi prefix is "/" (fixes #729)

Revision 2498
Added by stbuehler almost 5 years ago

Fix workaround for incorrect path info/scriptname if scgi prefix is "/" (fixes #729)

History

#1 Updated by Anonymous almost 8 years ago

This occurs when mapping any URL ending in "/" to FastCGI. The same mapping with the ending "/" removed works correctly.

-- mgood

#2 Updated by Anonymous over 7 years ago

This causes problems for trac, when it is sitting in the root directory. See trac bug 2418.

-- teg

#3 Updated by Anonymous over 7 years ago

Any idea why this has not been checked in? It doesn't look hackish, given we also port it to all places using the same code.

#4 Updated by Anonymous about 7 years ago

FWIW, the above patch fixes this bug for mod_scgi as well (in my case, tested with DrProject).

-- shot

#5 Updated by Anonymous almost 7 years ago

I've been hit by the same problem when trying to use Moin as the root URI.

There is no straightforward solution to this, as there is no generic pattern for splitting the URI in SCRIPT_NAME and PATH_INFO. In some cases you want the whole URI in PATH_INFO, in some other cases you want SCRIPT_NAME to be set, and you could imagine thousands of other cases.

I'd like this to be fixed by a URI => PATH_INFO mapping, with a new configuration variable. The result could look like this:

fastcgi.path_info = (
"^/(admin|stats)/(.*)" => ("/$1", "/$2"),
"^(.*)$" => ("", "$1"),
)

This way /admin/foo would lead to SCRIPT_NAME="/admin" and PATH_INFO="/foo", while /bar would lead to SCRIPT_NAME="" and PATH_INFO="/bar".

-- joss

#6 Updated by Anonymous over 6 years ago

The problem is still present on 1.4.16...

-- lindevel

#7 Updated by Anonymous about 6 years ago

And still in 1.4.18, it seems...

-- lindevel

#8 Updated by Anonymous about 6 years ago

This patch works great for me. I couldn't get a Mercurial repository (hgwebdir cgi script) working on my web server without it.

Please include it!

-- schnouki

#9 Updated by moo almost 6 years ago

  • Status changed from New to Assigned

#10 Updated by moo almost 6 years ago

this problem is fixed in 1.5.0, i'm working out a solution to this for 1.4.x

#11 Updated by moo almost 6 years ago

  • Status changed from Assigned to Fixed
  • Resolution set to fixed

fixed in r2182, use "fix-root-scriptname" => "enable" to workaround, untested yet. can u pls test it?

#12 Updated by stbuehler almost 5 years ago

  • Target version changed from 1.4.20 to 1.4.23

Didn't work, fixed in r2421 (fastcgi) and r2498 (scgi).

#13 Updated by PaulM almost 5 years ago

r2421 fixed the problem for me. Thanks!

Also available in: Atom