-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(tonic-build,tonic) Add back TLS handling in generated Client::connect
code
#1866
Conversation
a8737f5
to
55bb186
Compare
Client::connect
codeClient::connect
code
Though this fix is in tonic/tonic/src/transport/channel/endpoint.rs Lines 43 to 44 in decbf61
Endpoint::new is mainly used in generated code through tonic-build .
|
Client::connect
codeClient::connect
code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a little ugly but probably still better to fix the regression for now.
…onnect` code (#1866) * tls feature flag for Endpoint::new * added unit test
Personally, I do not like this kind of implicit configuration and would prefer that users explicitly configure TLS. It seems better to update the documentation instead. |
I'm sympathetic to this but I think regressing user's code in an upgrade is worse, and I don't think adding documentation is enough. We could improve this via the type system instead. |
@tottoto I would be happy to hear of alternatives, #1731 for better or worse took a lot of convenience out of a TLS approach that "just works". |
8688bf9
to
74a42fb
Compare
You can define your own constructor such as function to construct connection with your config. |
That is not the case for generated code. |
Client::connect
codeClient::connect
code
Motivation
The recent breaking change in #1731 removed the ability for generated client functions to connect to HTTPS endpoints through strings alone.
For example the doctest below would fail in 0.12.x
tonic-build
connection code:tonic/tonic/src/transport/channel/endpoint.rs
Lines 79 to 82 in 03913b9
Solution
This PR introduces a best attempt at picking up tls feature flags in
Endpoint::new
to allow successfully connecting to strings that containhttps://
once more