|
reghigh
reghigh at thefactz.org
Fri Oct 7 03:30:11 EDT 2005
Gregory (Grisha) Trubetskoy wrote:
>
>
>
> On Thu, 6 Oct 2005, reghigh wrote:
>
>> Also why would /x/x result in two requests but /x/y in one (using
>> <Location /x>)?
>
>
> I don't know, in my test (mod_python 3.1.3, httpd 2.0.54), when no
Just for the record:
Apache/2.0.52 (Unix) mod_auth_pgsql/2.0.1 SVN/1.1.4 DAV/2
mod_python/3.1.4 Python/2.4.1 Server at static Port 80
> actual 'x' directory exists, the traversal stops right there. When x
> does exist, it is called for /x/y, which is at it should be - it assumes
> that 'y' is a file in the directory 'x' (even if y does not exist).
Note one can get similar results adding a trailing slash (so that y
becomes a directory)
> Also there are a couple of other things in your prior e-mail that do not
> make a lot of sense. Given:
>
> <VirtualHost *:80>
> ServerName static
> DocumentRoot <omitted>
>
> PythonPath "['<omitted>'] + sys.path"
> PythonAuthenHandler test
> PythonDebug On
>
> <Location /x>
> AuthType Basic
> AuthName "Restricted Area"
> Require valid-user
> </Location>
> </VirtualHost>
>
> You say that
>
> /xx -> not processed by handler
>
> that cannot be if the "PythonAuthenHandler test" is at the VirtualHost
But my understanding is that authen stuff only gets called where we put
in the Apache auth stuff i.e. AuthType, AuthName, Require (I checked
this by keeping mod_python stuff and commenting out AuthType etc and
bingo no authentication and no exceptions from my python stuff). Since
apache auth stuff is inside Location /x (which does *not* match /xx) /xx
is not processed by authenhandler. Furthermore moving all mod_python
stuff inside Location makes no difference.
> level. I also don't see SetHandler/AddHandler for mod_python - is that
> at the server level?
On the second point: currently there is no AddHandler/SetHandler because
I found authenhandler was running without having this (my aim is to just
use mod_python for authentication and then have apache serve everything
else 'normally' -- btw this works entirely except for the multiple calls
problem). However in the interests of checking I had orginally had:
AddHandler mod_python .py
PythonHandler test
def handler(req):
req.content_type = "text/plain"
req.write(req.uri)
return apache.OK
And I have just re-added this but it makes no difference so far as I can
tell (furthermore I have verified this works fine in all ways if I
remove exception)
> Also I'm not sure how your request continues processing even though
> you're raising an exception - in my test the request processing stops
> with 'Internal Server Error' as soon as the first exception is raised.
Here's the output I get for <Location /x> with url:
http://static/x/x/y
<pre>
Mod_python error: "PythonAuthenHandler test"
Traceback (most recent call last):
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/apache.py",
line 299, in HandlerDispatch
result = object(req)
File "/Users/rgrp/Sites/python/test.py", line 16, in authenhandler
raise Exception('%s, %s, %s, %s' % (req.handler, req.unparsed_uri,
req.path_info, req.used_path_info))
Exception: None, /x/y, /y, 2
</pre>
<pre>
Mod_python error: "PythonAuthenHandler test"
Traceback (most recent call last):
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/apache.py",
line 299, in HandlerDispatch
result = object(req)
File "/Users/rgrp/Sites/python/test.py", line 16, in authenhandler
raise Exception('%s, %s, %s, %s' % (req.handler, req.unparsed_uri,
req.path_info, req.used_path_info))
Exception: None, /x/x/y, /x/y, 2
</pre>
> In any event - when the authen handler is called is not controlled by
> mod_python, it's something that is in the httpd territory. It would be
> nice perhaps to get to the bottom of what this behaviour should be and
> summarize it for the list.
Absolutely. Thanks for your comments so far.
Regards,
Tristan
|