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/ftp/ftp_network_transaction.h" | 5 #include "net/ftp/ftp_network_transaction.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 } | 675 } |
676 | 676 |
677 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { | 677 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { |
678 if (result == OK) { | 678 if (result == OK) { |
679 // Put the peer's IP address and port into the response. | 679 // Put the peer's IP address and port into the response. |
680 IPEndPoint ip_endpoint; | 680 IPEndPoint ip_endpoint; |
681 result = ctrl_socket_->GetPeerAddress(&ip_endpoint); | 681 result = ctrl_socket_->GetPeerAddress(&ip_endpoint); |
682 if (result == OK) { | 682 if (result == OK) { |
683 response_.socket_address = HostPortPair::FromIPEndPoint(ip_endpoint); | 683 response_.socket_address = HostPortPair::FromIPEndPoint(ip_endpoint); |
684 next_state_ = STATE_CTRL_READ; | 684 next_state_ = STATE_CTRL_READ; |
| 685 |
| 686 if (ip_endpoint.GetFamily() == AF_INET) { |
| 687 // Do not use EPSV for IPv4 connections. Some servers become confused |
| 688 // and we time out while waiting to connect. PASV is perfectly fine for |
| 689 // IPv4. Note that this blacklists IPv4 not to use EPSV instead of |
| 690 // whitelisting IPv6 to use it, to make the code more future-proof: |
| 691 // all future protocols should just use EPSV. |
| 692 use_epsv_ = false; |
| 693 } |
685 } | 694 } |
686 } | 695 } |
687 return result; | 696 return result; |
688 } | 697 } |
689 | 698 |
690 int FtpNetworkTransaction::DoCtrlRead() { | 699 int FtpNetworkTransaction::DoCtrlRead() { |
691 next_state_ = STATE_CTRL_READ_COMPLETE; | 700 next_state_ = STATE_CTRL_READ_COMPLETE; |
692 return ctrl_socket_->Read(read_ctrl_buf_, kCtrlBufLen, io_callback_); | 701 return ctrl_socket_->Read(read_ctrl_buf_, kCtrlBufLen, io_callback_); |
693 } | 702 } |
694 | 703 |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 if (!had_error_type[type]) { | 1387 if (!had_error_type[type]) { |
1379 had_error_type[type] = true; | 1388 had_error_type[type] = true; |
1380 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1389 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
1381 type, NUM_OF_NET_ERROR_TYPES); | 1390 type, NUM_OF_NET_ERROR_TYPES); |
1382 } | 1391 } |
1383 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1392 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
1384 type, NUM_OF_NET_ERROR_TYPES); | 1393 type, NUM_OF_NET_ERROR_TYPES); |
1385 } | 1394 } |
1386 | 1395 |
1387 } // namespace net | 1396 } // namespace net |
OLD | NEW |