| 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_transaction.h" | 5 #include "net/dns/dns_transaction.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 base::Bind(&DnsUDPAttempt::OnIOComplete, | 204 base::Bind(&DnsUDPAttempt::OnIOComplete, |
| 205 base::Unretained(this))); | 205 base::Unretained(this))); |
| 206 } | 206 } |
| 207 | 207 |
| 208 int DoReadResponseComplete(int rv) { | 208 int DoReadResponseComplete(int rv) { |
| 209 DCHECK_NE(ERR_IO_PENDING, rv); | 209 DCHECK_NE(ERR_IO_PENDING, rv); |
| 210 if (rv < 0) | 210 if (rv < 0) |
| 211 return rv; | 211 return rv; |
| 212 | 212 |
| 213 DCHECK(rv); | 213 DCHECK(rv); |
| 214 // TODO(szym): Consider making this check less aggressive. |
| 215 // Other implementations simply ignore mismatched responses. |
| 214 if (!response_->InitParse(rv, *query_)) | 216 if (!response_->InitParse(rv, *query_)) |
| 215 return ERR_DNS_MALFORMED_RESPONSE; | 217 return ERR_DNS_MALFORMED_RESPONSE; |
| 216 if (response_->flags() & dns_protocol::kFlagTC) | 218 if (response_->flags() & dns_protocol::kFlagTC) |
| 217 return ERR_DNS_SERVER_REQUIRES_TCP; | 219 return ERR_DNS_SERVER_REQUIRES_TCP; |
| 218 if (response_->rcode() != dns_protocol::kRcodeNOERROR && | 220 if (response_->rcode() != dns_protocol::kRcodeNOERROR && |
| 219 response_->rcode() != dns_protocol::kRcodeNXDOMAIN) { | 221 response_->rcode() != dns_protocol::kRcodeNXDOMAIN) { |
| 220 return ERR_DNS_SERVER_FAILED; | 222 return ERR_DNS_SERVER_FAILED; |
| 221 } | 223 } |
| 222 if (response_->answer_count() == 0) | 224 if (response_->answer_count() == 0) |
| 223 return ERR_NAME_NOT_RESOLVED; | 225 return ERR_NAME_NOT_RESOLVED; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 530 |
| 529 // static | 531 // static |
| 530 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( | 532 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( |
| 531 DnsSession* session) { | 533 DnsSession* session) { |
| 532 return scoped_ptr<DnsTransactionFactory>( | 534 return scoped_ptr<DnsTransactionFactory>( |
| 533 new DnsTransactionFactoryImpl(session)); | 535 new DnsTransactionFactoryImpl(session)); |
| 534 } | 536 } |
| 535 | 537 |
| 536 } // namespace net | 538 } // namespace net |
| 537 | 539 |
| OLD | NEW |