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 dandrzejewski
Recipients dandrzejewski
Date 2010-04-02.18:58:26
SpamBayes Score 2.9927e-08
Marked as misclassified No
Message-id <1270234708.91.0.197021276581.issue8293@psf.upfronthosting.co.za>
In-reply-to
Content
Python 2.6.4, Windows XP.

If you run the following code:

import httplib

http_connection = httplib.HTTPConnection("192.168.192.196")
http_connection.request("GET", "/")
http_connection.sock.settimeout(20)
response = http_connection.getresponse()
data = response.read()
http_connection.close()


And then run a netstat -a, you'll see that the connection is no longer established (it'll have a status of TIME_WAIT or something along those lines).

However, if you run the following code:

import httplib

http_connection = httplib.HTTPSConnection("192.168.192.196")
http_connection.request("GET", "/")
http_connection.sock.settimeout(20)
response = http_connection.getresponse()
data = response.read()
http_connection.close()

And run a netstat, the connection will still be in the ESTABLISHED state.  The connection does not end for several minutes (or when you terminate the program).

I can get the connection to end when I want it by doing a del on the connection object and then manually running garbage collection - although that seems a bit wonky.

I'm not really sure what all the differences are between HTTPConnection and HTTPSConnection, but it seems like they should both behave the same way in this regard.
History
Date User Action Args
2010-04-02 18:58:29dandrzejewskisetrecipients: + dandrzejewski
2010-04-02 18:58:28dandrzejewskisetmessageid: <1270234708.91.0.197021276581.issue8293@psf.upfronthosting.co.za>
2010-04-02 18:58:27dandrzejewskilinkissue8293 messages
2010-04-02 18:58:27dandrzejewskicreate