@@ -329,7 +329,7 @@ impl FtpStream {
329
329
self . read_response_in ( & [ status:: ABOUT_TO_SEND , status:: ALREADY_OPEN ] )
330
330
. and_then ( |_| reader ( & mut data_stream) )
331
331
} . and_then ( |res|
332
- self . read_response ( status:: CLOSING_DATA_CONNECTION ) . map ( |_| res) )
332
+ self . read_response_in ( & [ status:: CLOSING_DATA_CONNECTION , status :: REQUESTED_FILE_ACTION_OK ] ) . map ( |_| res) )
333
333
}
334
334
335
335
/// Simple way to retr a file from the server. This stores the file in memory.
@@ -378,11 +378,12 @@ impl FtpStream {
378
378
/// This stores a file on the server.
379
379
pub fn put < R : Read > ( & mut self , filename : & str , r : & mut R ) -> Result < ( ) > {
380
380
try!( self . put_file ( filename, r) ) ;
381
- self . read_response ( status:: CLOSING_DATA_CONNECTION ) . map ( |_| ( ) )
381
+ self . read_response_in ( & [ status:: CLOSING_DATA_CONNECTION , status:: REQUESTED_FILE_ACTION_OK ] )
382
+ . map ( |_| ( ) )
382
383
}
383
384
384
385
/// Execute a command which returns list of strings in a separate stream
385
- fn list_command ( & mut self , cmd : Cow < ' static , str > , open_code : u32 , close_code : u32 ) -> Result < Vec < String > > {
386
+ fn list_command ( & mut self , cmd : Cow < ' static , str > , open_code : u32 , close_code : & [ u32 ] ) -> Result < Vec < String > > {
386
387
let mut lines: Vec < String > = Vec :: new ( ) ;
387
388
{
388
389
let mut data_stream = BufReader :: new ( try!( self . data_command ( & cmd) ) ) ;
@@ -398,7 +399,7 @@ impl FtpStream {
398
399
}
399
400
}
400
401
401
- self . read_response ( close_code) . map ( |_| lines)
402
+ self . read_response_in ( close_code) . map ( |_| lines)
402
403
}
403
404
404
405
/// Execute `LIST` command which returns the detailed file listing in human readable format.
@@ -407,7 +408,7 @@ impl FtpStream {
407
408
pub fn list ( & mut self , pathname : Option < & str > ) -> Result < Vec < String > > {
408
409
let command = pathname. map_or ( "LIST\r \n " . into ( ) , |path| format ! ( "LIST {}\r \n " , path) . into ( ) ) ;
409
410
410
- self . list_command ( command, status:: ABOUT_TO_SEND , status:: CLOSING_DATA_CONNECTION )
411
+ self . list_command ( command, status:: ABOUT_TO_SEND , & [ status:: CLOSING_DATA_CONNECTION , status :: REQUESTED_FILE_ACTION_OK ] )
411
412
}
412
413
413
414
/// Execute `NLST` command which returns the list of file names only.
@@ -416,7 +417,7 @@ impl FtpStream {
416
417
pub fn nlst ( & mut self , pathname : Option < & str > ) -> Result < Vec < String > > {
417
418
let command = pathname. map_or ( "NLST\r \n " . into ( ) , |path| format ! ( "NLST {}\r \n " , path) . into ( ) ) ;
418
419
419
- self . list_command ( command, status:: ABOUT_TO_SEND , status:: CLOSING_DATA_CONNECTION )
420
+ self . list_command ( command, status:: ABOUT_TO_SEND , & [ status:: CLOSING_DATA_CONNECTION , status :: REQUESTED_FILE_ACTION_OK ] )
420
421
}
421
422
422
423
/// Retrieves the modification time of the file at `pathname` if it exists.
0 commit comments