Skip to content

Commit

Permalink
feat: wrap_connector from builder WantsProtocols1
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Fishrock123 committed Mar 15, 2024
1 parent 68c7d05 commit 61de45e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/connector/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ impl ConnectorBuilder<WantsProtocols1> {
})
}

/// This wraps an arbitrary low-level connector into an [`HttpsConnector`]
pub fn wrap_connector<H>(self, conn: H) -> HttpsConnector<H> {
// 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
Expand Down

0 comments on commit 61de45e

Please sign in to comment.