Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - expected AsyncNoTlsStream, found AsyncNativeTlsStream #52

Closed
brunoarueira opened this issue Sep 11, 2023 · 1 comment · Fixed by #53
Closed

[BUG] - expected AsyncNoTlsStream, found AsyncNativeTlsStream #52

brunoarueira opened this issue Sep 11, 2023 · 1 comment · Fixed by #53
Assignees
Labels
bug Something isn't working

Comments

@brunoarueira
Copy link
Contributor

Description

On a pet project I'm working on, I've set to use async-native-tls feature and when I use into_secure with AsyncNativeTlsConnector::from(TlsConnector::new()), similar to the README, I got the error from title of this bug.

Steps to reproduce

Steps to reproduce the bug you encountered:

use std::error::Error;
use suppaftp::{AsyncFtpStream, AsyncNativeTlsConnector};
use suppaftp::async_native_tls::{TlsConnector, TlsStream};

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    // Create a connection to an FTP server and authenticate to it.
    let mut ftp_stream = AsyncFtpStream::connect("localhost:21").await.unwrap();

    let mut connector = TlsConnector::new();

    let mut ftp_stream =
        ftp_stream
        .into_secure(AsyncNativeTlsConnector::from(connector), "localhost")
        .await
        .unwrap();

    Ok(())
}

Probably the bug is about this:

pub type AsyncFtpStream = ImplAsyncFtpStream<AsyncNoTlsStream>;

Missing to generate a type for async-native-tls feature.

Expected behaviour

Using the above code must work as expected and should compile at least.

Environment

  • OS: Darwin
  • Architecture x86_64
  • Rust version: 1.72.0
  • library version: 5.2.0
  • Protocol used: ftp
  • Remote server version and name: vsftpd 3.0

Additional information

None

@brunoarueira brunoarueira added the bug Something isn't working label Sep 11, 2023
@brunoarueira
Copy link
Contributor Author

After digging a little bit, I've found the correct way to do the connection using async-native-tls, we should use the following type:

pub type AsyncNativeTlsFtpStream = ImplAsyncFtpStream<AsyncNativeTlsStream>;

So, probably I'll send a pr to fix the docs 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants