[mod_python] Why do I get a 405 ERROR on HEAD REQUEST?

steven a ossix at ossix.net
Mon Aug 23 05:37:34 EDT 2004


hmm,

it seems that adding "HEAD" to this code in modpython/publisher.py fixes 
the issue:

(around line 41)

def handler(req):
    req.allow_methods(["GET", "POST"])
    if req.method not in ["GET", "POST"]:


is there a more elegant way to fix this?  why does the publisher handler 
set the allowable methods?  shouldn't i have control over that?   do i 
and just not know it?  or do i just have to create my  own publisher?

thanks,s

steven a wrote:

> Why do I get a 405 ERROR on HEAD REQUEST?
>
> Here is an example request when using mod_python.publisher:
>
> bash-2.05b$ telnet my.host.org 80
> Trying 55.55.55.55...
> Connected to my.host.org.
> Escape character is '^]'.
> HEAD /python/viva.py/list HTTP/1.1
> Host: my.host.org
>
> HTTP/1.1 405 Method Not Allowed
> Date: Sun, 22 Aug 2004 20:08:02 GMT
> Server: Apache/2.0.50 (Gentoo/Linux) mod_python/3.1.3 Python/2.3.3 
> mod_ssl/2.0.50 OpenSSL/0.9.7d
> Allow: GET,HEAD,POST,TRACE
> Content-Type: text/html; charset=iso-8859-1
>
> Connection closed by foreign host.
>
>
> Thanks,
> s
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python




More information about the Mod_python mailing list