Robert Xiao <[email protected]> added the comment:
Seconded. #12133 inadvertently closes the response object if the server fails
to indicate "Connection: close". In my case, Amazon S3 (s3.amazonaws.com)
causes this problem:
(Python 3.2)
>>> conn =
>>> urllib.request.urlopen('http://s3.amazonaws.com/SurveyMonkeyFiles/VPAT_SurveyMonkey.pdf')
>>> len(conn.read())
27692
(Python 3.2.1)
>>> conn =
>>> urllib.request.urlopen('http://s3.amazonaws.com/SurveyMonkeyFiles/VPAT_SurveyMonkey.pdf')
>>> len(conn.read())
0
The problem is that S3 doesn't send back a "Connection: close" header, so when
h.close() is called from request.py, the request object is also closed;
consequently, conn.fp is None and so conn.read() returns an empty bytes object.
This is a clear regression due to the patch in #12133.
----------
nosy: +nneonneo
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12576>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com