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

Unified Diff: net/http/http_security_headers.cc

Issue 826423009: Treat HSTS and HPKP state independently. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test header parsing too Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_security_headers.cc
diff --git a/net/http/http_security_headers.cc b/net/http/http_security_headers.cc
index 8d0c1465307f8adb5da5eb61907e2a0b8b2d9da6..56fa82b16ab00ee4b1f8a9d1f2414961e322ffef 100644
--- a/net/http/http_security_headers.cc
+++ b/net/http/http_security_headers.cc
@@ -285,6 +285,7 @@ bool ParseHPKPHeader(const std::string& value,
std::string source = value;
+ hashes->clear();
Ryan Sleevi 2015/01/13 21:56:40 BUG: You should not clear this unless things parse
davidben 2015/01/13 23:30:47 Nah. AddHPKPHeader only ever calls it on a tempora
while (!source.empty()) {
StringPair semicolon = Split(source, ';');
semicolon.first = Strip(semicolon.first);
@@ -325,18 +326,7 @@ bool ParseHPKPHeader(const std::string& value,
*include_subdomains = include_subdomains_candidate;
for (HashValueVector::const_iterator i = pins.begin();
i != pins.end(); ++i) {
- bool found = false;
-
- for (HashValueVector::const_iterator j = hashes->begin();
- j != hashes->end(); ++j) {
- if (j->Equals(*i)) {
- found = true;
- break;
- }
- }
-
- if (!found)
- hashes->push_back(*i);
+ hashes->push_back(*i);
Ryan Sleevi 2015/01/13 21:56:40 These are both HashValueVectors. Why don't you ju
davidben 2015/01/13 23:30:47 Yeah, that's better. Done.
}
return true;

Powered by Google App Engine
This is Rietveld 408576698