diff options
| author | Thomas Grainger <tagrain@gmail.com> | 2022-12-20 07:10:30 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-20 07:10:30 (GMT) |
| commit | 79ccc03b62d819d83e592c6c8038545d9263a0d4 (patch) | |
| tree | 5f2ea0fd8dd17d889c59d7dd8a3c2adec0d526ee /Lib/test | |
| parent | 36a0b1d0dddbdf324d98071ea31e7e9151eea6d5 (diff) | |
| download | cpython-79ccc03b62d819d83e592c6c8038545d9263a0d4.zip cpython-79ccc03b62d819d83e592c6c8038545d9263a0d4.tar.gz cpython-79ccc03b62d819d83e592c6c8038545d9263a0d4.tar.bz2 | |
gh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Fixes https://github.com/python/cpython/issues/89051
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_ssl.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index e926fc5..d4eb2d2 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1461,6 +1461,8 @@ class ContextTests(unittest.TestCase): if OP_CIPHER_SERVER_PREFERENCE != 0: self.assertEqual(ctx.options & OP_CIPHER_SERVER_PREFERENCE, OP_CIPHER_SERVER_PREFERENCE) + self.assertEqual(ctx.options & ssl.OP_LEGACY_SERVER_CONNECT, + 0 if IS_OPENSSL_3_0_0 else ssl.OP_LEGACY_SERVER_CONNECT) def test_create_default_context(self): ctx = ssl.create_default_context() @@ -3815,6 +3817,20 @@ class ThreadedTests(unittest.TestCase): sni_name=hostname) self.assertIs(stats['compression'], None) + def test_legacy_server_connect(self): + client_context, server_context, hostname = testing_context() + client_context.options |= ssl.OP_LEGACY_SERVER_CONNECT + server_params_test(client_context, server_context, + chatty=True, connectionchatty=True, + sni_name=hostname) + + def test_no_legacy_server_connect(self): + client_context, server_context, hostname = testing_context() + client_context.options &= ~ssl.OP_LEGACY_SERVER_CONNECT + server_params_test(client_context, server_context, + chatty=True, connectionchatty=True, + sni_name=hostname) + @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows") def test_dh_params(self): # Check we can get a connection with ephemeral Diffie-Hellman |
