isahc::config

Struct VersionNegotiation

Source
pub struct VersionNegotiation(/* private fields */);
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§

Source§

impl VersionNegotiation

Source

pub const fn latest_compatible() -> Self

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/0.9, HTTP/1.x, and HTTP/2 support insecure transfers.

Source

pub const fn http10() -> Self

Connect via HTTP/1.0 and do not attempt to use a higher version.

Source

pub const fn http11() -> Self

Connect via HTTP/1.1 and do not attempt to use a higher version.

Source

pub const fn http2() -> Self

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.

Source

pub const fn http3() -> Self

Connect via HTTP/3. Failure to connect will not fall back to old versions.

Trait Implementations§

Source§

impl Clone for VersionNegotiation

Source§

fn clone(&self) -> VersionNegotiation

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VersionNegotiation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VersionNegotiation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T