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

Side by Side Diff: components/ssl_errors/error_classification.cc

Issue 2433583002: Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: . Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/ssl_errors/error_classification.h" 5 #include "components/ssl_errors/error_classification.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 NOTREACHED(); 273 NOTREACHED();
274 return CLOCK_STATE_UNKNOWN; 274 return CLOCK_STATE_UNKNOWN;
275 } 275 }
276 276
277 void SetBuildTimeForTesting(const base::Time& testing_time) { 277 void SetBuildTimeForTesting(const base::Time& testing_time) {
278 g_testing_build_time.Get() = testing_time; 278 g_testing_build_time.Get() = testing_time;
279 } 279 }
280 280
281 bool IsHostNameKnownTLD(const std::string& host_name) { 281 bool IsHostNameKnownTLD(const std::string& host_name) {
282 size_t tld_length = net::registry_controlled_domains::GetRegistryLength( 282 return net::registry_controlled_domains::HostHasRegistryControlledDomain(
283 host_name, net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, 283 host_name,
284 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
284 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 285 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
285 if (tld_length == 0 || tld_length == std::string::npos)
286 return false;
287 return true;
288 } 286 }
289 287
290 HostnameTokens Tokenize(const std::string& name) { 288 HostnameTokens Tokenize(const std::string& name) {
291 return base::SplitString(name, ".", base::KEEP_WHITESPACE, 289 return base::SplitString(name, ".", base::KEEP_WHITESPACE,
292 base::SPLIT_WANT_ALL); 290 base::SPLIT_WANT_ALL);
293 } 291 }
294 292
295 bool GetWWWSubDomainMatch(const GURL& request_url, 293 bool GetWWWSubDomainMatch(const GURL& request_url,
296 const std::vector<std::string>& dns_names, 294 const std::vector<std::string>& dns_names,
297 std::string* www_match_host_name) { 295 std::string* www_match_host_name) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1, 477 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1,
480 host_name_domain) != dns_names_domain.end() - 1; 478 host_name_domain) != dns_names_domain.end() - 1;
481 } 479 }
482 480
483 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) { 481 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) {
484 return net::IsHostnameNonUnique(hostname) || 482 return net::IsHostnameNonUnique(hostname) ||
485 hostname.find('.') == std::string::npos; 483 hostname.find('.') == std::string::npos;
486 } 484 }
487 485
488 } // namespace ssl_errors 486 } // namespace ssl_errors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698