Skip to content

Commit cc0dfe0

Browse files
committed
change: separate out tls feature flags
A successor to http-rs#53, this separates out the tls feature flags, which should be nicer. Fixes: http-rs#54
1 parent 60e351b commit cc0dfe0

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ features = ["docs"]
2020
rustdoc-args = ["--cfg", "feature=\"docs\""]
2121

2222
[features]
23-
default = ["h1_client"]
23+
default = ["h1_client", "native-tls"]
2424
docs = ["h1_client", "curl_client", "wasm_client", "hyper_client"]
25-
h1_client = ["async-h1", "async-std", "async-native-tls", "deadpool", "futures"]
26-
h1_client_rustls = ["async-h1", "async-std", "async-tls", "deadpool", "futures"]
25+
26+
h1_client = ["async-h1", "async-std", "deadpool", "futures"]
2727
native_client = ["curl_client", "wasm_client"]
2828
curl_client = ["isahc", "async-std"]
2929
wasm_client = ["js-sys", "web-sys", "wasm-bindgen", "wasm-bindgen-futures", "futures"]
3030
hyper_client = ["hyper", "hyper-tls", "http-types/hyperium_http", "futures-util"]
3131

32+
native-tls = ["async-native-tls"]
33+
rustls = ["async-tls"]
34+
3235
[dependencies]
3336
async-trait = "0.1.37"
3437
dashmap = "4.0.2"

src/h1/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use dashmap::DashMap;
99
use deadpool::managed::Pool;
1010
use http_types::StatusCode;
1111

12-
#[cfg(not(feature = "h1_client_rustls"))]
12+
#[cfg(feature = "native-tls")]
1313
use async_native_tls::TlsStream;
14-
#[cfg(feature = "h1_client_rustls")]
14+
#[cfg(feature = "rustls")]
1515
use async_tls::client::TlsStream;
1616

1717
use super::{async_trait, Error, HttpClient, Request, Response};

src/h1/tls.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use deadpool::managed::{Manager, Object, RecycleResult};
88
use futures::io::{AsyncRead, AsyncWrite};
99
use futures::task::{Context, Poll};
1010

11-
#[cfg(not(feature = "h1_client_rustls"))]
11+
#[cfg(feature = "native-tls")]
1212
use async_native_tls::TlsStream;
13-
#[cfg(feature = "h1_client_rustls")]
13+
#[cfg(feature = "rustls")]
1414
use async_tls::client::TlsStream;
1515

1616
use crate::Error;
@@ -76,15 +76,15 @@ impl Manager<TlsStream<TcpStream>, Error> for TlsConnection {
7676
}
7777
}
7878

79-
#[cfg(not(feature = "h1_client_rustls"))]
79+
#[cfg(feature = "native-tls")]
8080
async fn add_tls(
8181
host: &str,
8282
stream: TcpStream,
8383
) -> Result<async_native_tls::TlsStream<TcpStream>, async_native_tls::Error> {
8484
async_native_tls::connect(host, stream).await
8585
}
8686

87-
#[cfg(feature = "h1_client_rustls")]
87+
#[cfg(feature = "rustls")]
8888
async fn add_tls(host: &str, stream: TcpStream) -> Result<TlsStream<TcpStream>, std::io::Error> {
8989
let connector = async_tls::TlsConnector::default();
9090
connector.connect(host, stream).await

0 commit comments

Comments
 (0)