From a10e6ee14090b298a2ebdaebeaf5b29fc4697cdb Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Wed, 17 Oct 2018 19:28:53 -0700 Subject: [PATCH] Remove required feature from client example, tweak CLI docs --- quinn/Cargo.toml | 1 - quinn/examples/client.rs | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/quinn/Cargo.toml b/quinn/Cargo.toml index b4168c880..b69a10466 100644 --- a/quinn/Cargo.toml +++ b/quinn/Cargo.toml @@ -54,4 +54,3 @@ required-features = ["dangerous_configuration"] [[example]] name = "client" -required-features = ["dangerous_configuration"] diff --git a/quinn/examples/client.rs b/quinn/examples/client.rs index de11e5c53..51f5bc7ea 100644 --- a/quinn/examples/client.rs +++ b/quinn/examples/client.rs @@ -27,19 +27,24 @@ use slog::{Drain, Logger}; type Result = std::result::Result; +/// HTTP/0.9 over QUIC client +/// +/// Build with the dangerous_configuration feature to support connecting to servers with invalid certificates. #[derive(StructOpt, Debug)] #[structopt(name = "client")] struct Opt { - /// file to log TLS keys to for debugging + /// Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`. #[structopt(long = "keylog")] keylog: bool, url: Url, + /// Custom certificate authority to trust, in DER format #[structopt(parse(from_os_str), long = "ca")] ca: Option, - /// whether to accept invalid (e.g. self-signed) TLS certificates + /// Accept invalid (e.g. self-signed) TLS certificates + #[cfg(feature = "dangerous_configuration")] #[structopt(long = "accept-insecure-certs")] accept_insecure_certs: bool, /* @@ -100,8 +105,11 @@ fn run(log: Logger, options: Opt) -> Result<()> { if let Some(ca_path) = options.ca { client_config.add_certificate_authority(&fs::read(&ca_path)?)?; } - if options.accept_insecure_certs { - client_config.accept_insecure_certs(); + #[cfg(feature = "dangerous_configuration")] + { + if options.accept_insecure_certs { + client_config.accept_insecure_certs(); + } } let client_config = client_config.build();