You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by ju...@apache.org on 2023/12/14 13:45:41 UTC
(incubator-opendal) 01/01: refactor: replace ftp tls impl as rustls
This is an automated email from the ASF dual-hosted git repository.
junouyang pushed a commit to branch dep/superbase-replace-by-native-tls
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit 6b354a0cec12b3ccc496b3379cdf4f48150463b7
Author: owl <ou...@gmail.com>
AuthorDate: Thu Dec 14 21:45:27 2023 +0800
refactor: replace ftp tls impl as rustls
---
Cargo.lock | 16 +++-------------
core/src/services/ftp/backend.rs | 14 +++++++++-----
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index a43849e2d..3af0252f6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -322,18 +322,6 @@ dependencies = [
"pin-project-lite",
]
-[[package]]
-name = "async-native-tls"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9343dc5acf07e79ff82d0c37899f079db3534d99f189a1837c8e549c99405bec"
-dependencies = [
- "futures-util",
- "native-tls",
- "thiserror",
- "url",
-]
-
[[package]]
name = "async-recursion"
version = "0.3.2"
@@ -4730,6 +4718,7 @@ dependencies = [
"anyhow",
"async-backtrace",
"async-compat",
+ "async-tls",
"async-trait",
"atomic_lib",
"await-tree",
@@ -4795,6 +4784,7 @@ dependencies = [
"tracing",
"tracing-subscriber",
"uuid",
+ "webpki-roots 0.22.6",
"wiremock",
]
@@ -7182,7 +7172,6 @@ version = "5.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "653aa9a6ebc0446a2d5c2be5b698b48a3192c7a098d0ed9a7c232e3a6340f091"
dependencies = [
- "async-native-tls",
"async-std",
"async-tls",
"async-trait",
@@ -7190,6 +7179,7 @@ dependencies = [
"lazy-regex",
"log",
"pin-project",
+ "rustls 0.21.9",
"thiserror",
]
diff --git a/core/src/services/ftp/backend.rs b/core/src/services/ftp/backend.rs
index b0c2a4544..6777016e3 100644
--- a/core/src/services/ftp/backend.rs
+++ b/core/src/services/ftp/backend.rs
@@ -21,6 +21,8 @@ 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;
@@ -29,14 +31,16 @@ use futures::AsyncReadExt;
use http::Uri;
use log::debug;
use serde::Deserialize;
-use suppaftp::async_native_tls::TlsConnector;
use suppaftp::list::File;
+
+
use suppaftp::types::FileType;
use suppaftp::types::Response;
-use suppaftp::AsyncNativeTlsConnector;
-use suppaftp::AsyncNativeTlsFtpStream;
+use suppaftp::AsyncRustlsConnector;
+use suppaftp::AsyncRustlsFtpStream;
use suppaftp::FtpError;
use suppaftp::ImplAsyncFtpStream;
+
use suppaftp::Status;
use tokio::sync::OnceCell;
@@ -214,7 +218,7 @@ pub struct Manager {
#[async_trait]
impl bb8::ManageConnection for Manager {
- type Connection = AsyncNativeTlsFtpStream;
+ type Connection = AsyncRustlsFtpStream;
type Error = FtpError;
async fn connect(&self) -> std::result::Result<Self::Connection, Self::Error> {
@@ -223,7 +227,7 @@ impl bb8::ManageConnection for Manager {
let mut ftp_stream = if self.enable_secure {
stream
.into_secure(
- AsyncNativeTlsConnector::from(TlsConnector::new()),
+ AsyncRustlsConnector::from(TlsConnector::default()),
&self.endpoint,
)
.await?