Skip to content

Commit

Permalink
Add ConnectorBuilder::enable_all_versions() helper
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Mar 31, 2023
1 parent 52b5c7a commit df93f70
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/connector/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ impl ConnectorBuilder<WantsProtocols1> {
})
}

/// Enable all HTTP versions
///
/// For now, this enables both HTTP 1 and 2. In the future, other supported versions
/// will be enabled as well.
#[cfg(all(feature = "http1", feature = "http2"))]
pub fn enable_all_versions(mut self) -> ConnectorBuilder<WantsProtocols3> {
self.0.tls_config.alpn_protocols = vec![b"h2".to_vec()];
ConnectorBuilder(WantsProtocols3 {
inner: self.0,
enable_http1: true,
})
}

/// Override server name for the TLS stack
///
/// By default, for each connection hyper-rustls will extract host portion
Expand Down

0 comments on commit df93f70

Please sign in to comment.