This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: httplib: HTTPResponse not storing response body
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Guthur, crchemist
Priority: normal Keywords:

Created on 2009-06-01 15:59 by Guthur, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg88648 - (view) Author: (Guthur) Date: 2009-06-01 15:59
HTTPResponse does not store the HTTP response body while it does store 
the response headers, which in my opinion makes it rather useless as a 
HTTP response abstraction object. 

The only way to obtain the response body is to call HTTPResponse.Read
([amt]) and store the body seperately, this must also be carried out 
before the connection is closed, which makes no sense as the server 
serves both HEADERs and BODY together.

I can think of no real reason why this should be the case HTTP already 
provides a method for receiving just the headers with the HEAD request 
type.

Keynotes: HTTPResponse should store the body, if received, as well as 
the headers.
msg88656 - (view) Author: Mykola Kharechko (crchemist) Date: 2009-06-01 17:13
HTTPResponse can't store body because it can be huge (some film or
something else).
msg88663 - (view) Author: (Guthur) Date: 2009-06-01 18:23
But it must be somewhere, you don't make a seperate request to the 
server for the body, you just make the single HTTP request and the 
server serves that request.

Also this is surely aimed at developers, we can make the decision 
whether or not it is too large, and simply to, by making a HEAD request 
and checking the content-length header, and if its not available then 
don't continue with the request if we chose to take that action.

The point is that with out a body its not a HTTP response.

Admittedly some sort of streaming to file facility might be needed for 
the large requests, and that may require a significant effort to add.

Even if this can not be changed I think it should be clearly stated in 
the documentation that the request body needs to be explicitly read; I 
was trying to access it after making my request but of course it wasn't 
available, but the headers were and all status pointed to the request 
being served, which was rather confusing.

Thanks for the reply
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50411
2009-06-01 23:42:15Guthursetstatus: open -> closed
2009-06-01 18:23:53Guthursetmessages: + msg88663
2009-06-01 17:13:49crchemistsetnosy: + crchemist
messages: + msg88656
2009-06-01 16:57:49Guthursettitle: HTTPResponse not storing response body -> httplib: HTTPResponse not storing response body
2009-06-01 15:59:27Guthurcreate