Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/cargo/quick-xml-0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuanwo committed Dec 26, 2022
2 parents 7d58b05 + 80cf64a commit 1012979
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
22 changes: 18 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,20 @@ compress = ["async-compression"]
trust-dns = ["reqwest/trust-dns"]

# Enable rustls for TLS support
rustls = ["reqwest/rustls-tls-native-roots", "ureq/tls", "ureq/native-certs"]
rustls = [
"reqwest/rustls-tls-native-roots",
"ureq/tls",
"ureq/native-certs",
"suppaftp?/async-rustls",
]
# Enable native-tls for TLS support
native-tls = ["reqwest/native-tls", "ureq/native-tls"]
native-tls = [
"reqwest/native-tls",
"ureq/native-tls",
# Ideally, we need to use `suppaftp?/async-native-tls` here.
# But suppaftp's tls feature is not additive thus we can't use native here.
"suppaftp?/async-rustls",
]
# Enable vendored native-tls for TLS support
native-tls-vendored = ["reqwest/native-tls-vendored", "ureq/native-tls"]

Expand All @@ -43,7 +54,7 @@ layers-tracing = ["tracing"]
# Enable services hdfs support
services-hdfs = ["hdrs"]
# Enable services ftp support
services-ftp = ["suppaftp", "bb8"]
services-ftp = ["suppaftp", "bb8", "async-tls"]
# Enable services ipfs support
services-ipfs = ["prost"]
# Enable services moka support
Expand Down Expand Up @@ -105,6 +116,7 @@ async-compression = { package = "async-compression-issue-150-workaround", versio
"futures-io",
"all-algorithms",
], optional = true }
async-tls = { version = "0.11", optional = true }
async-trait = "0.1"
backon = "0.2"
base64 = "0.20"
Expand Down Expand Up @@ -138,7 +150,9 @@ reqwest = { version = "0.11", features = [
rocksdb = { version = "0.19", optional = true }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
suppaftp = { version = "=4.4", features = ["async-secure"], optional = true }
suppaftp = { version = "4.5", default-features = false, features = [
"async-secure",
], optional = true }
time = { version = "0.3", features = ["serde"] }
tokio = { version = "1.20", features = ["fs"] }
tracing = { version = "0.1", optional = true }
Expand Down
5 changes: 3 additions & 2 deletions src/services/ftp/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ use std::fmt::Formatter;
use std::str;
use std::str::FromStr;

use async_tls::TlsConnector;
use async_trait::async_trait;
use bb8::PooledConnection;
use bb8::RunError;
use futures::io::copy;
use futures::AsyncReadExt;
use http::Uri;
use log::debug;
use suppaftp::async_native_tls::TlsConnector;
use suppaftp::list::File;
use suppaftp::types::FileType;
use suppaftp::types::Response;
use suppaftp::FtpError;
use suppaftp::FtpStream;
use suppaftp::Status;

use time::OffsetDateTime;
use tokio::sync::OnceCell;

Expand Down Expand Up @@ -209,7 +210,7 @@ impl bb8::ManageConnection for Manager {
// switch to secure mode if ssl/tls is on.
let mut ftp_stream = if self.enable_secure {
stream
.into_secure(TlsConnector::new(), &self.endpoint)
.into_secure(TlsConnector::default().into(), &self.endpoint)
.await?
} else {
stream
Expand Down

1 comment on commit 1012979

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-qlrbz5e1p-databend.vercel.app
https://opendal-git-dependabotcargoquick-xml-027.vercel.app

Built with commit 1012979.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.