@@ -5712,11 +5712,18 @@ def test_internal_chain_server(self):
57125712 def test_internal_chain_server_resumed_session (self ):
57135713 # A session resumed from a ticket stores the client's certificate
57145714 # but not the chain it was sent with.
5715+ for version in ssl .TLSVersion .TLSv1_2 , ssl .TLSVersion .TLSv1_3 :
5716+ if not has_tls_version (version ):
5717+ continue
5718+ with self .subTest (version = version .name ):
5719+ self .check_chain_server_resumed_session (version )
5720+
5721+ def check_chain_server_resumed_session (self , version ):
57155722 client_context , server_context , hostname = testing_context ()
57165723 client_context .load_cert_chain (SIGNED_CERTFILE )
57175724 server_context .verify_mode = ssl .CERT_REQUIRED
5718- # TODO: sessions aren't compatible with TLSv1.3 yet
5719- client_context .maximum_version = ssl . TLSVersion . TLSv1_2
5725+ client_context . minimum_version = version
5726+ client_context .maximum_version = version
57205727
57215728 server = ThreadedEchoServer (context = server_context , chatty = False )
57225729 with server :
@@ -5725,6 +5732,11 @@ def test_internal_chain_server_resumed_session(self):
57255732 server_hostname = hostname
57265733 ) as s :
57275734 s .connect ((HOST , server .port ))
5735+ s .write (b'UNVERIFIEDCHAIN\n ' )
5736+ res = s .recv (1024 )
5737+ self .assertEqual (res , b'\x02 \n ' )
5738+ # TLS 1.3 sends the ticket after the handshake, so only
5739+ # get the session once data was received.
57285740 session = s .session
57295741 self .assertTrue (session .has_ticket )
57305742 with client_context .wrap_socket (
0 commit comments