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/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 10 matching lines...) Expand all Loading... | |
| 21 #include "base/strings/string_piece.h" | 21 #include "base/strings/string_piece.h" |
| 22 #include "base/threading/non_thread_safe.h" | 22 #include "base/threading/non_thread_safe.h" |
| 23 #include "base/timer/timer.h" | 23 #include "base/timer/timer.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "net/base/completion_callback.h" | 25 #include "net/base/completion_callback.h" |
| 26 #include "net/base/dns_util.h" | 26 #include "net/base/dns_util.h" |
| 27 #include "net/base/io_buffer.h" | 27 #include "net/base/io_buffer.h" |
| 28 #include "net/base/ip_endpoint.h" | 28 #include "net/base/ip_endpoint.h" |
| 29 #include "net/base/net_errors.h" | 29 #include "net/base/net_errors.h" |
| 30 #include "net/base/net_log.h" | 30 #include "net/base/net_log.h" |
| 31 #include "net/base/net_util.h" | |
| 31 #include "net/dns/dns_protocol.h" | 32 #include "net/dns/dns_protocol.h" |
| 32 #include "net/dns/dns_query.h" | 33 #include "net/dns/dns_query.h" |
| 33 #include "net/dns/dns_response.h" | 34 #include "net/dns/dns_response.h" |
| 34 #include "net/dns/dns_session.h" | 35 #include "net/dns/dns_session.h" |
| 35 #include "net/socket/stream_socket.h" | 36 #include "net/socket/stream_socket.h" |
| 36 #include "net/udp/datagram_client_socket.h" | 37 #include "net/udp/datagram_client_socket.h" |
| 37 | 38 |
| 38 namespace net { | 39 namespace net { |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 callback_(callback), | 557 callback_(callback), |
| 557 net_log_(net_log), | 558 net_log_(net_log), |
| 558 qnames_initial_size_(0), | 559 qnames_initial_size_(0), |
| 559 attempts_count_(0), | 560 attempts_count_(0), |
| 560 had_tcp_attempt_(false), | 561 had_tcp_attempt_(false), |
| 561 first_server_index_(0) { | 562 first_server_index_(0) { |
| 562 DCHECK(session_.get()); | 563 DCHECK(session_.get()); |
| 563 DCHECK(!hostname_.empty()); | 564 DCHECK(!hostname_.empty()); |
| 564 DCHECK(!callback_.is_null()); | 565 DCHECK(!callback_.is_null()); |
| 565 DCHECK(!IsIPLiteral(hostname_)); | 566 DCHECK(!IsIPLiteral(hostname_)); |
| 567 | |
| 568 // Redirect .localhost queries to localhost to make sure that they are | |
| 569 // never sent out on the network, per RFC 6761. | |
| 570 if (IsLocalhostTLD(hostname)) | |
| 571 hostname_ = "localhost"; | |
|
Ryan Sleevi
2015/02/19 22:24:56
No clue if this is correct; This seems wrong/weird
estark
2015/02/20 01:55:19
Ah, I see what you mean. I changed it to use local
| |
| 566 } | 572 } |
| 567 | 573 |
| 568 ~DnsTransactionImpl() override { | 574 ~DnsTransactionImpl() override { |
| 569 if (!callback_.is_null()) { | 575 if (!callback_.is_null()) { |
| 570 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION, | 576 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION, |
| 571 ERR_ABORTED); | 577 ERR_ABORTED); |
| 572 } // otherwise logged in DoCallback or Start | 578 } // otherwise logged in DoCallback or Start |
| 573 } | 579 } |
| 574 | 580 |
| 575 const std::string& GetHostname() const override { | 581 const std::string& GetHostname() const override { |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 982 } // namespace | 988 } // namespace |
| 983 | 989 |
| 984 // static | 990 // static |
| 985 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( | 991 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( |
| 986 DnsSession* session) { | 992 DnsSession* session) { |
| 987 return scoped_ptr<DnsTransactionFactory>( | 993 return scoped_ptr<DnsTransactionFactory>( |
| 988 new DnsTransactionFactoryImpl(session)); | 994 new DnsTransactionFactoryImpl(session)); |
| 989 } | 995 } |
| 990 | 996 |
| 991 } // namespace net | 997 } // namespace net |
| OLD | NEW |