summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-04-19 04:55:30 (GMT)
committerGitHub <noreply@github.com>2021-04-19 04:55:30 (GMT)
commit89d1550d14ba689af12eeb726e4ff8ce73cee7e1 (patch)
treeb74447b5ef927594da10942376ec905b09b03d29 /Lib/test/test_ssl.py
parent49fdf118aeda891401d638ac32296c7d55d54678 (diff)
downloadcpython-89d1550d14ba689af12eeb726e4ff8ce73cee7e1.zip
cpython-89d1550d14ba689af12eeb726e4ff8ce73cee7e1.tar.gz
cpython-89d1550d14ba689af12eeb726e4ff8ce73cee7e1.tar.bz2
bpo-42854: Use SSL_read/write_ex() (GH-25468)
The ssl module now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The functions support reading and writing of data larger than 2 GB. Writing zero-length data no longer fails with a protocol violation error. Signed-off-by: Christian Heimes <christian@python.org>
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 403261d..7b70979 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -1110,6 +1110,17 @@ class BasicSocketTests(unittest.TestCase):
)
self.assertIn(rc, errors)
+ def test_read_write_zero(self):
+ # empty reads and writes now work, bpo-42854, bpo-31711
+ client_context, server_context, hostname = testing_context()
+ server = ThreadedEchoServer(context=server_context)
+ with server:
+ with client_context.wrap_socket(socket.socket(),
+ server_hostname=hostname) as s:
+ s.connect((HOST, server.port))
+ self.assertEqual(s.recv(0), b"")
+ self.assertEqual(s.send(b""), 0)
+
class ContextTests(unittest.TestCase):