[mod_python] Re: script_name bug?

Gregory (Grisha) Trubetskoy grisha at modpython.org
Sun Aug 10 20:21:59 EST 2003


On Sat, 9 Aug 2003, Russell Yanofsky wrote:

> Gregory (Grisha) Trubetskoy wrote:
> > Russel -
> >
> > Since mod_python isn't a CGI environment (and doesn't care to be one
> > either), the definition of SCRIPT_NAME is rather blurry.
>
> It might be blurry when a directory handler is used, but it's not at all
> blurry in this case, where mod_python is acting as a handler for
> requests for .py files. SCRIPT_NAME should simply point to the .py file
> that has been requested.

Well, the file requested doesn't have anything to do with what
PythonHandler specifies, e.g. in your example it will respond just the
same with requested url of "/mptest/blahblah.py/abc/123" instead of
"/mptest/mptest.py/abc/123". The question then becomes should SCRIPT_NAME
be "/mptest/mptest.py" or "/mptest/blahblah.py"?

> > I don't think it would be right to tinker with what req.subprocess_env
> > contains - it should return whatever apache put there, uncensored, so
> > to that degree it's not a bug as far as I am concerned.
>
> But, AFAICT, it is tinkering with the value.

It sort of does. There is a place in requestobject.c where it removes the
trailing slash for something, then puts it back, and now I don't remember
why it does it, but it was some rather esoteric condition that caused
apache to infinite-recursively call some function... Since I don't
remember what the reason was, I was always hesitant to remove that bit of
code. It was put in years ago back in the apache 1.2 days, so it might be
safe to remove in 2.0... I guess we can try it at least.

Grisha


More information about the Mod_python mailing list