pub struct Referer { /* private fields */ }
Expand description
Contains the address of the page making the request.
Important: Although this header has many innocent uses it can have undesirable consequences for user security and privacy.
Specifications
Examples
use http_types::{Response, Url};
use http_types::other::Referer;
let referer = Referer::new(Url::parse("https://example.net/")?);
let mut res = Response::new(200);
referer.apply(&mut res);
let base_url = Url::parse("https://example.net/")?;
let referer = Referer::from_headers(base_url, res)?.unwrap();
assert_eq!(referer.location(), &Url::parse("https://example.net/")?);
Implementations
impl Referer
impl Referer
pub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<Referer>, Error> where
U: TryInto<Url>,
<U as TryInto<Url>>::Error: Debug,
pub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<Referer>, Error> where
U: TryInto<Url>,
<U as TryInto<Url>>::Error: Debug,
Create a new instance from headers.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Referer
impl Send for Referer
impl Sync for Referer
impl Unpin for Referer
impl UnwindSafe for Referer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more