[mod_python] missing path element in path_info

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed Jul 9 16:32:39 EST 2003



On Wed, 9 Jul 2003, Matt Goodall wrote:

> Is there actually a foolproof way of working out the correct base uri of
> the application (i.e. the path, with or without the app.py) from the
> information in the request alone? The results I would like are below but
> I'm not convinced enough information is available:
>
>   URL                        app base uri         path info
>   -------------------------  -------------------  ----------
>   /~matt/test/               /~matt/test          /
>   /~matt/test/app.py/1/2/3   /~matt/test/app.py   /1/2/3
>   /~matt/test/1/2/3          /~matt/test          /1/2/3

Hmm... This is a flawed question, since path_info in the last line is
really /2/3.

If you look at http://cgi-spec.golux.com/draft-coar-cgi-v11-03.txt section
6.1.6, it formally defines what path info is. However, it relies on the
notion of a "script", which is always present in CGI, but is meaningless
in mod_python since we're not running scripts but provide phase handlers
for apache...

Anyway, the answer to your question is that it is impossible or very
difficult to do, because the transformation from "~matt/test" to
"/home/matt/public_html/test" is not "reversible" and is hidden somewhere
in apache config, yet this mapping is necessary to produce the results
above.

Grisha


More information about the Mod_python mailing list