Hmmm, I should check code first. This is already rectified in latest subversion
copy of source code:
if req.path_info and len(req.path_info) > 0:
env["SCRIPT_NAME"] = req.uri[:-len(req.path_info)]
else:
env["SCRIPT_NAME"] = req.uri
No need to log a bug report. It will be fixed in 3. anyway.
Graham Dumpleton wrote ..
> Erik Demaine wrote ..
> > [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.
>
> Should read, will be string if set, otherwise None. There are a other
> members of the request object which are similar, eg, req.finfo, where
> the values can also be None as well as the indicated type.
>
> In effect it just passes through what Apache sets it to, in the
> circumstances you indicate, it is Apache that is leaving the value as a
> null pointer and mod_python is simply propogating that.
>
> > 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.
>
> Yes, it would appear that it needs fixing. Unless one of the developers
> does it before you, you can log a bug report at:
>
> http://issues.apache.org/jira/browse/MODPYTHON?report=select
>
> > 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 | [EMAIL PROTECTED] |
> > http://theory.csail.mit.edu/~edemaine/