[New-bugs-announce] [issue10993] HTTPSConnection does not close when call close() method

Tanakorn Leesatapornwongsa report at bugs.python.org
Mon Jan 24 11:51:43 CET 2011

New submission from Tanakorn Leesatapornwongsa <tanakorn.lsv at gmail.com>:

With this code on python 2.6, I found that HTTPSConnection does not close connection properly.

from httplib import HTTPSConnection

for i in range(1000):
  https = HTTPSConnection("google.com")
  https.request("GET", "/")
  response = https.getresponse()
  print i

After searching python library, I guess that in ssl.py, implementation of close() method of SSLSocket is wrong.
socket.close(self) should not be called when self._makefile_refs < 1 but should be call when self._makefile_refs == 1, isn't it?
I modified the code, made the patch and attached it with this issue.

components: Library (Lib)
files: ssl.py.patch
keywords: patch
messages: 126919
nosy: tanakorn
priority: normal
severity: normal
status: open
title: HTTPSConnection does not close when call close() method
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file20501/ssl.py.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list