bpo-43794: OpenSSL 3.0.0: set OP_IGNORE_UNEXPECTED_EOF by default (GH… · python/cpython@e18ebd9 · GitHub
Skip to content

Commit e18ebd9

Browse files
bpo-43794: OpenSSL 3.0.0: set OP_IGNORE_UNEXPECTED_EOF by default (GH-25309)
Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 6f37ebc) Co-authored-by: Christian Heimes <christian@python.org>
1 parent a28398e commit e18ebd9

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

Doc/library/ssl.rst

Lines changed: 8 additions & 0 deletions

Lib/test/test_ssl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def data_file(*name):
143143
OP_SINGLE_ECDH_USE = getattr(ssl, "OP_SINGLE_ECDH_USE", 0)
144144
OP_CIPHER_SERVER_PREFERENCE = getattr(ssl, "OP_CIPHER_SERVER_PREFERENCE", 0)
145145
OP_ENABLE_MIDDLEBOX_COMPAT = getattr(ssl, "OP_ENABLE_MIDDLEBOX_COMPAT", 0)
146+
OP_IGNORE_UNEXPECTED_EOF = getattr(ssl, "OP_IGNORE_UNEXPECTED_EOF", 0)
146147

147148
# Ubuntu has patched OpenSSL and changed behavior of security level 2
148149
# see https://bugs.python.org/issue41561#msg389003
@@ -1161,7 +1162,8 @@ def test_options(self):
11611162
# SSLContext also enables these by default
11621163
default |= (OP_NO_COMPRESSION | OP_CIPHER_SERVER_PREFERENCE |
11631164
OP_SINGLE_DH_USE | OP_SINGLE_ECDH_USE |
1164-
OP_ENABLE_MIDDLEBOX_COMPAT)
1165+
OP_ENABLE_MIDDLEBOX_COMPAT |
1166+
OP_IGNORE_UNEXPECTED_EOF)
11651167
self.assertEqual(default, ctx.options)
11661168
ctx.options |= ssl.OP_NO_TLSv1
11671169
self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add :data:`ssl.OP_IGNORE_UNEXPECTED_EOF` constants (OpenSSL 3.0.0)

Modules/_ssl.c

Lines changed: 8 additions & 0 deletions

0 commit comments

Comments
 (0)