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

Unified Diff: net/dns/mojo_host_resolver_impl.cc

Issue 2011293002: Fill in the current host name in the Mojo host resolver service when requesting our own IP address. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/mojo_host_resolver_impl.cc
diff --git a/net/dns/mojo_host_resolver_impl.cc b/net/dns/mojo_host_resolver_impl.cc
index bf49c99ff1bfe0c00979a3adcc42268e485a2f52..13f61d51dd4d60d727e90313e153fc35a890f9be 100644
--- a/net/dns/mojo_host_resolver_impl.cc
+++ b/net/dns/mojo_host_resolver_impl.cc
@@ -9,6 +9,7 @@
#include "base/stl_util.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
+#include "net/base/network_interfaces.h"
#include "net/dns/host_resolver.h"
#include "net/dns/mojo_host_type_converters.h"
@@ -59,9 +60,16 @@ void MojoHostResolverImpl::Resolve(
interfaces::HostResolverRequestInfoPtr request_info,
interfaces::HostResolverRequestClientPtr client) {
DCHECK(thread_checker_.CalledOnValidThread());
- Job* job = new Job(this, resolver_,
- request_info->To<net::HostResolver::RequestInfo>(),
- net_log_, std::move(client));
+ HostResolver::RequestInfo host_request_info =
+ request_info->To<net::HostResolver::RequestInfo>();
+ if (host_request_info.is_my_ip_address()) {
+ // The proxy resolver running inside a sandbox may not be able to get the
+ // correct host name. Instead, fill it ourself if the request is for our own
+ // IP address.
+ host_request_info.set_host_port_pair(HostPortPair(GetHostName(), 80));
+ }
+ Job* job = new Job(this, resolver_, host_request_info, net_log_,
+ std::move(client));
pending_jobs_.insert(job);
job->Start();
}
« 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