summaryrefslogtreecommitdiff
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-03-27 10:40:22 +0000
committerMartin Panter <vadmium+py@gmail.com>2016-03-27 10:40:22 +0000
commitafd465d49707618f40d3c64fa499a38f9c9db3d2 (patch)
tree6e6efd88fc22bdb81236f159c95cb7c72c99b1ca /Lib/test/test_ssl.py
parent3625af5f2129f8e8735c54bd01d9f138dd5c0e83 (diff)
parent5503d4731e822e90eea387efa37934d2df41c784 (diff)
downloadcpython-git-afd465d49707618f40d3c64fa499a38f9c9db3d2.tar.gz
Issue #26644: Merge SSL negative read fix from 3.5
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 8b72ca9b8a..f86bbc1bf8 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2783,6 +2783,13 @@ if _have_threads:
# consume data
s.read()
+ # read(-1, buffer) is supported, even though read(-1) is not
+ data = b"data"
+ s.send(data)
+ buffer = bytearray(len(data))
+ self.assertEqual(s.read(-1, buffer), len(data))
+ self.assertEqual(buffer, data)
+
# Make sure sendmsg et al are disallowed to avoid
# inadvertent disclosure of data and/or corruption
# of the encrypted data stream
@@ -2792,6 +2799,10 @@ if _have_threads:
s.recvmsg_into, bytearray(100))
s.write(b"over\n")
+
+ self.assertRaises(ValueError, s.recv, -1)
+ self.assertRaises(ValueError, s.read, -1)
+
s.close()
def test_nonblocking_send(self):