Index: net/ftp/ftp_network_transaction.cc |
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc |
index 272f49fbee8ed9316ffc916dd40b0318d2906f0a..c4b2181b9b1e5ad26613649a26e8b40cf8f88f57 100644 |
--- a/net/ftp/ftp_network_transaction.cc |
+++ b/net/ftp/ftp_network_transaction.cc |
@@ -682,6 +682,15 @@ int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { |
if (result == OK) { |
response_.socket_address = HostPortPair::FromIPEndPoint(ip_endpoint); |
next_state_ = STATE_CTRL_READ; |
+ |
+ if (ip_endpoint.GetFamily() == AF_INET) { |
+ // Do not use EPSV for IPv4 connections. Some servers become confused |
+ // and we time out while waiting to connect. PASV is perfectly fine for |
+ // IPv4. Note that this blacklists IPv4 not to use EPSV instead of |
+ // whitelisting IPv6 to use it, to make the code more future-proof: |
+ // all future protocols should just use EPSV. |
+ use_epsv_ = false; |
+ } |
} |
} |
return result; |