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.

Author mcjeff
Recipients brett.cannon, mcjeff, orsenthil
Date 2011-03-17.18:30:47
SpamBayes Score 2.0809728e-07
Marked as misclassified No
Message-id <1300386650.82.0.0778699225107.issue11563@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-03-17 18:30:51mcjeffsetrecipients: + mcjeff, brett.cannon, orsenthil
2011-03-17 18:30:50mcjeffsetmessageid: <1300386650.82.0.0778699225107.issue11563@psf.upfronthosting.co.za>
2011-03-17 18:30:47mcjefflinkissue11563 messages
2011-03-17 18:30:47mcjeffcreate