Message102186
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. |
|
Date |
User |
Action |
Args |
2010-04-02 18:58:29 | dandrzejewski | set | recipients:
+ dandrzejewski |
2010-04-02 18:58:28 | dandrzejewski | set | messageid: <1270234708.91.0.197021276581.issue8293@psf.upfronthosting.co.za> |
2010-04-02 18:58:27 | dandrzejewski | link | issue8293 messages |
2010-04-02 18:58:27 | dandrzejewski | create | |
|