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 @@ -880,18 +880,23 @@ def test_data_connection(self):
880
880
# clear text
881
881
with self .client .transfercmd ('list' ) as sock :
882
882
self .assertNotIsInstance (sock , ssl .SSLSocket )
883
+ self .assertEqual (sock .recv (1024 ), LIST_DATA .encode ('ascii' ))
883
884
self .assertEqual (self .client .voidresp (), "226 transfer complete" )
884
885
885
886
# secured, after PROT P
886
887
self .client .prot_p ()
887
888
with self .client .transfercmd ('list' ) as sock :
888
889
self .assertIsInstance (sock , ssl .SSLSocket )
890
+ # consume from SSL socket to finalize handshake and avoid
891
+ # "SSLError [SSL] shutdown while in init"
892
+ self .assertEqual (sock .recv (1024 ), LIST_DATA .encode ('ascii' ))
889
893
self .assertEqual (self .client .voidresp (), "226 transfer complete" )
890
894
891
895
# PROT C is issued, the connection must be in cleartext again
892
896
self .client .prot_c ()
893
897
with self .client .transfercmd ('list' ) as sock :
894
898
self .assertNotIsInstance (sock , ssl .SSLSocket )
899
+ self .assertEqual (sock .recv (1024 ), LIST_DATA .encode ('ascii' ))
895
900
self .assertEqual (self .client .voidresp (), "226 transfer complete" )
896
901
897
902
def test_login (self ):
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