Struct isahc::config::VersionNegotiation [−][src]
pub struct VersionNegotiation { /* fields omitted */ }
Expand description
A strategy for selecting what HTTP versions should be used when communicating with a server.
You can set a version negotiation strategy on a given request or on a client
with Configurable::version_negotiation
.
Attempting to use an HTTP version without client-side support at runtime
will result in an error. For example, using the system libcurl on an old
machine may not have an HTTP/2 implementation. Using static linking and the
http2
crate feature can help guarantee that HTTP/2
will be available to use.
Implementations
Always prefer the latest supported version announced by the server, falling back to older versions if not explicitly listed as supported. This is the default.
Secure connections will begin with a TLS handshake, after which the
highest supported HTTP version listed by the server via ALPN will be
used. Once connected, additional upgrades to newer versions may also
occur if the server lists support for it. In the future, headers such as
Alt-Svc
will be used.
Insecure connections always use HTTP/1.x since there is no standard mechanism for a server to declare support for insecure HTTP versions, and only HTTP/1.x and HTTP/2 support insecure transfers.
Connect via HTTP/2. Failure to connect will not fall back to old versions, unless HTTP/1.1 is negotiated via TLS ALPN before the session begins.
If HTTP/2 support is not compiled in, then using this strategy will always result in an error.
This strategy is often referred to as HTTP/2 with Prior Knowledge.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for VersionNegotiation
impl Send for VersionNegotiation
impl Sync for VersionNegotiation
impl Unpin for VersionNegotiation
impl UnwindSafe for VersionNegotiation
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more