Project

General

Profile

Actions

Bug #729

closed

Incorrect PATH_INFO when FastCGI is serving "/"

Added by Anonymous almost 18 years ago. Updated almost 15 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_fastcgi
Target version:
ASK QUESTIONS IN Forums:

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.


Files

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

Updated by Anonymous almost 18 years ago

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

-- mgood

Actions #2

Updated by Anonymous over 17 years ago

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

-- teg

Actions #3

Updated by Anonymous over 17 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.

Actions #4

Updated by Anonymous about 17 years ago

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

-- shot

Actions #5

Updated by Anonymous almost 17 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

Actions #6

Updated by Anonymous over 16 years ago

The problem is still present on 1.4.16...

-- lindevel

Actions #7

Updated by Anonymous about 16 years ago

And still in 1.4.18, it seems...

-- lindevel

Actions #8

Updated by Anonymous about 16 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

Actions #9

Updated by moo almost 16 years ago

  • Status changed from New to Assigned
Actions #10

Updated by moo almost 16 years ago

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

Actions #11

Updated by moo almost 16 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?

Actions #12

Updated by stbuehler almost 15 years ago

  • Target version changed from 1.4.20 to 1.4.23

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

Actions #13

Updated by PaulM almost 15 years ago

r2421 fixed the problem for me. Thanks!

Actions

Also available in: Atom