dani-garcia / rust_async_ftp

Fork of https://crates.io/crates/ftp with tokio async support
Apache License 2.0
21 stars 14 forks source link

FtpStream::get() doesn't read status::CLOSING_DATA_CONNECTION #13

Open djc opened 2 years ago

djc commented 2 years ago

While FtpStream::retr() tries to read a status after reading from the stream, it looks like FtpStream::get() doesn't do this. When we wrote some code that calls get() and completes successfully, then call FtpStream::quit(), it errored out because it read an unexpected error code off the stream:

thread 'main' panicked at 'downloader encountered a critical error: FTP InvalidResponse: Expected code [221], got response: 226 Transfer complete
', downloader/src/bin/downloader.rs:78:10

Maybe it should wrap the BufReader in another type that Derefs to the BufReader but tries to read out the status code on Drop?