|
Jean Martin
jombo at 2wire.ch
Mon Aug 23 00:16:25 EDT 2004
Hi,
I don't use the publisher, but i take a look and find something interesting
:
As you find if that's not a "GET" or a "POST" an http error is returned to
the client :
publisher.py :
47 req.allow_methods(["GET", "POST"])
48 if req.method not in ["GET", "POST"]:
49 raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED
But somewhere the method "HEAD" is correctly handled :
155 if req.method != "HEAD":
156 req.write(result)
157 else:
158 req.write("")
159 return apache.OK
Since the result is everything that's should be send after the header, this
work.
It's look like the previous code [47-49] was added after but, i don't know
why.
Somebody have an idea ?
Well, you should either write your own handler, or keep the modified
publisher if it fit your needs.
Jim
-----Original Message-----
From: mod_python-bounces at modpython.org
On Behalf Of steven a
Sent: lundi, 23. août 2004 06:38
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
|