feat: make pub Channel fns that allow creating it from a custom connector#2015
Merged
tobz merged 2 commits intohyperium:masterfrom Oct 22, 2024
Merged
feat: make pub Channel fns that allow creating it from a custom connector#2015tobz merged 2 commits intohyperium:masterfrom
Channel fns that allow creating it from a custom connector#2015tobz merged 2 commits intohyperium:masterfrom
Conversation
…nector The connector is required to be a `Service` that accepts a `http::Uri` and returns a connection implementing hyper's IO traits, which is a very reasonable requirement that can be fulfilled by advanced users that need to customize any mechanics that don't fit into the paved path for HTTP and HTTPS with tonic. One such requirement is customizing `rustls::ClientConfig`, which has come up for a number of users. They have been pointed in the direction of a custom connector, but the APIs on `Endpoint` are not always suitable: `Enedpoint::connect_(lazy_)with_connector` always wraps the provided connector with `transport::channel::service::Connector`. This wrapper validates if the scheme is HTTPS, the TLS feature is enabled, and TLS was not configured on the endpoint, and raises an error `HttpsUriWithoutTlsSupport` in this situation. This is a good safety feature in general, but not if the wrapped connector is taking care of TLS. As a side bonus, `tonic::transport::channel::service::io::BoxedIo` can be avoided.
tottoto
approved these changes
Oct 19, 2024
Collaborator
tottoto
left a comment
There was a problem hiding this comment.
Sounds reasonable to me.
tobz
approved these changes
Oct 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The connector is required to be a
Servicethat accepts ahttp::Uriand returns a connection implementing hyper's IO traits, which is a very reasonable requirement that can be fulfilled by advanced users that need to customize any mechanics that don't fit into the paved path for HTTP and HTTPS with tonic.One such requirement is customizing
rustls::ClientConfig, which has come up for a number of users. They have been pointed in the direction of a custom connector, but the APIs onEndpointare not always suitable:Endpoint::connect_(lazy_)with_connectoralways wraps the provided connector withtransport::channel::service::Connector. This wrapper raises an errorHttpsUriWithoutTlsSupportif (the scheme ishttps://+ thetlsfeature is enabled + andEndpoint::tls_config()was not used) ref. This is a good safety feature in general, but not if the wrapped connector is taking care of TLS.As a side bonus,
transport::channel::service::io::BoxedIocan be avoided.