pub struct Host(pub String);๐Deprecated: will be removed in the next version; see https://github.com/tokio-rs/axum/issues/3442
Expand description
Extractor that resolves the host of the request.
Host is resolved through the following, in order:
ForwardedheaderX-Forwarded-HostheaderHostheader- Authority of the request URI
See https://www.rfc-editor.org/rfc/rfc9110.html#name-host-and-authority for the definition of host.
Note that user agents can set X-Forwarded-Host and Host headers to arbitrary values so make
sure to validate them to avoid security issues.
Tuple Fieldsยง
ยง0: String๐Deprecated: will be removed in the next version; see https://github.com/tokio-rs/axum/issues/3442
Trait Implementationsยง
Sourceยงimpl<S> FromRequestParts<S> for Host
impl<S> FromRequestParts<S> for Host
Sourceยงimpl<S> OptionalFromRequestParts<S> for Host
impl<S> OptionalFromRequestParts<S> for Host
Auto Trait Implementationsยง
impl Freeze for Host
impl RefUnwindSafe for Host
impl Send for Host
impl Sync for Host
impl Unpin for Host
impl UnwindSafe for Host
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Sourceยงtype Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails itโll use this โrejectionโ type. A rejection is
a kind of error that can be converted into a response.
Sourceยงfn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Perform the extraction.