aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2010-10-27 10:54:35 +0200
committerKamil Dudka <kdudka@redhat.com>2010-10-29 12:01:19 +0200
commit0c8e5f7e6ac13c43b8cbab8dcada56d3f27a2a89 (patch)
treedb7f789140e4443b2120ff5d1848b9ee8c8f546e /lib
parent59db31902c87dc321d8747eae49ac7f996afa204 (diff)
ftp: prevent server from hanging on closed data connection
Some FTP servers (e.g. Pure-ftpd) end up hanging if we close the data connection before transferring all the requested data. If we send ABOR in that case, it prevents the server from hanging. Bug: https://bugzilla.redhat.com/643656 Reported by: Pasi Karkkainen, Patrick Monnerat
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index b5a4fd5be..679f2334c 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3083,6 +3083,11 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
#endif
if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {
+ if(!result && ftpc->dont_check)
+ /* prevent some FTP servers (namely Pure-ftpd) from hanging if we close
+ * the data channel before transferring all data */
+ result = Curl_pp_sendf(&ftpc->pp, "ABOR");
+
if(conn->ssl[SECONDARYSOCKET].use) {
/* The secondary socket is using SSL so we must close down that part
first before we close the socket for real */
@@ -3097,7 +3102,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
}
}
- if((ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
+ if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
pp->pending_resp && !premature) {
/*
* Let's see what the server says about the transfer we just performed,