mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Bug #978833: Close https sockets by releasing the _ssl object.
This commit is contained in:
parent
ec2ce9bbae
commit
f25e35b9ec
4 changed files with 28 additions and 0 deletions
|
@ -106,6 +106,25 @@ class BasicTests(unittest.TestCase):
|
|||
connector()
|
||||
t.join()
|
||||
|
||||
def test_978833(self):
|
||||
if test_support.verbose:
|
||||
print "test_978833 ..."
|
||||
|
||||
import os, httplib
|
||||
with test_support.transient_internet():
|
||||
s = socket.socket(socket.AF_INET)
|
||||
s.connect(("www.sf.net", 443))
|
||||
fd = s._sock.fileno()
|
||||
sock = httplib.FakeSocket(s, socket.ssl(s))
|
||||
s = None
|
||||
sock.close()
|
||||
try:
|
||||
os.fstat(fd)
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
raise test_support.TestFailed("Failed to close socket")
|
||||
|
||||
class OpenSSLTests(unittest.TestCase):
|
||||
|
||||
def testBasic(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue