sid0/firewall-auth — pull request #1 by adarshaj (2012-02-07 10:28:26+00:00)
Title: Lots of CLOSE_WAIT sockets on python 2.6.5 (Ubuntu 10.04 LTS)

The issue is due to improper handling of sockets by HTTPSConnection (http://bugs.python.org/issue10993), a sane way is to do a garbage collect after closing, but instead of collecting after every connection, I think keep_alive is the best place to do it after every successful keepalive request, the last logout conn need not be garbage collected, since the terminating python process would do it anyway.