doc(client): document that http2_only needs Prior Knowledge or ALPN

configured.

Closes #1698
This commit is contained in:
Sean McArthur
2018-12-11 15:41:01 -08:00
parent 2d5eabdeed
commit f8f926c14c

View File

@@ -714,7 +714,7 @@ impl<B> ClientError<B> {
/// A marker to identify what version a pooled connection is. /// A marker to identify what version a pooled connection is.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
enum Ver { enum Ver {
Http1, Auto,
Http2, Http2,
} }
@@ -792,7 +792,7 @@ impl Default for Builder {
client_config: Config { client_config: Config {
retry_canceled_requests: true, retry_canceled_requests: true,
set_host: true, set_host: true,
ver: Ver::Http1, ver: Ver::Auto,
}, },
conn_builder: conn::Builder::new(), conn_builder: conn::Builder::new(),
pool_config: pool::Config { pool_config: pool::Config {
@@ -864,6 +864,11 @@ impl Builder {
/// Set whether the connection **must** use HTTP/2. /// Set whether the connection **must** use HTTP/2.
/// ///
/// The destination must either allow HTTP2 Prior Knowledge, or the
/// `Connect` should be configured to do use ALPN to upgrade to `h2`
/// as part of the connection process. This will not make the `Client`
/// utilize ALPN by itself.
///
/// Note that setting this to true prevents HTTP/1 from being allowed. /// Note that setting this to true prevents HTTP/1 from being allowed.
/// ///
/// Default is false. /// Default is false.
@@ -871,7 +876,7 @@ impl Builder {
self.client_config.ver = if val { self.client_config.ver = if val {
Ver::Http2 Ver::Http2
} else { } else {
Ver::Http1 Ver::Auto
}; };
self self
} }