Loading lib/ftp.c +25 −8 Original line number Diff line number Diff line Loading @@ -738,13 +738,14 @@ CURLcode Curl_ftp_connect(struct connectdata *conn) * * Input argument is already checked for validity. */ CURLcode Curl_ftp_done(struct connectdata *conn) CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) { struct SessionHandle *data = conn->data; struct FTP *ftp = conn->proto.ftp; ssize_t nread; int ftpcode; CURLcode result=CURLE_OK; bool was_ctl_valid = ftp->ctl_valid; /* free the dir tree and file parts */ Loading Loading @@ -785,7 +786,23 @@ CURLcode Curl_ftp_done(struct connectdata *conn) } } switch(status) { case CURLE_BAD_DOWNLOAD_RESUME: case CURLE_FTP_WEIRD_PASV_REPLY: case CURLE_FTP_PORT_FAILED: case CURLE_FTP_COULDNT_SET_BINARY: case CURLE_FTP_COULDNT_RETR_FILE: case CURLE_FTP_ACCESS_DENIED: /* the connection stays alive fine even though this happened */ /* fall-through */ case CURLE_OK: /* doesn't affect the control connection's status */ ftp->ctl_valid = was_ctl_valid; break; default: /* by default, an error means the control connection is wedged and should not be used anymore */ ftp->ctl_valid = FALSE; break; } #ifdef HAVE_KRB4 Curl_sec_fflush_fd(conn, conn->sock[SECONDARYSOCKET]); Loading @@ -794,11 +811,11 @@ CURLcode Curl_ftp_done(struct connectdata *conn) sclose(conn->sock[SECONDARYSOCKET]); conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; if(!ftp->no_transfer) { if(!ftp->no_transfer && !status) { /* 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 data has been transfered. This happens when doing through NATs etc that abandon old silent connections. * but lower the timeout as sometimes this connection has died while the * data has been transfered. This happens when doing through NATs etc that * abandon old silent connections. */ ftp->response_time = 60; /* give it only a minute for now */ Loading lib/ftp.h +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ #ifndef CURL_DISABLE_FTP CURLcode Curl_ftp(struct connectdata *conn); CURLcode Curl_ftp_done(struct connectdata *conn); CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode); CURLcode Curl_ftp_connect(struct connectdata *conn); CURLcode Curl_ftp_disconnect(struct connectdata *conn); CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...); Loading lib/http.c +3 −1 Original line number Diff line number Diff line Loading @@ -1172,10 +1172,12 @@ CURLcode Curl_http_connect(struct connectdata *conn) * has been performed. */ CURLcode Curl_http_done(struct connectdata *conn) CURLcode Curl_http_done(struct connectdata *conn, CURLcode status) { struct SessionHandle *data; struct HTTP *http; (void)status; /* no use for us */ data=conn->data; http=conn->proto.http; Loading lib/http.h +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, /* protocol-specific functions set up to be called by the main engine */ CURLcode Curl_http(struct connectdata *conn); CURLcode Curl_http_done(struct connectdata *conn); CURLcode Curl_http_done(struct connectdata *, CURLcode); CURLcode Curl_http_connect(struct connectdata *conn); /* The following functions are defined in http_chunks.c */ Loading lib/multi.c +4 −4 Original line number Diff line number Diff line Loading @@ -329,7 +329,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) char *gotourl; Curl_posttransfer(easy->easy_handle); easy->result = Curl_done(easy->easy_conn); easy->result = Curl_done(easy->easy_conn, CURLE_OK); if(CURLE_OK == easy->result) { gotourl = strdup(easy->easy_handle->change.url); easy->easy_handle->change.url_changed = FALSE; Loading Loading @@ -491,7 +491,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) easy->easy_conn->sock[SECONDARYSOCKET]=-1; } Curl_posttransfer(easy->easy_handle); Curl_done(easy->easy_conn); Curl_done(easy->easy_conn, easy->result); } /* after the transfer is done, go DONE */ Loading @@ -504,7 +504,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) if(easy->easy_conn->newurl) { char *newurl = easy->easy_conn->newurl; easy->easy_conn->newurl = NULL; easy->result = Curl_done(easy->easy_conn); easy->result = Curl_done(easy->easy_conn, CURLE_OK); if(easy->result == CURLE_OK) easy->result = Curl_follow(easy->easy_handle, newurl); if(CURLE_OK == easy->result) { Loading @@ -520,7 +520,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) break; case CURLM_STATE_DONE: /* post-transfer command */ easy->result = Curl_done(easy->easy_conn); easy->result = Curl_done(easy->easy_conn, CURLE_OK); /* after we have DONE what we're supposed to do, go COMPLETED, and it doesn't matter what the Curl_done() returned! */ Loading Loading
lib/ftp.c +25 −8 Original line number Diff line number Diff line Loading @@ -738,13 +738,14 @@ CURLcode Curl_ftp_connect(struct connectdata *conn) * * Input argument is already checked for validity. */ CURLcode Curl_ftp_done(struct connectdata *conn) CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) { struct SessionHandle *data = conn->data; struct FTP *ftp = conn->proto.ftp; ssize_t nread; int ftpcode; CURLcode result=CURLE_OK; bool was_ctl_valid = ftp->ctl_valid; /* free the dir tree and file parts */ Loading Loading @@ -785,7 +786,23 @@ CURLcode Curl_ftp_done(struct connectdata *conn) } } switch(status) { case CURLE_BAD_DOWNLOAD_RESUME: case CURLE_FTP_WEIRD_PASV_REPLY: case CURLE_FTP_PORT_FAILED: case CURLE_FTP_COULDNT_SET_BINARY: case CURLE_FTP_COULDNT_RETR_FILE: case CURLE_FTP_ACCESS_DENIED: /* the connection stays alive fine even though this happened */ /* fall-through */ case CURLE_OK: /* doesn't affect the control connection's status */ ftp->ctl_valid = was_ctl_valid; break; default: /* by default, an error means the control connection is wedged and should not be used anymore */ ftp->ctl_valid = FALSE; break; } #ifdef HAVE_KRB4 Curl_sec_fflush_fd(conn, conn->sock[SECONDARYSOCKET]); Loading @@ -794,11 +811,11 @@ CURLcode Curl_ftp_done(struct connectdata *conn) sclose(conn->sock[SECONDARYSOCKET]); conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; if(!ftp->no_transfer) { if(!ftp->no_transfer && !status) { /* 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 data has been transfered. This happens when doing through NATs etc that abandon old silent connections. * but lower the timeout as sometimes this connection has died while the * data has been transfered. This happens when doing through NATs etc that * abandon old silent connections. */ ftp->response_time = 60; /* give it only a minute for now */ Loading
lib/ftp.h +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ #ifndef CURL_DISABLE_FTP CURLcode Curl_ftp(struct connectdata *conn); CURLcode Curl_ftp_done(struct connectdata *conn); CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode); CURLcode Curl_ftp_connect(struct connectdata *conn); CURLcode Curl_ftp_disconnect(struct connectdata *conn); CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...); Loading
lib/http.c +3 −1 Original line number Diff line number Diff line Loading @@ -1172,10 +1172,12 @@ CURLcode Curl_http_connect(struct connectdata *conn) * has been performed. */ CURLcode Curl_http_done(struct connectdata *conn) CURLcode Curl_http_done(struct connectdata *conn, CURLcode status) { struct SessionHandle *data; struct HTTP *http; (void)status; /* no use for us */ data=conn->data; http=conn->proto.http; Loading
lib/http.h +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, /* protocol-specific functions set up to be called by the main engine */ CURLcode Curl_http(struct connectdata *conn); CURLcode Curl_http_done(struct connectdata *conn); CURLcode Curl_http_done(struct connectdata *, CURLcode); CURLcode Curl_http_connect(struct connectdata *conn); /* The following functions are defined in http_chunks.c */ Loading
lib/multi.c +4 −4 Original line number Diff line number Diff line Loading @@ -329,7 +329,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) char *gotourl; Curl_posttransfer(easy->easy_handle); easy->result = Curl_done(easy->easy_conn); easy->result = Curl_done(easy->easy_conn, CURLE_OK); if(CURLE_OK == easy->result) { gotourl = strdup(easy->easy_handle->change.url); easy->easy_handle->change.url_changed = FALSE; Loading Loading @@ -491,7 +491,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) easy->easy_conn->sock[SECONDARYSOCKET]=-1; } Curl_posttransfer(easy->easy_handle); Curl_done(easy->easy_conn); Curl_done(easy->easy_conn, easy->result); } /* after the transfer is done, go DONE */ Loading @@ -504,7 +504,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) if(easy->easy_conn->newurl) { char *newurl = easy->easy_conn->newurl; easy->easy_conn->newurl = NULL; easy->result = Curl_done(easy->easy_conn); easy->result = Curl_done(easy->easy_conn, CURLE_OK); if(easy->result == CURLE_OK) easy->result = Curl_follow(easy->easy_handle, newurl); if(CURLE_OK == easy->result) { Loading @@ -520,7 +520,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) break; case CURLM_STATE_DONE: /* post-transfer command */ easy->result = Curl_done(easy->easy_conn); easy->result = Curl_done(easy->easy_conn, CURLE_OK); /* after we have DONE what we're supposed to do, go COMPLETED, and it doesn't matter what the Curl_done() returned! */ Loading