From 01dbd931735c7b7497b7b83664462512f272bf58 Mon Sep 17 00:00:00 2001 From: "ericroman@google.com" Date: Tue, 23 Jun 2009 22:52:42 +0000 Subject: Original patch by pmarks@google.com (see http://codereview.chromium.org/113944) - Pull in googleurl r107, which includes the new CanonicalizeHostVerbose() function: http://code.google.com/p/google-url/source/detail?r=107 - Atomically update Chromium to make use of this new function. This allows us to extract better information about IP addresses using fewer, and cleaner, calls to googleurl. - Also, change a call to CanonicalizeIPAddress() to stay compatible with r107. The upshot of all this is, Chrome will no longer try to connect to IPv4 addresses with overflow "http://192.168.0.257", or hostnames surrounded by square brackets "http://[google.com]" BUG=none TEST={unit_tests,googleurl_unittests,net_unittests} Review URL: http://codereview.chromium.org/146053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19076 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/registry_controlled_domain.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'net/base/registry_controlled_domain.cc') diff --git a/net/base/registry_controlled_domain.cc b/net/base/registry_controlled_domain.cc index 7ea0a18..2bcfba5 100644 --- a/net/base/registry_controlled_domain.cc +++ b/net/base/registry_controlled_domain.cc @@ -63,9 +63,9 @@ std::string RegistryControlledDomainService::GetDomainAndRegistry( // static std::string RegistryControlledDomainService::GetDomainAndRegistry( const std::string& host) { - bool is_ip_address; - const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); - if (canon_host.empty() || is_ip_address) + url_canon::CanonHostInfo host_info; + const std::string canon_host(net::CanonicalizeHost(host, &host_info)); + if (canon_host.empty() || host_info.IsIPAddress()) return std::string(); return GetDomainAndRegistryImpl(canon_host); } @@ -73,9 +73,9 @@ std::string RegistryControlledDomainService::GetDomainAndRegistry( // static std::string RegistryControlledDomainService::GetDomainAndRegistry( const std::wstring& host) { - bool is_ip_address; - const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); - if (canon_host.empty() || is_ip_address) + url_canon::CanonHostInfo host_info; + const std::string canon_host(net::CanonicalizeHost(host, &host_info)); + if (canon_host.empty() || host_info.IsIPAddress()) return std::string(); return GetDomainAndRegistryImpl(canon_host); } @@ -121,11 +121,11 @@ size_t RegistryControlledDomainService::GetRegistryLength( size_t RegistryControlledDomainService::GetRegistryLength( const std::string& host, bool allow_unknown_registries) { - bool is_ip_address; - const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); + url_canon::CanonHostInfo host_info; + const std::string canon_host(net::CanonicalizeHost(host, &host_info)); if (canon_host.empty()) return std::string::npos; - if (is_ip_address) + if (host_info.IsIPAddress()) return 0; return GetInstance()->GetRegistryLengthImpl(canon_host, allow_unknown_registries); @@ -135,11 +135,11 @@ size_t RegistryControlledDomainService::GetRegistryLength( size_t RegistryControlledDomainService::GetRegistryLength( const std::wstring& host, bool allow_unknown_registries) { - bool is_ip_address; - const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); + url_canon::CanonHostInfo host_info; + const std::string canon_host(net::CanonicalizeHost(host, &host_info)); if (canon_host.empty()) return std::string::npos; - if (is_ip_address) + if (host_info.IsIPAddress()) return 0; return GetInstance()->GetRegistryLengthImpl(canon_host, allow_unknown_registries); -- cgit v1.1