Skip to content

Commit

Permalink
Merge pull request #943 from mrnayak/ref-policy-header
Browse files Browse the repository at this point in the history
feat(headers): Add strict-origin and strict-origin-when-cross-origin referer policy
  • Loading branch information
seanmonstar authored Oct 28, 2016
2 parents fe7f819 + 3593d79 commit c3c53dd
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 c3c53dd

Please sign in to comment.