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

Side by Side Diff: net/base/url_util.cc

Issue 2454553002: Revert of Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/base/url_util.h" 5 #include "net/base/url_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <netinet/in.h> 10 #include <netinet/in.h>
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 // Check for a registry controlled portion of |hostname|, ignoring private 336 // Check for a registry controlled portion of |hostname|, ignoring private
337 // registries, as they already chain to ICANN-administered registries, 337 // registries, as they already chain to ICANN-administered registries,
338 // and explicitly ignoring unknown registries. 338 // and explicitly ignoring unknown registries.
339 // 339 //
340 // Note: This means that as new gTLDs are introduced on the Internet, they 340 // Note: This means that as new gTLDs are introduced on the Internet, they
341 // will be treated as non-unique until the registry controlled domain list 341 // will be treated as non-unique until the registry controlled domain list
342 // is updated. However, because gTLDs are expected to provide significant 342 // is updated. However, because gTLDs are expected to provide significant
343 // advance notice to deprecate older versions of this code, this an 343 // advance notice to deprecate older versions of this code, this an
344 // acceptable tradeoff. 344 // acceptable tradeoff.
345 return !registry_controlled_domains::HostHasRegistryControlledDomain( 345 return 0 == registry_controlled_domains::GetRegistryLength(
346 canonical_name, registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, 346 canonical_name,
347 registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); 347 registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
348 registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
348 } 349 }
349 350
350 bool IsLocalhost(base::StringPiece host) { 351 bool IsLocalhost(base::StringPiece host) {
351 if (IsLocalHostname(host, nullptr)) 352 if (IsLocalHostname(host, nullptr))
352 return true; 353 return true;
353 354
354 IPAddress ip_address; 355 IPAddress ip_address;
355 if (ip_address.AssignFromIPLiteral(host)) { 356 if (ip_address.AssignFromIPLiteral(host)) {
356 size_t size = ip_address.size(); 357 size_t size = ip_address.size();
357 switch (size) { 358 switch (size) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 431 }
431 432
432 if (is_local6) 433 if (is_local6)
433 *is_local6 = false; 434 *is_local6 = false;
434 return normalized_host == "localhost" || 435 return normalized_host == "localhost" ||
435 normalized_host == "localhost.localdomain" || 436 normalized_host == "localhost.localdomain" ||
436 IsNormalizedLocalhostTLD(normalized_host); 437 IsNormalizedLocalhostTLD(normalized_host);
437 } 438 }
438 439
439 } // namespace net 440 } // namespace net
OLDNEW
« no previous file with comments | « net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc ('k') | net/cert/cert_verify_proc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698