mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #23804: Fix SSL recv/read(0) to not return 1024 bytes
This commit is contained in:
parent
ce913877e4
commit
f6b1d66a3c
4 changed files with 15 additions and 5 deletions
|
@ -2792,13 +2792,20 @@ else:
|
|||
# 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue