diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-01-16 22:22:10 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-01-16 22:22:10 +0000 |
commit | 385e612fa5b7663fc2bc815677b8c27bec2f0fe4 (patch) | |
tree | bc211e48b4e8c57bb90090ab78c885ecab0a5496 /lib/ftp.c | |
parent | 1886388791fc658b55cdd45b3062556fde7a1375 (diff) | |
download | curl-385e612fa5b7663fc2bc815677b8c27bec2f0fe4.tar.gz |
- Armel Asselin improved libcurl to behave a lot better when an easy handle
doing an FTP transfer is removed from a multi handle before completion. The
fix also fixed the "alive counter" to be correct on "premature removal" for
all protocols.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r-- | lib/ftp.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -2964,7 +2964,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn, * * Input argument is already checked for validity. */ -CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) +CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature) { struct SessionHandle *data = conn->data; struct FTP *ftp = data->reqdata.proto.ftp; @@ -2998,8 +2998,12 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) /* the connection stays alive fine even though this happened */ /* fall-through */ case CURLE_OK: /* doesn't affect the control connection's status */ - ftpc->ctl_valid = was_ctl_valid; - break; + if (!premature) { + ftpc->ctl_valid = was_ctl_valid; + break; + } + /* until we cope better with prematurely ended requests, let them + * fallback as if in complete failure */ default: /* by default, an error means the control connection is wedged and should not be used anymore */ ftpc->ctl_valid = FALSE; @@ -3048,7 +3052,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; - if(!ftp->no_transfer && !status) { + if(!ftp->no_transfer && !status && !premature) { /* * Let's see what the server says about the transfer we just performed, * but lower the timeout as sometimes this connection has died while the @@ -3081,7 +3085,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) } } - if(result) + if(result || premature) /* the response code from the transfer showed an error already so no use checking further */ ; @@ -3123,7 +3127,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) ftpc->dont_check = FALSE; /* Send any post-transfer QUOTE strings? */ - if(!status && !result && data->set.postquote) + if(!status && !result && !premature && data->set.postquote) result = ftp_sendquote(conn, data->set.postquote); return result; |