Skip to content

Commit

Permalink
Merge pull request databendlabs#2737 from sunli829/main
Browse files Browse the repository at this point in the history
Bump poem from `1.0.21` to `1.0.23`.
  • Loading branch information
BohuTANG authored Nov 10, 2021
2 parents 0d5fc19 + d8c307c commit 68bbe71
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pprof = { version = "0.5", features = ["flamegraph", "protobuf"] }
tokio = { version = "1.13.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "signal"] }
uuid = { version = "0.8", features = ["serde", "v4"] }
serde = { version = "1.0", features = ["derive"] }
poem = { version = "1.0.21", features = ["tls"] }
poem = { version = "1.0.23", features = ["rustls"] }


[dev-dependencies]
Expand Down
10 changes: 5 additions & 5 deletions common/base/src/http_shutdown_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ use common_tracing::tracing;
use futures::FutureExt;
use poem::listener::Acceptor;
use poem::listener::AcceptorExt;
use poem::listener::IntoTlsConfigStream;
use poem::listener::Listener;
use poem::listener::RustlsConfig;
use poem::listener::TcpListener;
use poem::listener::TlsConfig;
use poem::Endpoint;
use tokio::sync::oneshot;
use tokio::task::JoinHandle;
Expand All @@ -45,7 +46,7 @@ impl HttpShutdownHandler {
pub async fn start_service(
&mut self,
listening: String,
tls_config: Option<TlsConfig>,
tls_config: Option<RustlsConfig>,
ep: impl Endpoint + 'static,
) -> Result<SocketAddr> {
assert!(self.join_handle.is_none());
Expand All @@ -65,13 +66,12 @@ impl HttpShutdownHandler {

if let Some(tls_config) = tls_config {
acceptor = acceptor
.tls(tls_config)
.map_err(|err| {
.rustls(tls_config.into_stream().map_err(|err| {
ErrorCode::TLSConfigurationFailure(format!(
"Cannot build TLS config for http service, cause {}",
err
))
})?
})?)
.boxed();
}

Expand Down
2 changes: 1 addition & 1 deletion metasrv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ tonic = { version = "0.6.0", features = ["tls"]}

sha2 = "0.9.8"
uuid = { version = "0.8", features = ["serde", "v4"] }
poem = { version = "1.0.21", features = ["tls"] }
poem = { version = "1.0.23", features = ["rustls"] }

[dev-dependencies]
common-meta-api = {path = "../common/meta/api" }
Expand Down
6 changes: 3 additions & 3 deletions metasrv/src/api/http_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use common_base::HttpShutdownHandler;
use common_base::Stoppable;
use common_exception::Result;
use poem::get;
use poem::listener::TlsConfig;
use poem::listener::RustlsConfig;
use poem::Endpoint;
use poem::EndpointExt;
use poem::Route;
Expand Down Expand Up @@ -52,12 +52,12 @@ impl HttpService {
.data(self.cfg.clone())
}

fn build_tls(config: &Config) -> Result<TlsConfig> {
fn build_tls(config: &Config) -> Result<RustlsConfig> {
let conf = config.clone();
let tls_cert = conf.admin_tls_server_cert;
let tls_key = conf.admin_tls_server_key;

let cfg = TlsConfig::new()
let cfg = RustlsConfig::new()
.cert(std::fs::read(tls_cert.as_str())?)
.key(std::fs::read(tls_key.as_str())?);
Ok(cfg)
Expand Down
2 changes: 1 addition & 1 deletion query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "ec
ahash = "0.7.6"
async-compat = "0.2.1"
async-trait = "0.1"
poem = { version = "1.0.21", features = ["tls"] }
poem = { version = "1.0.23", features = ["rustls"] }
bumpalo = "3.8.0"
byteorder = "1"
bytes = "1"
Expand Down
6 changes: 3 additions & 3 deletions query/src/api/http_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::path::Path;

use common_exception::Result;
use poem::get;
use poem::listener::TlsConfig;
use poem::listener::RustlsConfig;
use poem::Endpoint;
use poem::EndpointExt;
use poem::Route;
Expand Down Expand Up @@ -61,8 +61,8 @@ impl HttpService {
.data(self.sessions.get_conf().clone())
}

fn build_tls(config: &Config) -> Result<TlsConfig> {
let mut cfg = TlsConfig::new()
fn build_tls(config: &Config) -> Result<RustlsConfig> {
let mut cfg = RustlsConfig::new()
.cert(std::fs::read(&config.query.api_tls_server_cert.as_str())?)
.key(std::fs::read(&config.query.api_tls_server_key.as_str())?);
if Path::new(&config.query.api_tls_server_root_ca_cert).exists() {
Expand Down
10 changes: 5 additions & 5 deletions query/src/common/service/http_shutdown_handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ use common_exception::Result;
use futures::FutureExt;
use poem::listener::Acceptor;
use poem::listener::AcceptorExt;
use poem::listener::IntoTlsConfigStream;
use poem::listener::Listener;
use poem::listener::RustlsConfig;
use poem::listener::TcpListener;
use poem::listener::TlsConfig;
use poem::Endpoint;

pub struct HttpShutdownHandler {
Expand All @@ -44,7 +45,7 @@ impl HttpShutdownHandler {
pub async fn start_service(
&mut self,
listening: SocketAddr,
tls_config: Option<TlsConfig>,
tls_config: Option<RustlsConfig>,
ep: impl Endpoint + 'static,
) -> Result<SocketAddr> {
assert!(self.join_handle.is_none());
Expand All @@ -64,13 +65,12 @@ impl HttpShutdownHandler {

if let Some(tls_config) = tls_config {
acceptor = acceptor
.tls(tls_config)
.map_err(|err| {
.rustls(tls_config.into_stream().map_err(|err| {
ErrorCode::TLSConfigurationFailure(format!(
"Cannot build TLS config for http service, cause {}",
err
))
})?
})?)
.boxed();
}

Expand Down

0 comments on commit 68bbe71

Please sign in to comment.