Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dns/host_resolver_proc.h" | 5 #include "net/dns/host_resolver_proc.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
| 11 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
| 12 #include "net/base/dns_reloader.h" | 12 #include "net/base/dns_reloader.h" |
| 13 #include "net/base/dns_util.h" | |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/base/sys_addrinfo.h" | 15 #include "net/base/sys_addrinfo.h" |
| 15 | 16 |
| 16 #if defined(OS_OPENBSD) | 17 #if defined(OS_OPENBSD) |
| 17 #define AI_ADDRCONFIG 0 | 18 #define AI_ADDRCONFIG 0 |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 // static | 118 // static |
| 118 HostResolverProc* HostResolverProc::GetDefault() { | 119 HostResolverProc* HostResolverProc::GetDefault() { |
| 119 return default_proc_; | 120 return default_proc_; |
| 120 } | 121 } |
| 121 | 122 |
| 122 int SystemHostResolverCall(const std::string& host, | 123 int SystemHostResolverCall(const std::string& host, |
| 123 AddressFamily address_family, | 124 AddressFamily address_family, |
| 124 HostResolverFlags host_resolver_flags, | 125 HostResolverFlags host_resolver_flags, |
| 125 AddressList* addrlist, | 126 AddressList* addrlist, |
| 126 int* os_error) { | 127 int* os_error) { |
| 128 // Make sure |host| is properly formed. | |
| 129 { | |
| 130 std::string out_ignored; | |
| 131 if (!DNSDomainFromDot(host, &out_ignored)) | |
| 132 return ERR_NAME_NOT_RESOLVED; | |
| 133 } | |
|
Ryan Sleevi
2015/03/06 22:11:36
Don't use { } here.
| |
| 134 | |
| 127 if (os_error) | 135 if (os_error) |
| 128 *os_error = 0; | 136 *os_error = 0; |
| 129 | 137 |
| 130 struct addrinfo* ai = NULL; | 138 struct addrinfo* ai = NULL; |
| 131 struct addrinfo hints = {0}; | 139 struct addrinfo hints = {0}; |
| 132 | 140 |
| 133 switch (address_family) { | 141 switch (address_family) { |
| 134 case ADDRESS_FAMILY_IPV4: | 142 case ADDRESS_FAMILY_IPV4: |
| 135 hints.ai_family = AF_INET; | 143 hints.ai_family = AF_INET; |
| 136 break; | 144 break; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 return SystemHostResolverCall(hostname, | 266 return SystemHostResolverCall(hostname, |
| 259 address_family, | 267 address_family, |
| 260 host_resolver_flags, | 268 host_resolver_flags, |
| 261 addr_list, | 269 addr_list, |
| 262 os_error); | 270 os_error); |
| 263 } | 271 } |
| 264 | 272 |
| 265 SystemHostResolverProc::~SystemHostResolverProc() {} | 273 SystemHostResolverProc::~SystemHostResolverProc() {} |
| 266 | 274 |
| 267 } // namespace net | 275 } // namespace net |
| OLD | NEW |