From 3593d7987a92518736e130586499d97afa3e5b04 Mon Sep 17 00:00:00 2001 From: Raghav Date: Fri, 28 Oct 2016 16:56:40 -0400 Subject: [PATCH] feat(headers): Add strict-origin and strict-origin-when-cross-origin 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. --- src/header/common/referrer_policy.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/header/common/referrer_policy.rs b/src/header/common/referrer_policy.rs index 863896d2bb..6483fe1550 100644 --- a/src/header/common/referrer_policy.rs +++ b/src/header/common/referrer_policy.rs @@ -44,6 +44,10 @@ pub enum ReferrerPolicy { OriginWhenCrossOrigin, /// `unsafe-url` UnsafeUrl, + /// `strict-origin` + StrictOrigin, + ///`strict-origin-when-cross-origin` + StrictOriginWhenCrossOrigin, } impl Header for ReferrerPolicy { @@ -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, } @@ -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", }) }