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: urllib2 (and urllib) should raise error for incomplete response
Type: behavior Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: gotgenes, orsenthil
Priority: normal Keywords:

Created on 2009-12-05 16:58 by gotgenes, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg95995 - (view) Author: Chris Lasher (gotgenes) Date: 2009-12-05 16:58
This question is motivated by a question on Stack Overflow:
http://stackoverflow.com/questions/1824069/urllib2-not-retrieving-entire-http-response

In the event the user receives an incomplete response when using urllib2
(and urllib), the library should raise an error to indicate the response
is incomplete. This is a matter of checking if the Content-Length
defined in the header matches the size of the retrieved response. While
this can be done by the user, an exception will help alert the more
unwitting, such as myself, by failing early.
msg95997 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-12-05 18:26
urllib and urllib2, by definition, returns a file-like object which
provides a variety of facilities, most common one being a reading the
object to get the content.

What you are asking for is, to read the content, verify if it matches
the Content-Length header, and raise an exception, if the there is a
mis-match. This facility may not be good idea to implement in library,
while it can be (and should be) taken care by the client which is
using the obj.

I am -1 on this request and would like to close this as 'wont-fix'.
msg96438 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-12-15 13:36
This is working as designed.
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51694
2009-12-15 13:36:37orsenthilsetstatus: open -> closed
resolution: wont fix
messages: + msg96438
2009-12-05 18:26:38orsenthilsetnosy: + orsenthil
messages: + msg95997
2009-12-05 16:58:43gotgenescreate