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()
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
SSL_OP_CIPHER_SERVER_PREFERENCE);
PyModule_AddIntConstant(m, "OP_SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE);
PyModule_AddIntConstant(m, "OP_NO_TICKET", SSL_OP_NO_TICKET);
+ PyModule_AddIntConstant(m, "OP_LEGACY_SERVER_CONNECT",
+ SSL_OP_LEGACY_SERVER_CONNECT);
#ifdef SSL_OP_SINGLE_ECDH_USE
PyModule_AddIntConstant(m, "OP_SINGLE_ECDH_USE", SSL_OP_SINGLE_ECDH_USE);
#endif