Issue #23804: Merge SSL zero read fix from 3.5

This commit is contained in:
Martin Panter 2016-03-28 01:09:13 +00:00
commit ef4bb1e994
4 changed files with 15 additions and 5 deletions

View file

@ -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