Skip to content

Commit df93f70

Browse files
committed
Add ConnectorBuilder::enable_all_versions() helper
1 parent 52b5c7a commit df93f70

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/connector/builder.rs

+13
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,19 @@ impl ConnectorBuilder<WantsProtocols1> {
174174
})
175175
}
176176

177+
/// Enable all HTTP versions
178+
///
179+
/// For now, this enables both HTTP 1 and 2. In the future, other supported versions
180+
/// will be enabled as well.
181+
#[cfg(all(feature = "http1", feature = "http2"))]
182+
pub fn enable_all_versions(mut self) -> ConnectorBuilder<WantsProtocols3> {
183+
self.0.tls_config.alpn_protocols = vec![b"h2".to_vec()];
184+
ConnectorBuilder(WantsProtocols3 {
185+
inner: self.0,
186+
enable_http1: true,
187+
})
188+
}
189+
177190
/// Override server name for the TLS stack
178191
///
179192
/// By default, for each connection hyper-rustls will extract host portion

0 commit comments

Comments
 (0)