File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -675,20 +675,25 @@ def test_data_connection(self):
675
675
# clear text
676
676
sock = self .client .transfercmd ('list' )
677
677
self .assertNotIsInstance (sock , ssl .SSLSocket )
678
+ self .assertEqual (sock .recv (1024 ), LIST_DATA .encode ('ascii' ))
678
679
sock .close ()
679
680
self .assertEqual (self .client .voidresp (), "226 transfer complete" )
680
681
681
682
# secured, after PROT P
682
683
self .client .prot_p ()
683
684
sock = self .client .transfercmd ('list' )
684
685
self .assertIsInstance (sock , ssl .SSLSocket )
686
+ # consume from SSL socket to finalize handshake and avoid
687
+ # "SSLError [SSL] shutdown while in init"
688
+ self .assertEqual (sock .recv (1024 ), LIST_DATA .encode ('ascii' ))
685
689
sock .close ()
686
690
self .assertEqual (self .client .voidresp (), "226 transfer complete" )
687
691
688
692
# PROT C is issued, the connection must be in cleartext again
689
693
self .client .prot_c ()
690
694
sock = self .client .transfercmd ('list' )
691
695
self .assertNotIsInstance (sock , ssl .SSLSocket )
696
+ self .assertEqual (sock .recv (1024 ), LIST_DATA .encode ('ascii' ))
692
697
sock .close ()
693
698
self .assertEqual (self .client .voidresp (), "226 transfer complete" )
694
699
Original file line number Diff line number Diff line change
1
+ Fix ftplib test for TLS 1.3 by reading from data socket.
You can’t perform that action at this time.
0 commit comments