-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add option to disable http2 upgrade #1292
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
Conversation
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.
This sounds like a great addition, thank you!
src/async_impl/client.rs
Outdated
@@ -94,6 +94,7 @@ struct Config { | |||
tls_built_in_root_certs: bool, | |||
#[cfg(feature = "__tls")] | |||
tls: TlsBackend, | |||
http1_only: bool, |
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.
Since http1_only
and http2_only
are exclusive (they can't both be true), perhaps it'd be best if we made an internal enum to track that?
enum HttpVersionPref {
Http1,
Http2,
All,
}
src/async_impl/client.rs
Outdated
@@ -737,8 +743,16 @@ impl ClientBuilder { | |||
self | |||
} | |||
|
|||
/// Only use HTTP/1. | |||
pub fn disable_http2_upgrade(mut self) -> ClientBuilder { |
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.
Naming is always hard. Another option could be http1_only()
...
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.
Yesss, let's go! Thanks!
* master: add option to disable http2 upgrade (seanmonstar#1292) Fix documentation of http1_title_case_headers() (seanmonstar#1294) CI: make a single final job that depends on all others (seanmonstar#1291) Fix bare url warnings in `multipart` docs (seanmonstar#1289) v0.11.4 Allow overriding of DNS resolution to specified IP addresses(seanmonstar#561) (seanmonstar#1277) WASM: Add `try_clone` implementations to `Request` and `RequestBuilder` (seanmonstar#1286) Add native-tls-alpn feature (seanmonstar#1283)
Co-authored-by: Sean McArthur <[email protected]>
This can be helpful when there is a need to make an HTTP/1.0 or HTTP/1.1 connection but the server supports upgrading to HTTP/2.
Resolves #1290