[mod_python] Mysterious 500 error?

Peter Shinners pete at shinners.org
Sat Jul 14 16:27:31 EDT 2007

I have a simple mod_python handler that works correctly for web browsers, 
but fetching with wget gives a 500 Internal Server Error. This is using 
the latest mod_python 2.7 under Apache 1.3.37. I can't see any problem. 
The only different I see is perhaps HTTP/1.1 and HTTP/1.0 ?

You can test the live url here, http://www.shinners.org/iCream/magic.html

Here is the handler code...

def handler(req):
     path = req.uri.split("/", 2)[-1]
     if path == "magic.html":
         req.content_type = "text/html"
         req.status = apache.OK
         req.write("<html><body>It is ok</body></html>")
         return apache.OK
     # ... other urls handled afterwards

On the client end, these are the headers I get back.

Date:Sat, 14 Jul 2007 20:16:07 GMT
Keep-Alive:timeout=5, max=50

Here are the requests I see in the server log. I see a difference between 
HTTP/1.1 and HTTP/1.0 ? - - [14/Jul/2007:16:16:08 -0400] "GET /iCream/magic.html 
HTTP/1.1" - 46 "-" "Mozilla/5.0 (X11; U; Linux i686; en; rv: 
Gecko/20061201 Epiphany/2.18 Firefox/ (Ubuntu-feisty)" - - [14/Jul/2007:16:10:41 -0400] "GET /iCream/magic.html 
HTTP/1.0" - 34 "-" "Wget/1.10.2"

I'm not seeing anything show up in the server error logs, but it doesn't 
look like I'm getting the raw logs given to me.

More information about the Mod_python mailing list