diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 22:52:42 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 22:52:42 +0000 |
commit | 01dbd931735c7b7497b7b83664462512f272bf58 (patch) | |
tree | 39eaf9d56354fa8b45aadedd6faaf03aec000b98 /net/base/registry_controlled_domain.cc | |
parent | 99224582c3e56f3cb354f633baf06caa5b98e751 (diff) | |
download | chromium_src-01dbd931735c7b7497b7b83664462512f272bf58.zip chromium_src-01dbd931735c7b7497b7b83664462512f272bf58.tar.gz chromium_src-01dbd931735c7b7497b7b83664462512f272bf58.tar.bz2 |
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
Diffstat (limited to 'net/base/registry_controlled_domain.cc')
-rw-r--r-- | net/base/registry_controlled_domain.cc | 24 |
1 files changed, 12 insertions, 12 deletions
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); |