shazow/urllib3 — pull request #291 by vincentbesanceney (2013-12-03 14:42:16+00:00)
Title: Ensure connections are properly closed on objects destruction

This fixes the issue raised by @tardyp on https://github.com/kennethreitz/requests/issues/239.

We have not been able to reproduce the scenario on a simple testcase. However, in our environment involving Buildbot, Twisted, and txrequests, the number of connections in a CLOSE_WAIT state grows until we reach the maximum open files limit per process!

While it's still obscure to me what would prevent an HTTPConnection object from being destroyed once it's no longer used, this fix appears to work in our environment, at least we no longer see this CLOSE_WAIT connections leak...