Index: net/base/host_resolver_impl.cc |
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc |
index 2118cb47f517c1ffa52209c87ccc04c559e282b4..4b4649d712de562230f9f6513fc521275c5be1d4 100644 |
--- a/net/base/host_resolver_impl.cc |
+++ b/net/base/host_resolver_impl.cc |
@@ -875,26 +875,33 @@ int HostResolverImpl::Resolve(const RequestInfo& info, |
// Update the net log and notify registered observers. |
OnStartRequest(source_net_log, request_net_log, request_id, info); |
+ // Build a key that identifies the request in the cache and in the |
+ // outstanding jobs map. |
+ Key key = GetEffectiveKeyForRequest(info); |
+ |
// Check for IP literal. |
IPAddressNumber ip_number; |
if (ParseIPLiteralToNumber(info.hostname(), &ip_number)) { |
- DCHECK_EQ((info.host_resolver_flags() & |
- ~(HOST_RESOLVER_CANONNAME | HOST_RESOLVER_LOOPBACK_ONLY)), 0) |
- << " Unhandled flag"; |
- AddressList result(ip_number, info.port(), |
- (info.host_resolver_flags() & HOST_RESOLVER_CANONNAME)); |
- |
- *addresses = result; |
+ DCHECK_EQ(key.host_resolver_flags & |
+ ~(HOST_RESOLVER_CANONNAME | HOST_RESOLVER_LOOPBACK_ONLY | |
+ HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6), |
+ 0) << " Unhandled flag"; |
+ bool ipv6_disabled = default_address_family_ == ADDRESS_FAMILY_IPV4 && |
+ !ipv6_probe_monitoring_; |
+ int net_error = OK; |
+ if (ip_number.size() == 16 && ipv6_disabled) { |
+ net_error = ERR_NAME_NOT_RESOLVED; |
willchan no longer on Chromium
2010/09/03 19:36:50
This strikes me as a weird error to return, since
|
+ } else { |
+ AddressList result(ip_number, info.port(), |
+ (key.host_resolver_flags & HOST_RESOLVER_CANONNAME)); |
+ *addresses = result; |
+ } |
// Update the net log and notify registered observers. |
- OnFinishRequest(source_net_log, request_net_log, request_id, info, OK, |
- 0 /* os_error (unknown since from cache) */); |
- return OK; |
+ OnFinishRequest(source_net_log, request_net_log, request_id, info, |
+ net_error, 0 /* os_error (unknown since from cache) */); |
+ return net_error; |
} |
- // Build a key that identifies the request in the cache and in the |
- // outstanding jobs map. |
- Key key = GetEffectiveKeyForRequest(info); |
- |
// If we have an unexpired cache entry, use it. |
if (info.allow_cached_response() && cache_.get()) { |
const HostCache::Entry* cache_entry = cache_->Lookup( |
@@ -1285,11 +1292,16 @@ void HostResolverImpl::ProcessQueuedRequests() { |
HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest( |
const RequestInfo& info) const { |
+ HostResolverFlags effective_flags = |
+ info.host_resolver_flags() | additional_resolver_flags_; |
AddressFamily effective_address_family = info.address_family(); |
- if (effective_address_family == ADDRESS_FAMILY_UNSPECIFIED) |
+ if (effective_address_family == ADDRESS_FAMILY_UNSPECIFIED && |
+ default_address_family_ != ADDRESS_FAMILY_UNSPECIFIED) { |
effective_address_family = default_address_family_; |
- return Key(info.hostname(), effective_address_family, |
- info.host_resolver_flags() | additional_resolver_flags_); |
+ if (ipv6_probe_monitoring_) |
+ effective_flags |= HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6; |
+ } |
+ return Key(info.hostname(), effective_address_family, effective_flags); |
} |
HostResolverImpl::Job* HostResolverImpl::CreateAndStartJob(Request* req) { |