New submission from David Andrzejewski <site+python....@davidandrzejewski.com>:

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.

----------
components: Library (Lib)
messages: 102186
nosy: dandrzejewski
severity: normal
status: open
title: HTTPSConnection.close() does not immediately close the connection.
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8293>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to