Skip to content

Commit

Permalink
feat(headers): support multiple values for Referrer-Policy header
Browse files Browse the repository at this point in the history
  • Loading branch information
gsquire committed Oct 6, 2016
1 parent 8672ec5 commit c997ac0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/header/common/referrer_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ impl Header for ReferrerPolicy {

fn parse_header(raw: &Raw) -> ::Result<ReferrerPolicy> {
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<String>| {
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),
Expand Down

0 comments on commit c997ac0

Please sign in to comment.