Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/tlsclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ Options:
May be used multiple times to offer serveral protocols.
--cache CACHE Save session cache to file CACHE.
--no-tickets Disable session ticket support.
--no-sni Disable server name indication support.
--insecure Disable certificate verification.
--verbose Emit log output.
--mtu MTU Limit outgoing messages to MTU bytes.
Expand All @@ -318,6 +319,7 @@ struct Args {
flag_cafile: Option<String>,
flag_cache: Option<String>,
flag_no_tickets: bool,
flag_no_sni: bool,
flag_insecure: bool,
flag_auth_key: Option<String>,
flag_auth_certs: Option<String>,
Expand Down Expand Up @@ -448,6 +450,10 @@ fn make_config(args: &Args) -> Arc<rustls::ClientConfig> {
config.enable_tickets = false;
}

if args.flag_no_sni {
config.enable_sni = false;
}

let persist = Arc::new(PersistCache::new(&args.flag_cache));

config.set_protocols(&args.flag_proto);
Expand Down
4 changes: 3 additions & 1 deletion src/client/hs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ fn emit_client_hello_for_retry(sess: &mut ClientSessionImpl,
if !supported_versions.is_empty() {
exts.push(ClientExtension::SupportedVersions(supported_versions));
}
exts.push(ClientExtension::make_sni(handshake.dns_name.as_ref()));
if sess.config.enable_sni {
exts.push(ClientExtension::make_sni(handshake.dns_name.as_ref()));
}
exts.push(ClientExtension::ECPointFormats(ECPointFormatList::supported()));
exts.push(ClientExtension::NamedGroups(NamedGroups::supported()));
exts.push(ClientExtension::SignatureAlgorithms(SupportedSignatureSchemes::supported_verify()));
Expand Down
7 changes: 7 additions & 0 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ pub struct ClientConfig {
/// checking is disabled.
pub ct_logs: Option<&'static [&'static sct::Log<'static>]>,

/// Whether to send the Server Name Indication (SNI) extension
/// during the client handshake.
///
/// The default is true.
pub enable_sni: bool,

/// How to verify the server certificate chain.
verifier: Arc<verify::ServerCertVerifier>,
}
Expand All @@ -225,6 +231,7 @@ impl ClientConfig {
enable_tickets: true,
versions: vec![ProtocolVersion::TLSv1_3, ProtocolVersion::TLSv1_2],
ct_logs: None,
enable_sni: true,
verifier: Arc::new(verify::WebPKIVerifier::new())
}
}
Expand Down