OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/base/host_resolver_proc.h" | 5 #include "net/base/host_resolver_proc.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 9 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
10 #include <resolv.h> | 10 #include <resolv.h> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 #endif | 221 #endif |
222 | 222 |
223 if (err) | 223 if (err) |
224 return ERR_NAME_NOT_RESOLVED; | 224 return ERR_NAME_NOT_RESOLVED; |
225 | 225 |
226 addrlist->Adopt(ai); | 226 addrlist->Adopt(ai); |
227 return OK; | 227 return OK; |
228 } | 228 } |
229 | 229 |
| 230 // TODO(jar): The following is a simple estimate of ipv6 support. We may need |
| 231 // to do a test resolution, and a test connection, to REALLY verify support. |
| 232 // static |
| 233 bool HostResolverProc::IPv6Supported() { |
| 234 #if defined(OS_POSIX) |
| 235 int test_socket; |
| 236 #else |
| 237 SOCKET test_socket; |
| 238 #endif |
| 239 |
| 240 test_socket = socket(AF_INET6, SOCK_STREAM, 0); |
| 241 if (test_socket == -1) |
| 242 return false; |
| 243 |
| 244 #if defined(OS_POSIX) |
| 245 close(test_socket); |
| 246 #else |
| 247 closesocket(test_socket); |
| 248 #endif |
| 249 |
| 250 return true; |
| 251 } |
| 252 |
230 } // namespace net | 253 } // namespace net |
OLD | NEW |