@@ -1685,6 +1685,8 @@ def _assert_context_options(self, ctx):
1685
1685
if OP_CIPHER_SERVER_PREFERENCE != 0 :
1686
1686
self .assertEqual (ctx .options & OP_CIPHER_SERVER_PREFERENCE ,
1687
1687
OP_CIPHER_SERVER_PREFERENCE )
1688
+ self .assertEqual (ctx .options & ssl .OP_LEGACY_SERVER_CONNECT ,
1689
+ 0 if IS_OPENSSL_3_0_0 else ssl .OP_LEGACY_SERVER_CONNECT )
1688
1690
1689
1691
def test_create_default_context (self ):
1690
1692
ctx = ssl .create_default_context ()
@@ -4073,6 +4075,20 @@ def test_compression_disabled(self):
4073
4075
sni_name = hostname )
4074
4076
self .assertIs (stats ['compression' ], None )
4075
4077
4078
+ def test_legacy_server_connect (self ):
4079
+ client_context , server_context , hostname = testing_context ()
4080
+ client_context .options |= ssl .OP_LEGACY_SERVER_CONNECT
4081
+ server_params_test (client_context , server_context ,
4082
+ chatty = True , connectionchatty = True ,
4083
+ sni_name = hostname )
4084
+
4085
+ def test_no_legacy_server_connect (self ):
4086
+ client_context , server_context , hostname = testing_context ()
4087
+ client_context .options &= ~ ssl .OP_LEGACY_SERVER_CONNECT
4088
+ server_params_test (client_context , server_context ,
4089
+ chatty = True , connectionchatty = True ,
4090
+ sni_name = hostname )
4091
+
4076
4092
@unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4077
4093
def test_dh_params (self ):
4078
4094
# Check we can get a connection with ephemeral Diffie-Hellman
0 commit comments