Skip to content

Commit

Permalink
change: separate out tls feature flags
Browse files Browse the repository at this point in the history
A successor to #53, this separates out the tls feature flags, which should be nicer.

Fixes: #54
  • Loading branch information
Fishrock123 committed Feb 11, 2021
1 parent 69cdd5d commit 0715b23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ features = ["docs"]
rustdoc-args = ["--cfg", "feature=\"docs\""]

[features]
default = ["h1_client"]
default = ["h1_client", "native-tls"]
docs = ["h1_client", "curl_client", "wasm_client", "hyper_client"]
h1_client = ["async-h1", "async-std", "async-native-tls"]
h1_client_rustls = ["async-h1", "async-std", "async-tls"]

h1_client = ["async-h1", "async-std"]
native_client = ["curl_client", "wasm_client"]
curl_client = ["isahc", "async-std"]
wasm_client = ["js-sys", "web-sys", "wasm-bindgen", "wasm-bindgen-futures", "futures"]
hyper_client = ["hyper", "hyper-tls", "http-types/hyperium_http", "futures-util"]

native-tls = ["async-native-tls"]
rustls = ["async-tls"]

[dependencies]
async-trait = "0.1.37"
http-types = "2.3.0"
Expand Down
4 changes: 2 additions & 2 deletions src/h1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ impl HttpClient for H1Client {
}
}

#[cfg(not(feature = "h1_client_rustls"))]
#[cfg(all(feature = "h1_client", feature = "native-tls"))]
async fn add_tls(
host: String,
stream: async_std::net::TcpStream,
) -> Result<async_native_tls::TlsStream<async_std::net::TcpStream>, async_native_tls::Error> {
async_native_tls::connect(host, stream).await
}

#[cfg(feature = "h1_client_rustls")]
#[cfg(all(feature = "h1_client", feature = "rustls"))]
async fn add_tls(
host: String,
stream: async_std::net::TcpStream,
Expand Down

0 comments on commit 0715b23

Please sign in to comment.