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/dns_response.h" | 5 #include "net/dns/dns_response.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/sys_byteorder.h" | 8 #include "base/sys_byteorder.h" |
9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
10 #include "net/base/big_endian.h" | 10 #include "net/base/big_endian.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } else { | 273 } else { |
274 if (addr_ttl_sec != record.ttl) | 274 if (addr_ttl_sec != record.ttl) |
275 return DNS_ADDRESS_TTL_MISMATCH; | 275 return DNS_ADDRESS_TTL_MISMATCH; |
276 } | 276 } |
277 ip_addresses.push_back(IPAddressNumber(record.rdata.begin(), | 277 ip_addresses.push_back(IPAddressNumber(record.rdata.begin(), |
278 record.rdata.end())); | 278 record.rdata.end())); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 // TODO(szym): Extract TTL for NODATA results. http://crbug.com/115051 | 282 // TODO(szym): Extract TTL for NODATA results. http://crbug.com/115051 |
283 if (ip_addresses.empty()) | |
284 return DNS_NO_ADDRESSES; | |
285 | 283 |
286 // getcanonname in eglibc returns the first owner name of an A or AAAA RR. | 284 // getcanonname in eglibc returns the first owner name of an A or AAAA RR. |
287 // If the response passed all the checks so far, then |expected_name| is it. | 285 // If the response passed all the checks so far, then |expected_name| is it. |
288 *addr_list = AddressList::CreateFromIPAddressList(ip_addresses, | 286 *addr_list = AddressList::CreateFromIPAddressList(ip_addresses, |
289 expected_name); | 287 expected_name); |
290 *ttl = base::TimeDelta::FromSeconds(std::min(cname_ttl_sec, addr_ttl_sec)); | 288 *ttl = base::TimeDelta::FromSeconds(std::min(cname_ttl_sec, addr_ttl_sec)); |
291 return DNS_SUCCESS; | 289 return DNS_PARSE_OK; |
292 } | 290 } |
293 | 291 |
294 } // namespace net | 292 } // namespace net |
OLD | NEW |