From 61de45e087781363e1b17c4ca04bbfa33a9599ce Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Fri, 15 Mar 2024 14:54:36 -0700 Subject: [PATCH] feat: wrap_connector from builder WantsProtocols1 There is a use case for wrapping libraries where they may not bring in either `http` or `http2` features, but still want to set advanced configuration but with their own lower-level connector. --- src/connector/builder.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/connector/builder.rs b/src/connector/builder.rs index 3e1abda..5f64670 100644 --- a/src/connector/builder.rs +++ b/src/connector/builder.rs @@ -228,6 +228,15 @@ impl ConnectorBuilder { }) } + /// This wraps an arbitrary low-level connector into an [`HttpsConnector`] + pub fn wrap_connector(self, conn: H) -> HttpsConnector { + // HTTP1-only, alpn_protocols stays empty + // HttpConnector doesn't have a way to say http1-only; + // its connection pool may still support HTTP2 + // though it won't be used + self.0.wrap_connector(conn) + } + /// Override server name for the TLS stack /// /// By default, for each connection hyper-rustls will extract host portion