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

Unified Diff: net/base/mock_host_resolver.cc

Issue 3115014: Revert 56384 - Don't resolve IP literals.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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/host_resolver_impl_unittest.cc ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/mock_host_resolver.cc
===================================================================
--- net/base/mock_host_resolver.cc (revision 56384)
+++ net/base/mock_host_resolver.cc (working copy)
@@ -9,7 +9,6 @@
#include "base/ref_counted.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
-#include "net/base/sys_addrinfo.h"
namespace net {
@@ -28,10 +27,15 @@
return ERR_UNEXPECTED;
}
- AddressList result(ip_number, -1, false);
- struct addrinfo* ai = const_cast<struct addrinfo*>(result.head());
- ai->ai_canonname = strdup(canonical_name.c_str());
- *addrlist = result;
+ if (ip_number.size() == 4) {
+ *addrlist = AddressList::CreateIPv4Address(&ip_number[0], canonical_name);
+ } else if (ip_number.size() == 16) {
+ *addrlist = AddressList::CreateIPv6Address(&ip_number[0], canonical_name);
+ } else {
+ NOTREACHED();
+ return ERR_UNEXPECTED;
+ }
+
return OK;
}
@@ -157,10 +161,6 @@
const std::string& host_pattern,
const std::string& ip_literal,
const std::string& canonical_name) {
- // Literals are always resolved to themselves by HostResolverImpl,
- // consequently we do not support remapping them.
- IPAddressNumber ip_number;
- DCHECK(!ParseIPLiteralToNumber(host_pattern, &ip_number));
Rule rule(Rule::kResolverTypeIPLiteral,
host_pattern,
ADDRESS_FAMILY_UNSPECIFIED,
« no previous file with comments | « net/base/host_resolver_impl_unittest.cc ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698