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

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

Issue 1811163002: Share link header parsing code between blink and content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base-optional
Patch Set: address more comments Created 4 years, 7 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
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 <limits> 5 #include <limits>
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/strings/string_tokenizer.h" 9 #include "base/strings/string_tokenizer.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 GURL* report_uri) { 121 GURL* report_uri) {
122 bool parsed_max_age = false; 122 bool parsed_max_age = false;
123 bool include_subdomains_candidate = false; 123 bool include_subdomains_candidate = false;
124 uint32_t max_age_candidate = 0; 124 uint32_t max_age_candidate = 0;
125 GURL parsed_report_uri; 125 GURL parsed_report_uri;
126 HashValueVector pins; 126 HashValueVector pins;
127 bool require_max_age = max_age_status == REQUIRE_MAX_AGE; 127 bool require_max_age = max_age_status == REQUIRE_MAX_AGE;
128 128
129 HttpUtil::NameValuePairsIterator name_value_pairs( 129 HttpUtil::NameValuePairsIterator name_value_pairs(
130 value.begin(), value.end(), ';', 130 value.begin(), value.end(), ';',
131 HttpUtil::NameValuePairsIterator::VALUES_OPTIONAL); 131 HttpUtil::NameValuePairsIterator::Values::OPTIONAL,
132 HttpUtil::NameValuePairsIterator::Quotes::NOT_STRICT);
132 133
133 while (name_value_pairs.GetNext()) { 134 while (name_value_pairs.GetNext()) {
134 if (base::LowerCaseEqualsASCII( 135 if (base::LowerCaseEqualsASCII(
135 base::StringPiece(name_value_pairs.name_begin(), 136 base::StringPiece(name_value_pairs.name_begin(),
136 name_value_pairs.name_end()), 137 name_value_pairs.name_end()),
137 "max-age")) { 138 "max-age")) {
138 if (!MaxAgeToLimitedInt(name_value_pairs.value_begin(), 139 if (!MaxAgeToLimitedInt(name_value_pairs.value_begin(),
139 name_value_pairs.value_end(), kMaxHPKPAgeSecs, 140 name_value_pairs.value_end(), kMaxHPKPAgeSecs,
140 &max_age_candidate)) { 141 &max_age_candidate)) {
141 return false; 142 return false;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 bool* include_subdomains, 364 bool* include_subdomains,
364 HashValueVector* hashes, 365 HashValueVector* hashes,
365 GURL* report_uri) { 366 GURL* report_uri) {
366 // max-age is irrelevant for Report-Only headers. 367 // max-age is irrelevant for Report-Only headers.
367 base::TimeDelta unused_max_age; 368 base::TimeDelta unused_max_age;
368 return ParseHPKPHeaderImpl(value, DO_NOT_REQUIRE_MAX_AGE, &unused_max_age, 369 return ParseHPKPHeaderImpl(value, DO_NOT_REQUIRE_MAX_AGE, &unused_max_age,
369 include_subdomains, hashes, report_uri); 370 include_subdomains, hashes, report_uri);
370 } 371 }
371 372
372 } // namespace net 373 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698