Struct http_types::other::Referer [−][src]
pub struct Referer { /* fields omitted */ }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[src]
impl Referer[src]pub fn new(location: Url) -> Self[src]
Create a new instance of Referer header.
pub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<Self>> where
U: TryInto<Url>,
U::Error: Debug, [src]
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<Self>> where
U: TryInto<Url>,
U::Error: Debug,
Create a new instance from headers.
pub fn apply(&self, headers: impl AsMut<Headers>)[src]
Sets the header.
pub fn name(&self) -> HeaderName[src]
Get the HeaderName.
pub fn value(&self) -> HeaderValue[src]
Get the HeaderValue.
pub fn location(&self) -> &Url[src]
Get the url.
pub fn set_location<U>(&mut self, location: U) -> Result<(), U::Error> where
U: TryInto<Url>,
U::Error: Debug, [src]
U: TryInto<Url>,
U::Error: Debug,
Set the url.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Referer
impl RefUnwindSafe for Refererimpl UnwindSafe for Referer
impl UnwindSafe for Referer