[Python-bugs-list] [ python-Bugs-622042 ] httplib HEAD request fails - keepalive

noreply@sourceforge.net noreply@sourceforge.net
Fri, 11 Oct 2002 13:15:36 -0700


Bugs item #622042, was opened at 2002-10-11 16:15
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=622042&group_id=5470

Category: Python Library
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Mihai Ibanescu (misa)
Assigned to: Nobody/Anonymous (nobody)
Summary: httplib HEAD request fails - keepalive

Initial Comment:
httplib fails to handle HEAD requests correctly when
the server side honors a keep-alive connection.

Per RFC2616, sect. 9.4:

<quot>
The HEAD method is identical to GET except that the
server MUST NOT return a message-body in the response.
The metainformation contained in the HTTP headers in
the response to a HEAD request SHOULD be identical to
the information sent in response to a GET request.
</quot>

This means that HEAD requests are likely to return a
non-zero Content-Length, but with no body.

The attached script, if called against an HTTP/1.1,
keep-alive-aware server (try www.microsoft.com or
www.redhat.com) will hang instead of finishing, because
read() will expect to read some bytes from the connection.

The script was tested against version 1.66 of httplib
(the current HEAD).

HTTP/1.0 and Connection: close (with HTTP/1.1) work as
expected because the server closes the connection.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=622042&group_id=5470