Closed workanator closed 8 years ago
Looks good. Thanks for the improvement. Do you think it would be ok to just delete FtpStream::get
and FtpStream::simple_retr
?
Well if we simply delete get
and simple_retr
that may affect existing code but on the other plate the framework is in the early development state and the API could change any time. My opinion is removing get
is the good idea and simple_retr
may retain but it should use retr
.
Also I have an idea that FtpStream
should implement low-level FTP commands RETR
, STOR
, etc. and the framework can contain high-level FTP implementation, say FtpClient
, on top of FtpStream
which provides such functions as simple_retr
.
I like the idea because lower level control is there if needed, but also the high level to make common operations easier. Do you have any idea what other operations would be in the FtpClient
?
Something like download remote file into local file
, upload local file into remote dir/file
, obtain directory listing
.
Ok. If you have any other ideas for this project just create an issue or pull request.
Hello,
the current implementation of
RETR
(FtpStream::get
) is not correct because it does not read response lines after the data stream is read and closed and using the simple implementation (FtpStream::simple_retr
) is not a good idea when files for downloading are big. In the PR I added a new functionFtpStream::retr
which takes an additional argumentreader
which is a closure which operates the data stream and insideretr
all repsonses and dropping of the data stream are handled correctly.In the PR I also added
TYPE
(FtpStream::transfer_type
) function which is very important when the binary file should be transfered.