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

Unified Diff: net/proxy/proxy_resolver_v8.cc

Issue 38001: Implement the PAC js-binding for "myIpAddress()". (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: update unittest for DnsResolve based on new empty string Created 11 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 | « net/base/net_util_unittest.cc ('k') | net/proxy/proxy_resolver_v8_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_resolver_v8.cc
===================================================================
--- net/proxy/proxy_resolver_v8.cc (revision 10746)
+++ net/proxy/proxy_resolver_v8.cc (working copy)
@@ -60,13 +60,17 @@
// Handler for "myIpAddress()". Returns empty string on failure.
virtual std::string MyIpAddress() {
- // TODO(eroman):
- NOTIMPLEMENTED();
- return "127.0.0.1";
+ // DnsResolve("") returns "", so no need to check for failure.
+ return DnsResolve(GetMyHostName());
}
// Handler for "dnsResolve(host)". Returns empty string on failure.
virtual std::string DnsResolve(const std::string& host) {
+ // TODO(eroman): Should this return our IP address, or fail, or
+ // simply be unspecified (works differently on windows and mac os x).
+ if (host.empty())
+ return std::string();
+
// Try to resolve synchronously.
net::AddressList address_list;
const int kPort = 80; // Doesn't matter what this is.
@@ -236,6 +240,8 @@
// We shouldn't be called with any arguments, but will not complain if
// we are.
std::string result = context->js_bindings_->MyIpAddress();
+ if (result.empty())
+ result = "127.0.0.1";
return StdStringToV8String(result);
}
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | net/proxy/proxy_resolver_v8_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698