summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 14:41:40 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 14:41:40 +0000
commit69e6633595327cfc99037eedec0f64821cafc569 (patch)
tree25fc7b2e9db997e018dd127bbab18a6fd71fe0a9 /net/base
parentc3d6b25093e1c915364e72f9c008e81972419f04 (diff)
downloadchromium_src-69e6633595327cfc99037eedec0f64821cafc569.zip
chromium_src-69e6633595327cfc99037eedec0f64821cafc569.tar.gz
chromium_src-69e6633595327cfc99037eedec0f64821cafc569.tar.bz2
Revert 43826 - HostResolver now adds AI_CANONNAME to the hint flags if a requester needs the information.
Requests which want the canonical name should be treated differently from requests that do not for the same host in both the HostCache as well as in the HostResolver when combining multiple outstanding requests into a job. The motivation for this is that Kerberos SPN's for a web server are typically generated using the canonical name of the server rather than a DNS alias (both Firefox and IE have this behavior). BUG=29862 TEST=net_unittests Review URL: http://codereview.chromium.org/1566012 TBR=cbentzel@chromium.org Review URL: http://codereview.chromium.org/1629005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/address_family.h11
-rw-r--r--net/base/address_list.cc10
-rw-r--r--net/base/address_list.h11
-rw-r--r--net/base/address_list_unittest.cc70
-rw-r--r--net/base/host_cache.h23
-rw-r--r--net/base/host_cache_unittest.cc87
-rw-r--r--net/base/host_resolver.h11
-rw-r--r--net/base/host_resolver_impl.cc16
-rw-r--r--net/base/host_resolver_impl_unittest.cc13
-rw-r--r--net/base/host_resolver_proc.cc18
-rw-r--r--net/base/host_resolver_proc.h3
-rw-r--r--net/base/mock_host_resolver.cc12
-rw-r--r--net/base/mock_host_resolver.h5
13 files changed, 53 insertions, 237 deletions
diff --git a/net/base/address_family.h b/net/base/address_family.h
index 919c600..065927f 100644
--- a/net/base/address_family.h
+++ b/net/base/address_family.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,13 +15,6 @@ enum AddressFamily {
ADDRESS_FAMILY_IPV6, // AF_INET6
};
-// HostResolverFlags is a bitflag enum wrapper around the addrinfo.ai_flags
-// supported by host resolver procedures.
-enum {
- HOST_RESOLVER_FLAGS_CANONNAME = 1 << 0, // AI_CANONNAME, 0x1
-};
-typedef int HostResolverFlags;
-
-} // namespace net
+} // namesapce net
#endif // NET_BASE_ADDRESS_FAMILY_H_
diff --git a/net/base/address_list.cc b/net/base/address_list.cc
index 55a5992..d1624be 100644
--- a/net/base/address_list.cc
+++ b/net/base/address_list.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -133,14 +133,6 @@ int AddressList::GetPort() const {
return ntohs(*port_field);
}
-bool AddressList::GetCanonicalName(std::string* canonical_name) const {
- DCHECK(canonical_name);
- if (!data_->head || !data_->head->ai_canonname)
- return false;
- canonical_name->assign(data_->head->ai_canonname);
- return true;
-}
-
void AddressList::SetFrom(const AddressList& src, int port) {
if (src.GetPort() == port) {
// We can reference the data from |src| directly.
diff --git a/net/base/address_list.h b/net/base/address_list.h
index f0eb0ce..b477987 100644
--- a/net/base/address_list.h
+++ b/net/base/address_list.h
@@ -1,12 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_BASE_ADDRESS_LIST_H_
#define NET_BASE_ADDRESS_LIST_H_
-#include <string>
-
#include "base/ref_counted.h"
struct addrinfo;
@@ -48,13 +46,6 @@ class AddressList {
// a reference to |src|'s data.) Otherwise we will make a copy.
void SetFrom(const AddressList& src, int port);
- // Gets the canonical name for the address.
- // If the canonical name exists, |*canonical_name| is filled in with the
- // value and true is returned. If it does not exist, |*canonical_name| is
- // not altered and false is returned.
- // |canonical_name| must be a non-null value.
- bool GetCanonicalName(std::string* canonical_name) const;
-
// Clears all data from this address list. This leaves the list in the same
// empty state as when first constructed.
void Reset();
diff --git a/net/base/address_list_unittest.cc b/net/base/address_list_unittest.cc
index 219d289..dbd0f24 100644
--- a/net/base/address_list_unittest.cc
+++ b/net/base/address_list_unittest.cc
@@ -1,13 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/base/address_list.h"
-#if defined(OS_POSIX)
-#include <arpa/inet.h> // For inet_pton
-#endif // defined(OS_POSIX)
-
#include "base/string_util.h"
#include "net/base/host_resolver_proc.h"
#include "net/base/net_util.h"
@@ -21,29 +17,27 @@ namespace {
// Use getaddrinfo() to allocate an addrinfo structure.
void CreateAddressList(const std::string& hostname,
- int port,
- net::AddressList* addrlist) {
+ net::AddressList* addrlist, int port) {
#if defined(OS_WIN)
net::EnsureWinsockInit();
#endif
int rv = SystemHostResolverProc(hostname,
net::ADDRESS_FAMILY_UNSPECIFIED,
- 0,
addrlist);
EXPECT_EQ(0, rv);
addrlist->SetPort(port);
}
void CreateLongAddressList(net::AddressList* addrlist, int port) {
- CreateAddressList("192.168.1.1", port, addrlist);
+ CreateAddressList("192.168.1.1", addrlist, port);
net::AddressList second_list;
- CreateAddressList("192.168.1.2", port, &second_list);
+ CreateAddressList("192.168.1.2", &second_list, port);
addrlist->Append(second_list.head());
}
TEST(AddressListTest, GetPort) {
net::AddressList addrlist;
- CreateAddressList("192.168.1.1", 81, &addrlist);
+ CreateAddressList("192.168.1.1", &addrlist, 81);
EXPECT_EQ(81, addrlist.GetPort());
addrlist.SetPort(83);
@@ -52,7 +46,7 @@ TEST(AddressListTest, GetPort) {
TEST(AddressListTest, Assignment) {
net::AddressList addrlist1;
- CreateAddressList("192.168.1.1", 85, &addrlist1);
+ CreateAddressList("192.168.1.1", &addrlist1, 85);
EXPECT_EQ(85, addrlist1.GetPort());
// Should reference the same data as addrlist1 -- so when we change addrlist1
@@ -111,10 +105,10 @@ TEST(AddressListTest, CopyNonRecursive) {
TEST(AddressListTest, Append) {
net::AddressList addrlist1;
- CreateAddressList("192.168.1.1", 11, &addrlist1);
+ CreateAddressList("192.168.1.1", &addrlist1, 11);
EXPECT_EQ(11, addrlist1.GetPort());
net::AddressList addrlist2;
- CreateAddressList("192.168.1.2", 12, &addrlist2);
+ CreateAddressList("192.168.1.2", &addrlist2, 12);
EXPECT_EQ(12, addrlist2.GetPort());
ASSERT_TRUE(addrlist1.head()->ai_next == NULL);
@@ -126,52 +120,4 @@ TEST(AddressListTest, Append) {
EXPECT_EQ(12, addrlist3.GetPort());
}
-static const char* kCanonicalHost = "canonical.bar.com";
-
-TEST(AddressListTest, Canonical) {
- // Create an addrinfo with a canonical name.
- sockaddr_in address;
- EXPECT_EQ(1, inet_pton(AF_INET, "10.0.0.1", &address));
- struct addrinfo ai;
- memset(&ai, 0x0, sizeof(ai));
- ai.ai_family = AF_INET;
- ai.ai_socktype = SOCK_STREAM;
- ai.ai_addrlen = sizeof(address);
- ai.ai_addr = reinterpret_cast<sockaddr*>(&address);
- ai.ai_canonname = const_cast<char *>(kCanonicalHost);
-
- // Copy the addrinfo struct into an AddressList object and
- // make sure it seems correct.
- net::AddressList addrlist1;
- addrlist1.Copy(&ai, true);
- const struct addrinfo* addrinfo1 = addrlist1.head();
- EXPECT_TRUE(addrinfo1 != NULL);
- EXPECT_TRUE(addrinfo1->ai_next == NULL);
- std::string canon_name1;
- EXPECT_TRUE(addrlist1.GetCanonicalName(&canon_name1));
- EXPECT_EQ("canonical.bar.com", canon_name1);
-
- // Copy the AddressList to another one.
- net::AddressList addrlist2;
- addrlist2.Copy(addrinfo1, true);
- const struct addrinfo* addrinfo2 = addrlist2.head();
- EXPECT_TRUE(addrinfo2 != NULL);
- EXPECT_TRUE(addrinfo2->ai_next == NULL);
- EXPECT_TRUE(addrinfo2->ai_canonname != NULL);
- EXPECT_NE(addrinfo1, addrinfo2);
- EXPECT_NE(addrinfo1->ai_canonname, addrinfo2->ai_canonname);
- std::string canon_name2;
- EXPECT_TRUE(addrlist2.GetCanonicalName(&canon_name2));
- EXPECT_EQ("canonical.bar.com", canon_name2);
-
- // Make sure that GetCanonicalName correctly returns false
- // when ai_canonname is NULL.
- ai.ai_canonname = NULL;
- net::AddressList addrlist_no_canon;
- addrlist_no_canon.Copy(&ai, true);
- std::string canon_name3 = "blah";
- EXPECT_FALSE(addrlist_no_canon.GetCanonicalName(&canon_name3));
- EXPECT_EQ("blah", canon_name3);
-}
-
} // namespace
diff --git a/net/base/host_cache.h b/net/base/host_cache.h
index dd31871..c13c6a0 100644
--- a/net/base/host_cache.h
+++ b/net/base/host_cache.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -37,29 +37,22 @@ class HostCache {
};
struct Key {
- Key(const std::string& hostname, AddressFamily address_family,
- HostResolverFlags host_resolver_flags)
- : hostname(hostname),
- address_family(address_family),
- host_resolver_flags(host_resolver_flags) {}
+ Key(const std::string& hostname, AddressFamily address_family)
+ : hostname(hostname), address_family(address_family) {}
bool operator==(const Key& other) const {
- return (other.address_family == address_family &&
- other.host_resolver_flags == host_resolver_flags &&
- other.hostname == hostname);
+ return other.hostname == hostname &&
+ other.address_family == address_family;
}
bool operator<(const Key& other) const {
- if (address_family != other.address_family)
- return address_family < other.address_family;
- if (host_resolver_flags != other.host_resolver_flags)
- return host_resolver_flags < other.host_resolver_flags;
- return hostname < other.hostname;
+ if (address_family == other.address_family)
+ return hostname < other.hostname;
+ return address_family < other.address_family;
}
std::string hostname;
AddressFamily address_family;
- HostResolverFlags host_resolver_flags;
};
typedef std::map<Key, scoped_refptr<Entry> > EntryMap;
diff --git a/net/base/host_cache_unittest.cc b/net/base/host_cache_unittest.cc
index 2ed47ab..141cfde 100644
--- a/net/base/host_cache_unittest.cc
+++ b/net/base/host_cache_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,7 +20,7 @@ const base::TimeDelta kFailureEntryTTL = base::TimeDelta::FromSeconds(0);
// Builds a key for |hostname|, defaulting the address family to unspecified.
HostCache::Key Key(const std::string& hostname) {
- return HostCache::Key(hostname, ADDRESS_FAMILY_UNSPECIFIED, 0);
+ return HostCache::Key(hostname, ADDRESS_FAMILY_UNSPECIFIED);
}
} // namespace
@@ -276,8 +276,8 @@ TEST(HostCacheTest, AddressFamilyIsPartOfKey) {
// t=0.
base::TimeTicks now;
- HostCache::Key key1("foobar.com", ADDRESS_FAMILY_UNSPECIFIED, 0);
- HostCache::Key key2("foobar.com", ADDRESS_FAMILY_IPV4, 0);
+ HostCache::Key key1("foobar.com", ADDRESS_FAMILY_UNSPECIFIED);
+ HostCache::Key key2("foobar.com", ADDRESS_FAMILY_IPV4);
const HostCache::Entry* entry1 = NULL; // Entry for key1
const HostCache::Entry* entry2 = NULL; // Entry for key2
@@ -303,42 +303,6 @@ TEST(HostCacheTest, AddressFamilyIsPartOfKey) {
EXPECT_NE(entry1, entry2);
}
-// Tests that the same hostname can be duplicated in the cache, so long as
-// the HostResolverFlags differ.
-TEST(HostCacheTest, HostResolverFlagsArePartOfKey) {
- HostCache cache(kMaxCacheEntries, kSuccessEntryTTL, kFailureEntryTTL);
-
- // t=0.
- base::TimeTicks now;
-
- HostCache::Key key1("foobar.com", ADDRESS_FAMILY_IPV4, 0);
- HostCache::Key key2("foobar.com", ADDRESS_FAMILY_IPV4,
- HOST_RESOLVER_FLAGS_CANONNAME);
-
- const HostCache::Entry* entry1 = NULL; // Entry for key1
- const HostCache::Entry* entry2 = NULL; // Entry for key2
-
- EXPECT_EQ(0U, cache.size());
-
- // Add an entry for ("foobar.com", IPV4, NONE) at t=0.
- EXPECT_TRUE(cache.Lookup(key1, base::TimeTicks()) == NULL);
- cache.Set(key1, OK, AddressList(), now);
- entry1 = cache.Lookup(key1, base::TimeTicks());
- EXPECT_FALSE(entry1 == NULL);
- EXPECT_EQ(1U, cache.size());
-
- // Add an entry for ("foobar.com", IPV4, CANONNAME) at t=0.
- EXPECT_TRUE(cache.Lookup(key2, base::TimeTicks()) == NULL);
- cache.Set(key2, OK, AddressList(), now);
- entry2 = cache.Lookup(key2, base::TimeTicks());
- EXPECT_FALSE(entry2 == NULL);
- EXPECT_EQ(2U, cache.size());
-
- // Even though the hostnames were the same, we should have two unique
- // entries (because the HostResolverFlags differ).
- EXPECT_NE(entry1, entry2);
-}
-
TEST(HostCacheTest, NoCache) {
// Disable caching.
HostCache cache(0, kSuccessEntryTTL, kFailureEntryTTL);
@@ -389,52 +353,33 @@ TEST(HostCacheTest, KeyComparators) {
int expected_comparison;
} tests[] = {
{
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
+ HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED),
+ HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED),
0
},
{
- HostCache::Key("host1", ADDRESS_FAMILY_IPV4, 0),
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
+ HostCache::Key("host1", ADDRESS_FAMILY_IPV4),
+ HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED),
1
},
{
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
- HostCache::Key("host1", ADDRESS_FAMILY_IPV4, 0),
+ HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED),
+ HostCache::Key("host1", ADDRESS_FAMILY_IPV4),
-1
},
{
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
- HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED, 0),
- -1
- },
- {
- HostCache::Key("host1", ADDRESS_FAMILY_IPV4, 0),
- HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED, 0),
- 1
- },
- {
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
- HostCache::Key("host2", ADDRESS_FAMILY_IPV4, 0),
- -1
- },
- {
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED,
- HOST_RESOLVER_FLAGS_CANONNAME),
+ HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED),
+ HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED),
-1
},
{
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED,
- HOST_RESOLVER_FLAGS_CANONNAME),
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
+ HostCache::Key("host1", ADDRESS_FAMILY_IPV4),
+ HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED),
1
},
{
- HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED,
- HOST_RESOLVER_FLAGS_CANONNAME),
- HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED,
- HOST_RESOLVER_FLAGS_CANONNAME),
+ HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED),
+ HostCache::Key("host2", ADDRESS_FAMILY_IPV4),
-1
},
};
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index f91878e..8f7bd09 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -41,7 +41,6 @@ class HostResolver : public base::RefCountedThreadSafe<HostResolver> {
RequestInfo(const std::string& hostname, int port)
: hostname_(hostname),
address_family_(ADDRESS_FAMILY_UNSPECIFIED),
- host_resolver_flags_(0),
port_(port),
allow_cached_response_(true),
is_speculative_(false),
@@ -62,13 +61,6 @@ class HostResolver : public base::RefCountedThreadSafe<HostResolver> {
address_family_ = address_family;
}
- HostResolverFlags host_resolver_flags() const {
- return host_resolver_flags_;
- }
- void set_host_resolver_flags(HostResolverFlags host_resolver_flags) {
- host_resolver_flags_ = host_resolver_flags;
- }
-
bool allow_cached_response() const { return allow_cached_response_; }
void set_allow_cached_response(bool b) { allow_cached_response_ = b; }
@@ -88,9 +80,6 @@ class HostResolver : public base::RefCountedThreadSafe<HostResolver> {
// The address family to restrict results to.
AddressFamily address_family_;
- // Flags for the address.
- HostResolverFlags host_resolver_flags_;
-
// The port number to set in the result's sockaddrs.
int port_;
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index b8d4215..44bbe41 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -60,16 +60,13 @@ HostResolver* CreateSystemHostResolver(
static int ResolveAddrInfo(HostResolverProc* resolver_proc,
const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* out) {
if (resolver_proc) {
// Use the custom procedure.
- return resolver_proc->Resolve(host, address_family,
- host_resolver_flags, out);
+ return resolver_proc->Resolve(host, address_family, out);
} else {
// Use the system procedure (getaddrinfo).
- return SystemHostResolverProc(host, address_family,
- host_resolver_flags, out);
+ return SystemHostResolverProc(host, address_family, out);
}
}
@@ -326,7 +323,6 @@ class HostResolverImpl::Job
error_ = ResolveAddrInfo(resolver_proc_,
key_.hostname,
key_.address_family,
- key_.host_resolver_flags,
&results_);
if (requests_trace_) {
@@ -747,8 +743,7 @@ int HostResolverImpl::Resolve(const RequestInfo& info,
if (!callback) {
AddressList addrlist;
int error = ResolveAddrInfo(
- effective_resolver_proc(), key.hostname, key.address_family,
- key.host_resolver_flags, &addrlist);
+ effective_resolver_proc(), key.hostname, key.address_family, &addrlist);
if (error == OK) {
addrlist.SetPort(info.port());
*addresses = addrlist;
@@ -1156,8 +1151,7 @@ HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
AddressFamily effective_address_family = info.address_family();
if (effective_address_family == ADDRESS_FAMILY_UNSPECIFIED)
effective_address_family = default_address_family_;
- return Key(info.hostname(), effective_address_family,
- info.host_resolver_flags());
+ return Key(info.hostname(), effective_address_family);
}
HostResolverImpl::Job* HostResolverImpl::CreateAndStartJob(Request* req) {
diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc
index dc7ff13..bd19f0b 100644
--- a/net/base/host_resolver_impl_unittest.cc
+++ b/net/base/host_resolver_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -73,8 +73,7 @@ class CapturingHostResolverProc : public HostResolverProc {
public:
struct CaptureEntry {
CaptureEntry(const std::string& hostname, AddressFamily address_family)
- : hostname(hostname),
- address_family(address_family) {}
+ : hostname(hostname), address_family(address_family) {}
std::string hostname;
AddressFamily address_family;
};
@@ -91,15 +90,13 @@ class CapturingHostResolverProc : public HostResolverProc {
virtual int Resolve(const std::string& hostname,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist) {
event_.Wait();
{
AutoLock l(lock_);
capture_list_.push_back(CaptureEntry(hostname, address_family));
}
- return ResolveUsingPrevious(hostname, address_family,
- host_resolver_flags, addrlist);
+ return ResolveUsingPrevious(hostname, address_family, addrlist);
}
CaptureList GetCaptureList() const {
@@ -137,7 +134,6 @@ class EchoingHostResolverProc : public HostResolverProc {
virtual int Resolve(const std::string& hostname,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist) {
// Encode the request's hostname and address_family in the output address.
std::string ip_literal = StringPrintf("192.%d.%d.%d",
@@ -147,7 +143,6 @@ class EchoingHostResolverProc : public HostResolverProc {
return SystemHostResolverProc(ip_literal,
ADDRESS_FAMILY_UNSPECIFIED,
- host_resolver_flags,
addrlist);
}
};
@@ -1496,8 +1491,6 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_Synchronous) {
EXPECT_EQ("192.1.98.1", NetAddressToString(addrlist[3].head()));
}
-// TODO(cbentzel): Test a mix of requests with different HostResolverFlags.
-
} // namespace
} // namespace net
diff --git a/net/base/host_resolver_proc.cc b/net/base/host_resolver_proc.cc
index feff5cf..5ccf01a 100644
--- a/net/base/host_resolver_proc.cc
+++ b/net/base/host_resolver_proc.cc
@@ -67,18 +67,14 @@ HostResolverProc* HostResolverProc::GetDefault() {
return default_proc_;
}
-int HostResolverProc::ResolveUsingPrevious(
- const std::string& host,
- AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
- AddressList* addrlist) {
+int HostResolverProc::ResolveUsingPrevious(const std::string& host,
+ AddressFamily address_family,
+ AddressList* addrlist) {
if (previous_proc_)
- return previous_proc_->Resolve(host, address_family,
- host_resolver_flags, addrlist);
+ return previous_proc_->Resolve(host, address_family, addrlist);
// Final fallback is the system resolver.
- return SystemHostResolverProc(host, address_family,
- host_resolver_flags, addrlist);
+ return SystemHostResolverProc(host, address_family, addrlist);
}
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
@@ -156,7 +152,6 @@ ThreadLocalStorage::Slot DnsReloadTimer::tls_index_(base::LINKER_INITIALIZED);
int SystemHostResolverProc(const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist) {
// The result of |getaddrinfo| for empty hosts is inconsistent across systems.
// On Windows it gives the default interface's address, whereas on Linux it
@@ -210,9 +205,6 @@ int SystemHostResolverProc(const std::string& host,
hints.ai_flags = AI_ADDRCONFIG;
#endif
- if (host_resolver_flags & HOST_RESOLVER_FLAGS_CANONNAME)
- hints.ai_flags |= AI_CANONNAME;
-
// Restrict result set to only this socket type to avoid duplicates.
hints.ai_socktype = SOCK_STREAM;
diff --git a/net/base/host_resolver_proc.h b/net/base/host_resolver_proc.h
index 6f32280..ca0c55d 100644
--- a/net/base/host_resolver_proc.h
+++ b/net/base/host_resolver_proc.h
@@ -30,7 +30,6 @@ class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> {
// a list of socket addresses. Otherwise returns a network error code.
virtual int Resolve(const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist) = 0;
protected:
@@ -41,7 +40,6 @@ class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> {
// Asks the fallback procedure (if set) to do the resolve.
int ResolveUsingPrevious(const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist);
private:
@@ -80,7 +78,6 @@ class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> {
// network error code.
int SystemHostResolverProc(const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist);
} // namespace net
diff --git a/net/base/mock_host_resolver.cc b/net/base/mock_host_resolver.cc
index d99b24e..7f2512f 100644
--- a/net/base/mock_host_resolver.cc
+++ b/net/base/mock_host_resolver.cc
@@ -149,11 +149,8 @@ void RuleBasedHostResolverProc::AddRuleForAddressFamily(
void RuleBasedHostResolverProc::AddIPv6Rule(const std::string& host_pattern,
const std::string& ipv6_literal) {
- Rule rule(Rule::kResolverTypeIPV6Literal,
- host_pattern,
- ADDRESS_FAMILY_UNSPECIFIED,
- ipv6_literal,
- 0);
+ Rule rule(Rule::kResolverTypeIPV6Literal, host_pattern,
+ ADDRESS_FAMILY_UNSPECIFIED, ipv6_literal, 0);
rules_.push_back(rule);
}
@@ -183,7 +180,6 @@ void RuleBasedHostResolverProc::AddSimulatedFailure(
int RuleBasedHostResolverProc::Resolve(const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist) {
RuleList::iterator r;
for (r = rules_.begin(); r != rules_.end(); ++r) {
@@ -206,7 +202,6 @@ int RuleBasedHostResolverProc::Resolve(const std::string& host,
case Rule::kResolverTypeSystem:
return SystemHostResolverProc(effective_host,
address_family,
- host_resolver_flags,
addrlist);
case Rule::kResolverTypeIPV6Literal:
return ResolveIPV6LiteralUsingGURL(effective_host, addrlist);
@@ -216,8 +211,7 @@ int RuleBasedHostResolverProc::Resolve(const std::string& host,
}
}
}
- return ResolveUsingPrevious(host, address_family,
- host_resolver_flags, addrlist);
+ return ResolveUsingPrevious(host, address_family, addrlist);
}
//-----------------------------------------------------------------------------
diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h
index 5a1df7f..d08dc42 100644
--- a/net/base/mock_host_resolver.h
+++ b/net/base/mock_host_resolver.h
@@ -128,7 +128,6 @@ class RuleBasedHostResolverProc : public HostResolverProc {
// HostResolverProc methods:
virtual int Resolve(const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist);
private:
@@ -153,11 +152,9 @@ class WaitingHostResolverProc : public HostResolverProc {
// HostResolverProc methods:
virtual int Resolve(const std::string& host,
AddressFamily address_family,
- HostResolverFlags host_resolver_flags,
AddressList* addrlist) {
event_.Wait();
- return ResolveUsingPrevious(host, address_family, host_resolver_flags,
- addrlist);
+ return ResolveUsingPrevious(host, address_family, addrlist);
}
private: