-
Notifications
You must be signed in to change notification settings - Fork 713
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
feat(s2n-tls-hyper): Allow plain HTTP connections #4978
Conversation
2cf6727
to
00f3218
Compare
Co-authored-by: Wesley Rosenblum <55108558+WesleyRosenblum@users.noreply.github.com>
} | ||
|
||
impl<Http, ConnBuilder> Builder<Http, ConnBuilder> { | ||
/// If enabled, allows communication with insecure HTTP endpoints in addition to secure HTTPS endpoints (default: false). | ||
pub fn with_insecure_http(&mut self, enabled: bool) -> &mut Self { |
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.
Thought: is insecure
too strong a word for this? Maybe something like with_plaintext_http
would be a bit more ambivalent.
Although I guess if you're going through the trouble of using the s2n-tls-hyper
connector, plaintext http is a little sus. I don't think the current naming was bad, just curious about reasoning.
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 insecure
was meant less as a warning and more to differentiate from "secure" in HTTPS. So with_plaintext_http
works just as well if that makes the meaning more clear.
Description of changes:
Currently, an
HttpsConnector
can only be used to make secure HTTPS requests over TLS. If communication with an insecure HTTP endpoint is attempted, anInvalidScheme
error is returned. This behavior prevents accidentally bypassing TLS if an insecure endpoint is provided.However, this behavior may be desirable in some circumstances, if communication with both HTTPS and HTTP endpoints is required. This PR allows an
HttpsConnector
to be constructed with aninsecure_http
option, allowing for HTTP over plain TCP to be communicated if an HTTP route is provided.Call-outs:
Previously we were erroring for HTTP schemes but permitting all other schemes (not just HTTPS). This was changed to now error for all unexpected schemes.
Is
with_insecure_http
a good name for the API? Other possible options:with_https_or_http
(the equivalent hyper-rustls API)with_http
Testing:
Added a new localhost plain TCP HTTP test, which ensures that TLS is successfully bypassed, and that the plain HTTP option is disabled by default.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.