-
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: Return error on non https uri instead of panic #838
Conversation
#[cfg(not(feature = "tls"))] | ||
{ | ||
if is_https { | ||
return Err("connecting to HTTPS without TLS enabled".to_owned().into()); |
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.
Should we make this an actual error type?
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.
Seemed unlikely to me that code would be handling this, but I'm happy to change it if you prefer it the other way.
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.
Yeah lets make it a concrete error or error variant?
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.
Like this?
dcca865
to
18a4fef
Compare
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.
LGTM one nit
747fc87
to
f478ecb
Compare
This never panicked for me? The |
Motivation
In getting started with tonic, I ran into an issue where issuing a first request with the default features and no explicit TLS configuration set would just result in a H2
GoAway
frame without further context. Given that I was providing ahttps
URL to theEndpoint
, it seems reasonable that tonic should be able to give me a more meaningful error in this case.Solution
If the URI scheme is
https
and thetls
feature is disabled, return an error from the connector. If the feature is enabled but there is no TLS config present, also return an error.