From c997ac0b35040a5ca2167f3d6fb77a9f9abba353 Mon Sep 17 00:00:00 2001 From: Garrett Squire Date: Thu, 6 Oct 2016 13:18:57 -0700 Subject: [PATCH] feat(headers): support multiple values for Referrer-Policy header Closes #882 --- src/header/common/referrer_policy.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/header/common/referrer_policy.rs b/src/header/common/referrer_policy.rs index 154ba90c79..a91946f2cd 100644 --- a/src/header/common/referrer_policy.rs +++ b/src/header/common/referrer_policy.rs @@ -54,8 +54,9 @@ impl Header for ReferrerPolicy { fn parse_header(raw: &Raw) -> ::Result { use self::ReferrerPolicy::*; - parsing::from_one_raw_str(raw).and_then(|s: String| { - let slice = &s.to_ascii_lowercase()[..]; + parsing::from_comma_delimited(raw).and_then(|v: Vec| { + let last = v.iter().last().unwrap(); + let slice = &last.to_ascii_lowercase()[..]; // See https://www.w3.org/TR/referrer-policy/#determine-policy-for-token match slice { "no-referrer" | "never" => Ok(NoReferrer),