pub struct ConnectionInfo { /* private fields */ }Expand description
HttpRequest connection information
Implementations§
Source§impl ConnectionInfo
impl ConnectionInfo
Sourcepub fn get<'a>(req: &'a RequestHead, cfg: &'a WebAppConfig) -> Ref<'a, Self>
pub fn get<'a>(req: &'a RequestHead, cfg: &'a WebAppConfig) -> Ref<'a, Self>
Create ConnectionInfo instance for a request.
Sourcepub fn scheme(&self) -> &str
pub fn scheme(&self) -> &str
Scheme of the request.
Scheme is resolved through the following headers, in this order:
- Forwarded
- X-Forwarded-Proto
- Uri
Sourcepub fn host(&self) -> &str
pub fn host(&self) -> &str
Hostname of the request.
Hostname is resolved through the following headers, in this order:
- Forwarded
- X-Forwarded-Host
- Uri
- Host
- Server hostname
Header values that are not a valid host[:port] are skipped.
Sourcepub fn remote(&self) -> Option<&str>
pub fn remote(&self) -> Option<&str>
Remote socket addr of client initiated HTTP request.
The addr is resolved through the following headers, in this order:
- Forwarded
- X-Forwarded-For
- peer name of opened socket
§Security
Do not use this function for security purposes, unless you can ensure the Forwarded and
X-Forwarded-For headers cannot be spoofed by the client. If you want the client’s socket
address explicitly, use
HttpRequest::peer_addr() instead.
Trait Implementations§
Source§impl Clone for ConnectionInfo
impl Clone for ConnectionInfo
Source§fn clone(&self) -> ConnectionInfo
fn clone(&self) -> ConnectionInfo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionInfo
impl Debug for ConnectionInfo
Source§impl Default for ConnectionInfo
impl Default for ConnectionInfo
Source§fn default() -> ConnectionInfo
fn default() -> ConnectionInfo
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConnectionInfo
impl RefUnwindSafe for ConnectionInfo
impl Send for ConnectionInfo
impl Sync for ConnectionInfo
impl Unpin for ConnectionInfo
impl UnsafeUnpin for ConnectionInfo
impl UnwindSafe for ConnectionInfo
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