mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #9177: Calling read() or write() now raises ValueError, not AttributeError, on a closed SSL socket.
Patch by Senko Rasic.
This commit is contained in:
parent
60d634ae4a
commit
60a26e0516
4 changed files with 23 additions and 0 deletions
|
@ -2311,6 +2311,21 @@ else:
|
|||
self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_INTERNAL_ERROR')
|
||||
self.assertIn("TypeError", stderr.getvalue())
|
||||
|
||||
def test_read_write_after_close_raises_valuerror(self):
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
||||
context.verify_mode = ssl.CERT_REQUIRED
|
||||
context.load_verify_locations(CERTFILE)
|
||||
context.load_cert_chain(CERTFILE)
|
||||
server = ThreadedEchoServer(context=context, chatty=False)
|
||||
|
||||
with server:
|
||||
s = context.wrap_socket(socket.socket())
|
||||
s.connect((HOST, server.port))
|
||||
s.close()
|
||||
|
||||
self.assertRaises(ValueError, s.read, 1024)
|
||||
self.assertRaises(ValueError, s.write, 'hello')
|
||||
|
||||
|
||||
def test_main(verbose=False):
|
||||
if support.verbose:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue