summaryrefslogtreecommitdiffstats
path: root/net/base/host_resolver_impl.h
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-21 19:12:57 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-21 19:12:57 +0000
commit123ab1e334b44051297c8d4242e81044478c6588 (patch)
tree7ba32a449e6715f5f4bace667b161b129745b78d /net/base/host_resolver_impl.h
parent57d1ec8fc4b72112bd4d32df76c55395bf33681a (diff)
downloadchromium_src-123ab1e334b44051297c8d4242e81044478c6588.zip
chromium_src-123ab1e334b44051297c8d4242e81044478c6588.tar.gz
chromium_src-123ab1e334b44051297c8d4242e81044478c6588.tar.bz2
Add a mechanism to disable IPv6.
(1) Adds the ability to specify the address family on a per-request basis. (2) Exposes a --disable-ipv6 flag to chrome that changes the default address family from AF_UNSPEC to AF_INET (same sort of thing Firefox does). (3) Changes the backing datastructure for HostCache:EntryMap and HostResolverImpl::JobMap from a "hash_map" to a "std::map". This was for consistency with other code (when I went to add a custom hash trait, I couldn't find any existing code which was using hashmap for custom keys). (4) Updates about:net-internals to display an address family for the hostcache dump (since it is now a part of the key). This change is in anticipation of turning off IPv6 host resolving in the PAC utility functions (see bug 24641). But it is also a feature addition. BUG=24641 TEST=HostCacheTest.AddressFamilyIsPartOfKey Review URL: http://codereview.chromium.org/302010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_impl.h')
-rw-r--r--net/base/host_resolver_impl.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index 74dea08..b641b0b 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -27,7 +27,7 @@ namespace net {
// +----------- HostResolverImpl -------------+
// | | |
// Job Job Job
-// (for host1) (for host2) (for hostX)
+// (for host1, fam1) (for host2, fam2) (for hostx, famx)
// / | | / | | / | |
// Request ... Request Request ... Request Request ... Request
// (port1) (port2) (port3) (port4) (port5) (portX)
@@ -70,11 +70,18 @@ class HostResolverImpl : public HostResolver {
// TODO(eroman): temp hack for http://crbug.com/15513
virtual void Shutdown();
+ // Prevents returning IPv6 addresses from Resolve().
+ // The default is to allow IPv6 results.
+ virtual void DisableIPv6(bool disable_ipv6) {
+ disable_ipv6_ = disable_ipv6;
+ }
+
private:
class Job;
class Request;
typedef std::vector<Request*> RequestsList;
- typedef base::hash_map<std::string, scoped_refptr<Job> > JobMap;
+ typedef HostCache::Key Key;
+ typedef std::map<Key, scoped_refptr<Job> > JobMap;
typedef std::vector<Observer*> ObserversList;
// Returns the HostResolverProc to use for this instance.
@@ -86,8 +93,8 @@ class HostResolverImpl : public HostResolver {
// Adds a job to outstanding jobs list.
void AddOutstandingJob(Job* job);
- // Returns the outstanding job for |hostname|, or NULL if there is none.
- Job* FindOutstandingJob(const std::string& hostname);
+ // Returns the outstanding job for |key|, or NULL if there is none.
+ Job* FindOutstandingJob(const Key& key);
// Removes |job| from the outstanding jobs list.
void RemoveOutstandingJob(Job* job);
@@ -132,6 +139,9 @@ class HostResolverImpl : public HostResolver {
// in the case of unit-tests which inject custom host resolving behaviors.
scoped_refptr<HostResolverProc> resolver_proc_;
+ // Set to true if only IPv4 address are to be returned by Resolve().
+ bool disable_ipv6_;
+
// TODO(eroman): temp hack for http://crbug.com/15513
bool shutdown_;