Skip to content

Commit

Permalink
feat(headers): Add strict-origin and strict-origin-when-cross-origin …
Browse files Browse the repository at this point in the history
…referer policy

Support for strict-origin and strict-origin-when-cross-origin in referer
policy required for imporving network security. This commit will attempt
to add missing pieces of referrer policy.
  • Loading branch information
nmvk committed Oct 28, 2016
1 parent fe7f819 commit 3593d79
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/header/common/referrer_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub enum ReferrerPolicy {
OriginWhenCrossOrigin,
/// `unsafe-url`
UnsafeUrl,
/// `strict-origin`
StrictOrigin,
///`strict-origin-when-cross-origin`
StrictOriginWhenCrossOrigin,
}

impl Header for ReferrerPolicy {
Expand All @@ -65,6 +69,8 @@ impl Header for ReferrerPolicy {
"same-origin" => return Ok(SameOrigin),
"origin" => return Ok(Origin),
"origin-when-cross-origin" => return Ok(OriginWhenCrossOrigin),
"strict-origin" => return Ok(StrictOrigin),
"strict-origin-when-cross-origin" => return Ok(StrictOriginWhenCrossOrigin),
"unsafe-url" | "always" => return Ok(UnsafeUrl),
_ => continue,
}
Expand All @@ -81,6 +87,8 @@ impl Header for ReferrerPolicy {
SameOrigin => "same-origin",
Origin => "origin",
OriginWhenCrossOrigin => "origin-when-cross-origin",
StrictOrigin => "strict-origin",
StrictOriginWhenCrossOrigin => "strict-origin-when-cross-origin",
UnsafeUrl => "unsafe-url",
})
}
Expand Down

0 comments on commit 3593d79

Please sign in to comment.