Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp

Issue 2733943002: Trim whitespace from Referrer-Policy tokens (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 bool SecurityPolicy::referrerPolicyFromHeaderValue( 295 bool SecurityPolicy::referrerPolicyFromHeaderValue(
296 const String& headerValue, 296 const String& headerValue,
297 ReferrerPolicyLegacyKeywordsSupport legacyKeywordsSupport, 297 ReferrerPolicyLegacyKeywordsSupport legacyKeywordsSupport,
298 ReferrerPolicy* result) { 298 ReferrerPolicy* result) {
299 ReferrerPolicy referrerPolicy = ReferrerPolicyDefault; 299 ReferrerPolicy referrerPolicy = ReferrerPolicyDefault;
300 300
301 Vector<String> tokens; 301 Vector<String> tokens;
302 headerValue.split(',', true, tokens); 302 headerValue.split(',', true, tokens);
303 for (const auto& token : tokens) { 303 for (const auto& token : tokens) {
304 ReferrerPolicy currentResult; 304 ReferrerPolicy currentResult;
305 if (SecurityPolicy::referrerPolicyFromString(token, legacyKeywordsSupport, 305 if (SecurityPolicy::referrerPolicyFromString(
306 &currentResult)) { 306 token.stripWhiteSpace(), legacyKeywordsSupport, &currentResult)) {
307 referrerPolicy = currentResult; 307 referrerPolicy = currentResult;
308 } 308 }
309 } 309 }
310 310
311 if (referrerPolicy == ReferrerPolicyDefault) 311 if (referrerPolicy == ReferrerPolicyDefault)
312 return false; 312 return false;
313 313
314 *result = referrerPolicy; 314 *result = referrerPolicy;
315 return true; 315 return true;
316 } 316 }
317 317
318 } // namespace blink 318 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698