Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
native-tls
feature gatedFrom
impl for FtpError to use?
inftp.rs
@ChristianVisintin you might be interested 🙂
@mattnenterprise I guess you have a notification as maintainer but in case ^^
Notes on changes
Dependencies
I've removed the minor and patch versions in dependencies as that's equivalent to the carret condition which is what cargo uses by default (see cargo documentation). I believe it's best not to specify minor versions if not used with
=
(akamy_lib = "=1.2.3"
) as less experienced developers might not know that cargo can choose an newer version then what's written.Imports
I've grouped dependencies (which I think should be the good practice) because it reduces the number of lines used for imports and allows a more visual representation of what it used in a library.
Welcome message
I was not convinced with the current implementation of the welcome message for two reason:
FtpStream
for data you probably need to read only oncewelcome_msg
is an option in the the structFtpSteam
suggesting it might not be here, however implementation made it available in all cases only to simplify the implementation of the functionconnect
Therefore I've made it available in the return of the function
connect
🙂Result vs crate::Result
I find it quite misleading to override import from rust prelude and notably for the result enum. If therefore moved the type
Result<T>
to lib.rs and usecrate::Result
to indicate the functions return a classical result of the crate rather than juste a classical resultAbout the put command
When uploading files to an ftp server using openssl I had the error
FTP 426 Failure reading network stream.
. My guess was that the ssl stream wasn't closed properly and that the master connection couldn't read until the data stream was closed. This is probably the case only with session re-use as without master and data connection are completly independent. Anyway, the fix consists in forcing the connection to shutdown after uploading the file. I'm quite unhappy of how I'm doing that, ideally it should have been in something equivalent to a Drop implementation. I didn't do a custom Drop implementation because I didn't know how to handle the possible connectivity errors when doing the shutdown. This is something to keep in mind for #93. Anyway, currently it works 🎉