@@ -1631,17 +1631,22 @@ async def client(addr):
1631
1631
self .fail ("unexpected call to connection_made()" )
1632
1632
1633
1633
def test_ssl_connect_accepted_socket (self ):
1634
- if hasattr (ssl , 'PROTOCOL_TLS' ):
1635
- proto = ssl .PROTOCOL_TLS
1634
+ if hasattr (ssl , 'PROTOCOL_TLS_SERVER' ):
1635
+ server_proto = ssl .PROTOCOL_TLS_SERVER
1636
+ client_proto = ssl .PROTOCOL_TLS_CLIENT
1636
1637
else :
1637
- proto = ssl .PROTOCOL_SSLv23
1638
- server_context = ssl .SSLContext (proto )
1638
+ if hasattr (ssl , 'PROTOCOL_TLS' ):
1639
+ client_proto = server_proto = ssl .PROTOCOL_TLS
1640
+ else :
1641
+ client_proto = server_proto = ssl .PROTOCOL_SSLv23
1642
+
1643
+ server_context = ssl .SSLContext (server_proto )
1639
1644
server_context .load_cert_chain (self .ONLYCERT , self .ONLYKEY )
1640
1645
if hasattr (server_context , 'check_hostname' ):
1641
1646
server_context .check_hostname = False
1642
1647
server_context .verify_mode = ssl .CERT_NONE
1643
1648
1644
- client_context = ssl .SSLContext (proto )
1649
+ client_context = ssl .SSLContext (client_proto )
1645
1650
if hasattr (server_context , 'check_hostname' ):
1646
1651
client_context .check_hostname = False
1647
1652
client_context .verify_mode = ssl .CERT_NONE
@@ -2234,8 +2239,7 @@ def test_renegotiation(self):
2234
2239
sslctx .use_privatekey_file (self .ONLYKEY )
2235
2240
sslctx .use_certificate_chain_file (self .ONLYCERT )
2236
2241
client_sslctx = self ._create_client_ssl_context ()
2237
- if hasattr (ssl , 'OP_NO_TLSv1_3' ):
2238
- client_sslctx .options |= ssl .OP_NO_TLSv1_3
2242
+ client_sslctx .maximum_version = ssl .TLSVersion .TLSv1_2
2239
2243
2240
2244
def server (sock ):
2241
2245
conn = openssl_ssl .Connection (sslctx , sock )
@@ -2593,8 +2597,7 @@ def test_flush_before_shutdown(self):
2593
2597
sslctx_openssl .use_privatekey_file (self .ONLYKEY )
2594
2598
sslctx_openssl .use_certificate_chain_file (self .ONLYCERT )
2595
2599
client_sslctx = self ._create_client_ssl_context ()
2596
- if hasattr (ssl , 'OP_NO_TLSv1_3' ):
2597
- client_sslctx .options |= ssl .OP_NO_TLSv1_3
2600
+ client_sslctx .maximum_version = ssl .TLSVersion .TLSv1_2
2598
2601
2599
2602
future = None
2600
2603
0 commit comments