You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Erik Demaine <ed...@mit.edu> on 2005/08/23 22:59:50 UTC

Problem with req.path_info

[As far as I can tell, this is the place to send bugs.
  Apologies if this is not correct.]

Dear Developers,

I find that req.path_info is in some cases set to None instead of a string
such as ''.  My reading of the documentation suggests that req.path_info
should always be a string.

In particular, req.path_info being None causes a crash in cgihandler.
Lines 541--544 of mod_python/apache.py say

     if len(req.path_info) > 0:
         env["SCRIPT_NAME"] = req.uri[:-len(req.path_info)]
     else:
         env["SCRIPT_NAME"] = req.uri

which fails on the first line (the len call) if req.path_info is None.


Circumstance in which req.path_info is set to None:
Apache .htaccess includes
     DirectoryIndex index.html index.py index.cgi
The script is called index.py.
The URI does not mention the script name, just the directory name, as in
     http://www.foo.com/directory_containing_index.py/

(On the other hand, the URI
     http://www.foo.com/directory_with_index.py/index.py
works fine, setting req.path_info to '' as it should.)


Let me know if you need further details.

Erik
-- 
Erik Demaine  |  edemaine@mit.edu  |  http://theory.csail.mit.edu/~edemaine/