chore: massage dependencies and features to remove openssl/native-tls (#2859)

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Conrad Ludgate
2024-11-03 09:48:35 +00:00
committed by GitHub
parent 81d921d625
commit 2d95ff0830
4 changed files with 319 additions and 224 deletions

View File

@@ -1,6 +1,3 @@
use hyper::client::HttpConnector;
use hyper_tls::{native_tls, HttpsConnector};
mod fetch;
pub use fetch::*;
@@ -14,15 +11,16 @@ pub async fn init_client_with_database(
database: &str,
) -> clickhouse::error::Result<clickhouse::Client> {
let client = {
let mut http_connector = HttpConnector::new();
http_connector.enforce_http(false); // allow https URLs
let tls_connector =
native_tls::TlsConnector::builder().build().unwrap().into();
let https_connector =
HttpsConnector::from((http_connector, tls_connector));
let hyper_client =
hyper::client::Client::builder().build(https_connector);
let tls_connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.expect("no native root CA certificates found")
.https_only()
.enable_http1()
.build();
let hyper_client = hyper_util::client::legacy::Client::builder(
hyper_util::rt::TokioExecutor::new(),
)
.build(tls_connector);
clickhouse::Client::with_http_client(hyper_client)
.with_url(dotenvy::var("CLICKHOUSE_URL").unwrap())