Jeff McNeil <j...@jmcneil.net> added the comment:

So, it turned out to be more complicated than that.  The HTTPConnection object 
returns an HTTPResponse, but never closes the underlying socket after calling 
makesock. 

Since persistent connections aren't supported, nothing actually closes  the 
socket itself, it's just set to None.  Explicitly calling a close turns out not 
to be correct either.

I went down the same path as AbstractHTTPHandler and added a Connection: close 
header.  That ensures that the remote host will close the underlying connection 
(more importantly, setting the HTTP Response object's will_close to True).  
That ensures  HTTPConnection performs in a "fire and forget" mode, causing 
everything to close out as it should.

I contemplated changing urlretrieve to use build_opener as urlopen does, but I 
figure that would have been done by now if it was a trivial operation. I'd be 
happy to take a whack at it if it's just a matter of getting around to it.

----------
keywords: +patch
Added file: http://bugs.python.org/file21273/11562.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11563>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to