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

Side by Side Diff: net/test/spawned_test_server/base_test_server.cc

Issue 1177933002: Resolve RFC 6761 localhost names to loopback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rsleevi nit Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « net/dns/host_resolver_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/test/spawned_test_server/base_test_server.h" 5 #include "net/test/spawned_test_server/base_test_server.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 NOTREACHED(); 229 NOTREACHED();
230 } 230 }
231 return std::string(); 231 return std::string();
232 } 232 }
233 233
234 bool BaseTestServer::GetAddressList(AddressList* address_list) const { 234 bool BaseTestServer::GetAddressList(AddressList* address_list) const {
235 DCHECK(address_list); 235 DCHECK(address_list);
236 236
237 scoped_ptr<HostResolver> resolver(HostResolver::CreateDefaultResolver(NULL)); 237 scoped_ptr<HostResolver> resolver(HostResolver::CreateDefaultResolver(NULL));
238 HostResolver::RequestInfo info(host_port_pair_); 238 HostResolver::RequestInfo info(host_port_pair_);
239 // Limit the lookup to IPv4. When started with the default
240 // address of kLocalhost, testserver.py only supports IPv4.
241 // If a custom hostname is used, it's possible that the test
242 // server will listen on both IPv4 and IPv6, so this will
243 // still work. The testserver does not support explicit
244 // IPv6 literal hostnames.
245 info.set_address_family(ADDRESS_FAMILY_IPV4);
239 TestCompletionCallback callback; 246 TestCompletionCallback callback;
240 int rv = resolver->Resolve(info, 247 int rv = resolver->Resolve(info,
241 DEFAULT_PRIORITY, 248 DEFAULT_PRIORITY,
242 address_list, 249 address_list,
243 callback.callback(), 250 callback.callback(),
244 NULL, 251 NULL,
245 BoundNetLog()); 252 BoundNetLog());
246 if (rv == ERR_IO_PENDING) 253 if (rv == ERR_IO_PENDING)
247 rv = callback.WaitForResult(); 254 rv = callback.WaitForResult();
248 if (rv != OK) { 255 if (rv != OK) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 514
508 return GenerateAdditionalArguments(arguments); 515 return GenerateAdditionalArguments(arguments);
509 } 516 }
510 517
511 bool BaseTestServer::GenerateAdditionalArguments( 518 bool BaseTestServer::GenerateAdditionalArguments(
512 base::DictionaryValue* arguments) const { 519 base::DictionaryValue* arguments) const {
513 return true; 520 return true;
514 } 521 }
515 522
516 } // namespace net 523 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/host_resolver_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698