aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2010-11-04 21:44:02 +0100
committerKamil Dudka <kdudka@redhat.com>2010-11-08 20:50:52 +0100
commitc6b97a8278f3c2297a99bee877cc0a5bb13e5761 (patch)
treedf7b510d1bd970287e6ae7585cb6b4f68cc041eb /lib/ftp.c
parentf96a2641fce9665168aef19faefd55ee0ef81985 (diff)
ftp: close connection as soon as ABOR has been sent
... and do not send ABOR unless really necessary. Bug: https://bugzilla.redhat.com/649347 Reported by: Simon H.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 679f2334c..d79878e82 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3083,10 +3083,9 @@ 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(!result && ftpc->dont_check && data->req.maxdownload > 0)
+ /* partial download completed */
+ result = Curl_pp_sendf(pp, "ABOR");
if(conn->ssl[SECONDARYSOCKET].use) {
/* The secondary socket is using SSL so we must close down that part
@@ -3128,6 +3127,14 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
if(result)
return result;
+ if(ftpc->dont_check && data->req.maxdownload > 0) {
+ /* we have just sent ABOR and there is no reliable way to check if it was
+ * successful or not; we have to close the connection now */
+ infof(data, "partial download completed, closing connection\n");
+ conn->bits.close = TRUE; /* mark for closure */
+ return result;
+ }
+
if(!ftpc->dont_check) {
/* 226 Transfer complete, 250 Requested file action okay, completed. */
if((ftpcode != 226) && (ftpcode != 250)) {