Add HTTP/0.9 responses support
This commit is contained in:
committed by
Sean McArthur
parent
7388b676df
commit
56ad99bebb
@@ -95,7 +95,7 @@ encoding_rs = "0.8"
|
|||||||
futures-core = { version = "0.3.0", default-features = false }
|
futures-core = { version = "0.3.0", default-features = false }
|
||||||
futures-util = { version = "0.3.0", default-features = false }
|
futures-util = { version = "0.3.0", default-features = false }
|
||||||
http-body = "0.4.0"
|
http-body = "0.4.0"
|
||||||
hyper = { version = "0.14", default-features = false, features = ["tcp", "http1", "http2", "client", "runtime"] }
|
hyper = { version = "0.14.5", default-features = false, features = ["tcp", "http1", "http2", "client", "runtime"] }
|
||||||
h2 = "0.3.10"
|
h2 = "0.3.10"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ struct Config {
|
|||||||
#[cfg(feature = "__tls")]
|
#[cfg(feature = "__tls")]
|
||||||
tls: TlsBackend,
|
tls: TlsBackend,
|
||||||
http_version_pref: HttpVersionPref,
|
http_version_pref: HttpVersionPref,
|
||||||
|
http09_responses: bool,
|
||||||
http1_title_case_headers: bool,
|
http1_title_case_headers: bool,
|
||||||
http2_initial_stream_window_size: Option<u32>,
|
http2_initial_stream_window_size: Option<u32>,
|
||||||
http2_initial_connection_window_size: Option<u32>,
|
http2_initial_connection_window_size: Option<u32>,
|
||||||
@@ -166,6 +167,7 @@ impl ClientBuilder {
|
|||||||
#[cfg(feature = "__tls")]
|
#[cfg(feature = "__tls")]
|
||||||
tls: TlsBackend::default(),
|
tls: TlsBackend::default(),
|
||||||
http_version_pref: HttpVersionPref::All,
|
http_version_pref: HttpVersionPref::All,
|
||||||
|
http09_responses: false,
|
||||||
http1_title_case_headers: false,
|
http1_title_case_headers: false,
|
||||||
http2_initial_stream_window_size: None,
|
http2_initial_stream_window_size: None,
|
||||||
http2_initial_connection_window_size: None,
|
http2_initial_connection_window_size: None,
|
||||||
@@ -458,6 +460,10 @@ impl ClientBuilder {
|
|||||||
builder.pool_max_idle_per_host(config.pool_max_idle_per_host);
|
builder.pool_max_idle_per_host(config.pool_max_idle_per_host);
|
||||||
connector.set_keepalive(config.tcp_keepalive);
|
connector.set_keepalive(config.tcp_keepalive);
|
||||||
|
|
||||||
|
if config.http09_responses {
|
||||||
|
builder.http09_responses(true);
|
||||||
|
}
|
||||||
|
|
||||||
if config.http1_title_case_headers {
|
if config.http1_title_case_headers {
|
||||||
builder.http1_title_case_headers(true);
|
builder.http1_title_case_headers(true);
|
||||||
}
|
}
|
||||||
@@ -842,6 +848,12 @@ impl ClientBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allow HTTP/0.9 responses
|
||||||
|
pub fn http09_responses(mut self) -> ClientBuilder {
|
||||||
|
self.config.http09_responses = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Only use HTTP/2.
|
/// Only use HTTP/2.
|
||||||
pub fn http2_prior_knowledge(mut self) -> ClientBuilder {
|
pub fn http2_prior_knowledge(mut self) -> ClientBuilder {
|
||||||
self.config.http_version_pref = HttpVersionPref::Http2;
|
self.config.http_version_pref = HttpVersionPref::Http2;
|
||||||
|
|||||||
@@ -412,6 +412,11 @@ impl ClientBuilder {
|
|||||||
self.with_inner(|inner| inner.http1_only())
|
self.with_inner(|inner| inner.http1_only())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allow HTTP/0.9 responses
|
||||||
|
pub fn http09_responses(self) -> ClientBuilder {
|
||||||
|
self.with_inner(|inner| inner.http09_responses())
|
||||||
|
}
|
||||||
|
|
||||||
/// Only use HTTP/2.
|
/// Only use HTTP/2.
|
||||||
pub fn http2_prior_knowledge(self) -> ClientBuilder {
|
pub fn http2_prior_knowledge(self) -> ClientBuilder {
|
||||||
self.with_inner(|inner| inner.http2_prior_knowledge())
|
self.with_inner(|inner| inner.http2_prior_knowledge())
|
||||||
|
|||||||
Reference in New Issue
Block a user