aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-08-14 20:36:03 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-08-14 22:30:24 +0200
commitf584312e81e2636d6452b69628ff2c3cd4f17f90 (patch)
treeef95afc5621744adb36fd5d6c13894d64789c23e /lib
parent0b4557f7666d6bd3d14a30901239233e5c175ff7 (diff)
ftp_domore_getsock: when passive mode, the second conn is already there
This makes the socket callback get called with the proper bitmask as otherwise the application could be left hanging waiting for reading on an upload connection! Bug: http://curl.haxx.se/mail/lib-2013-08/0043.html Reported-by: Bill Doyle
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 20138fc02..c4c974e9b 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -877,11 +877,13 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
remote site, or we could wait for that site to connect to us. Or just
handle ordinary commands.
- When waiting for a connect, we can be in FTP_STOP state (or we're in
- FTP_STOR when we do an upload) and then we wait for the secondary socket
- to become writeable. . If we're in another state, we're still handling
- commands on the control (primary) connection.
+ When waiting for a connect (in PORT mode), we can be in FTP_STOP state
+ (or we're in FTP_STOR when we do an upload) and then we wait for the
+ secondary socket to become writeable. If we're in STOR or STOP in passive
+ mode, we already have the seconnd connection done.
+ If we're in another state, we're still handling commands on the control
+ (primary) connection.
*/
switch(ftpc->state) {
@@ -893,7 +895,7 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
}
socks[0] = conn->sock[SECONDARYSOCKET];
- if(ftpc->wait_data_conn) {
+ if(ftpc->wait_data_conn || !conn->data->set.ftp_use_port) {
socks[1] = conn->sock[FIRSTSOCKET];
return GETSOCK_READSOCK(0) | GETSOCK_READSOCK(1);
}