Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: net/dns/host_resolver_impl.cc

Issue 926593003: Skip IPv6 probes when resolving IPv4 literals. The probes aren't (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size array Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_impl.cc
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index 98e410551e9c3599de5d64b2a7a8ca6fc01267d1..6c0a154971a4fe2a4386051bef361ac7188046fc 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -49,6 +49,7 @@
#include "net/dns/host_resolver_proc.h"
#include "net/socket/client_socket_factory.h"
#include "net/udp/datagram_client_socket.h"
+#include "url/url_canon_ip.h"
#if defined(OS_WIN)
#include "net/base/winsock_init.h"
@@ -2154,7 +2155,13 @@ HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
AddressFamily effective_address_family = info.address_family();
if (info.address_family() == ADDRESS_FAMILY_UNSPECIFIED) {
- if (probe_ipv6_support_ && !use_local_ipv6_) {
+ unsigned char ip_number[4];
+ url::Component host_comp(0, info.hostname().size());
+ int num_components;
+ if (probe_ipv6_support_ && !use_local_ipv6_ &&
+ // Don't bother IPv6 probing when resolving IPv4 literals.
+ url::IPv4AddressToNumber(info.hostname().c_str(), host_comp, ip_number,
+ &num_components) != url::CanonHostInfo::IPV4) {
// Google DNS address.
const uint8 kIPv6Address[] =
{ 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698