diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 19:12:57 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 19:12:57 +0000 |
commit | 123ab1e334b44051297c8d4242e81044478c6588 (patch) | |
tree | 7ba32a449e6715f5f4bace667b161b129745b78d /net/url_request | |
parent | 57d1ec8fc4b72112bd4d32df76c55395bf33681a (diff) | |
download | chromium_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/url_request')
-rw-r--r-- | net/url_request/url_request_view_net_internals_job.cc | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/net/url_request/url_request_view_net_internals_job.cc b/net/url_request/url_request_view_net_internals_job.cc index 56aa8a8..5cadc075 100644 --- a/net/url_request/url_request_view_net_internals_job.cc +++ b/net/url_request/url_request_view_net_internals_job.cc @@ -225,6 +225,7 @@ class HostResolverCacheSubSection : public SubSection { out->append("<table border=1>" "<tr>" "<th>Host</th>" + "<th>Address family</th>" "<th>Address list</th>" "<th>Time to live (ms)</th>" "</tr>"); @@ -233,9 +234,12 @@ class HostResolverCacheSubSection : public SubSection { host_cache->entries().begin(); it != host_cache->entries().end(); ++it) { - const std::string& host = it->first; + const net::HostCache::Key& key = it->first; const net::HostCache::Entry* entry = it->second.get(); + std::string address_family_str = + AddressFamilyToString(key.address_family); + if (entry->error == net::OK) { // Note that ttl_ms may be negative, for the cases where entries have // expired but not been garbage collected yet. @@ -261,23 +265,35 @@ class HostResolverCacheSubSection : public SubSection { current_address = current_address->ai_next; } - out->append(StringPrintf("<td>%s</td><td>%s</td><td>%d</td></tr>", - EscapeForHTML(host).c_str(), + out->append(StringPrintf("<td>%s</td><td>%s</td><td>%s</td>" + "<td>%d</td></tr>", + EscapeForHTML(key.hostname).c_str(), + EscapeForHTML(address_family_str).c_str(), address_list_html.c_str(), ttl_ms)); } else { // This was an entry that failed to be resolved. // Color negative entries red. out->append(StringPrintf( - "<tr style='color:red'><td>%s</td>" + "<tr style='color:red'><td>%s</td><td>%s</td>" "<td colspan=2>%s</td></tr>", - EscapeForHTML(host).c_str(), + EscapeForHTML(key.hostname).c_str(), + EscapeForHTML(address_family_str).c_str(), EscapeForHTML(net::ErrorToString(entry->error)).c_str())); } } out->append("</table>"); } + + static std::string AddressFamilyToString(net::AddressFamily address_family) { + switch (address_family) { + case net::ADDRESS_FAMILY_IPV4_ONLY: + return "IPV4_ONLY"; + default: + return "UNSPECIFIED"; + } + } }; class HostResolverSubSection : public SubSection { |