[mod_python] Attempting to use mod_python on a site which uses digest autentication

Stephen Vermeulen stephen at vermeulen.ca
Wed Apr 20 23:39:20 EDT 2005


I am trying to use the publisher handler. I have a basic test using 
mod_python working, but when I add
digest authentication to the directories on the web server it stops 
working. I am not trying to handle the
authentication with mod_python, rather I'm letting apache do its thing.

The test python script looks like:

def email(req, name, email, comment):
    s = """\
Dear %s,<br>
Thank you for your comment:
<blockquote>
%s
</blockquote>
We will hound you without mercy at: <b>%s</b>
</html>""" % (name, comment, email)
    return s

and the apache directory block (which does not work) looks like:

<Directory /home/files/web/extras>
AuthName "test"
AuthType Digest
AuthDigestFile "/etc/apache2/digestusers"
require user testuser
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
#allow from all
</Directory>

and I get the following error message in the browser (firefox):
-----------


  Bad Request

Your browser sent a request that this server could not understand.


---------

If I switch it to the following (i.e. turn off authentication) it works:

<Directory /home/files/web/extras>
#AuthName "test"
#AuthType Digest
#AuthDigestFile "/etc/apache2/digestusers"
#require user testuser
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
allow from all
</Directory>

---------

If I switch it to doing basic authentication with the the following it 
also works:

<Directory /home/files/web/extras>
AuthName "test"
AuthType Basic
AuthUserFile "/etc/apache2/basicusers"
require user testuser
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
#allow from all
</Directory>

This is all with an Apache 2 server on Linux.


Thanks,

Stephen



More information about the Mod_python mailing list