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

Side by Side Diff: net/http/http_security_headers.cc

Issue 86043003: net: don't duplicate HPKP hashes when parsing the header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/base64.h" 5 #include "base/base64.h"
6 #include "base/basictypes.h" 6 #include "base/basictypes.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "net/http/http_security_headers.h" 10 #include "net/http/http_security_headers.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 if (!parsed_max_age) 318 if (!parsed_max_age)
319 return false; 319 return false;
320 320
321 if (!IsPinListValid(pins, chain_hashes)) 321 if (!IsPinListValid(pins, chain_hashes))
322 return false; 322 return false;
323 323
324 *max_age = base::TimeDelta::FromSeconds(max_age_candidate); 324 *max_age = base::TimeDelta::FromSeconds(max_age_candidate);
325 *include_subdomains = include_subdomains_candidate; 325 *include_subdomains = include_subdomains_candidate;
326 for (HashValueVector::const_iterator i = pins.begin(); 326 for (HashValueVector::const_iterator i = pins.begin();
327 i != pins.end(); ++i) { 327 i != pins.end(); ++i) {
328 hashes->push_back(*i); 328 bool found = false;
329
330 for (HashValueVector::const_iterator j = hashes->begin();
331 j != hashes->end(); ++j) {
332 if (j->Equals(*i)) {
333 found = true;
334 break;
335 }
336 }
337
338 if (!found)
339 hashes->push_back(*i);
329 } 340 }
330 341
331 return true; 342 return true;
332 } 343 }
333 344
334 } // namespace net 345 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698