pub trait RequestInformation {
// Required methods
fn is_host_header_allowed(&self) -> bool;
fn host_header(&self) -> Option<&str>;
fn authority(&self) -> Option<&str>;
fn forwarded(&self) -> impl DoubleEndedIterator<Item = &str>;
fn x_forwarded_for(&self) -> impl DoubleEndedIterator<Item = &str>;
fn x_forwarded_host(&self) -> impl DoubleEndedIterator<Item = &str>;
fn x_forwarded_proto(&self) -> impl DoubleEndedIterator<Item = &str>;
fn x_forwarded_by(&self) -> impl DoubleEndedIterator<Item = &str>;
fn default_scheme(&self) -> Option<&str>;
// Provided method
fn default_host(&self) -> Option<&str> { ... }
}Expand description
A trait to extract required information from a request in order to fetch trusted information
Required Methods§
Sourcefn is_host_header_allowed(&self) -> bool
fn is_host_header_allowed(&self) -> bool
Check if the host header is allowed
Most implementations should return true if the HTTP version is less than HTTP/2
Sourcefn host_header(&self) -> Option<&str>
fn host_header(&self) -> Option<&str>
Get the host header of the request
Get the authority of the request
Sourcefn forwarded(&self) -> impl DoubleEndedIterator<Item = &str>
fn forwarded(&self) -> impl DoubleEndedIterator<Item = &str>
Get the Forwarded header values
A double-ended iterator is returned to allow the implementation to optimize the iteration in case of multiple values
Sourcefn x_forwarded_for(&self) -> impl DoubleEndedIterator<Item = &str>
fn x_forwarded_for(&self) -> impl DoubleEndedIterator<Item = &str>
Get the X-Forwarded-For header values
Sourcefn x_forwarded_host(&self) -> impl DoubleEndedIterator<Item = &str>
fn x_forwarded_host(&self) -> impl DoubleEndedIterator<Item = &str>
Get the X-Forwarded-Host header values
Sourcefn x_forwarded_proto(&self) -> impl DoubleEndedIterator<Item = &str>
fn x_forwarded_proto(&self) -> impl DoubleEndedIterator<Item = &str>
Get the X-Forwarded-Proto header values
Sourcefn x_forwarded_by(&self) -> impl DoubleEndedIterator<Item = &str>
fn x_forwarded_by(&self) -> impl DoubleEndedIterator<Item = &str>
Get the X-Forwarded-By header values
Sourcefn default_scheme(&self) -> Option<&str>
fn default_scheme(&self) -> Option<&str>
Return the default scheme of the request when no trusted headers are found
Provided Methods§
Sourcefn default_host(&self) -> Option<&str>
fn default_host(&self) -> Option<&str>
Return the default host of the request when no trusted headers are found
Default to host header if allowed or authority
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.