Skip to content

Commit

Permalink
Expose and forward rustls default features
Browse files Browse the repository at this point in the history
tls12 and logging are rustls features we enable by default,
as does rustls, exposing them explicitly allows users
to disable them by disabling hyper-rustls default features.
  • Loading branch information
g2p committed Nov 6, 2021
1 parent bc8023b commit 30c6f47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ homepage = "https://github.com/ctz/hyper-rustls"
repository = "https://github.com/ctz/hyper-rustls"

[dependencies]
log = "0.4.4"
log = { version = "0.4.4", optional = true }
http = "0.2"
hyper = { version = "0.14", default-features = false, features = ["client"] }
rustls = "0.20"
rustls = { version = "0.20", default-features = false }
rustls-native-certs = { version = "0.6", optional = true }
tokio = "1.0"
tokio-rustls = "0.23"
tokio-rustls = { version = "0.23", default-features = false }
webpki-roots = { version = "0.22", optional = true }

[dev-dependencies]
Expand All @@ -27,12 +27,14 @@ futures-util = { version = "0.3.1", default-features = false }
rustls-pemfile = "0.2.1"

[features]
default = ["native-tokio", "http1"]
default = ["native-tokio", "http1", "tls12", "logging"]
http1 = ["hyper/http1"]
http2 = ["hyper/http2"]
webpki-tokio = ["tokio-runtime", "webpki-roots"]
native-tokio = ["tokio-runtime", "rustls-native-certs"]
tokio-runtime = ["hyper/runtime"]
tls12 = ["tokio-rustls/tls12", "rustls/tls12"]
logging = ["log", "tokio-rustls/logging", "rustls/logging"]

[[example]]
name = "client"
Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
for cert in rustls_native_certs::load_native_certs().expect("could not load platform certs")
{
let cert = rustls::Certificate(cert.0);
#[cfg_attr(not(feature = "logging"), allow(unused_variables))]
match roots.add(&cert) {
Ok(_) => valid_count += 1,
Err(err) => {
Expand Down

0 comments on commit 30c6f47

Please sign in to comment.