summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-03-28 01:09:13 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-03-28 01:09:13 (GMT)
commitef4bb1e994fbb7cab5ae29bb1d6763e0e7306642 (patch)
tree2cf15b4e15a7053009b24a9bbcdba0231725acbd /Lib/test
parent2a65ecb780e2a5cd47bc4b9af947b1127e972a11 (diff)
parentf6b1d66a3ca060247e03e7b198db8a5a966b836e (diff)
downloadcpython-ef4bb1e994fbb7cab5ae29bb1d6763e0e7306642.zip
cpython-ef4bb1e994fbb7cab5ae29bb1d6763e0e7306642.tar.gz
cpython-ef4bb1e994fbb7cab5ae29bb1d6763e0e7306642.tar.bz2
Issue #23804: Merge SSL zero read fix from 3.5
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ssl.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index f86bbc1b..e0f231c 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2783,13 +2783,20 @@ if _have_threads:
# consume data
s.read()
- # read(-1, buffer) is supported, even though read(-1) is not
data = b"data"
+
+ # read(-1, buffer) is supported, even though read(-1) is not
s.send(data)
buffer = bytearray(len(data))
self.assertEqual(s.read(-1, buffer), len(data))
self.assertEqual(buffer, data)
+ # recv/read(0) should return no data
+ s.send(data)
+ self.assertEqual(s.recv(0), b"")
+ self.assertEqual(s.read(0), b"")
+ self.assertEqual(s.read(), data)
+
# Make sure sendmsg et al are disallowed to avoid
# inadvertent disclosure of data and/or corruption
# of the encrypted data stream