diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-09-03 22:02:40 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-09-03 22:02:40 +0000 |
commit | f2d422235b0bf7dc6e7179143296a5e4abf8b9ed (patch) | |
tree | 27de1368f21ba3bb8fbadc9f1ae20a7ab90898f7 /lib | |
parent | 6a678f6d64b287eaf58186108a4cf9f1fcff8990 (diff) |
Early Ehlinger's CURLOPT_FTP_RESPONSE_TIMEOUT patch applied.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftp.c | 10 | ||||
-rw-r--r-- | lib/url.c | 7 | ||||
-rw-r--r-- | lib/urldata.h | 1 |
3 files changed, 17 insertions, 1 deletions
@@ -233,7 +233,15 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ while((*nreadp<BUFSIZE) && (keepon && !result)) { /* check and reset timeout value every lap */ - if(data->set.timeout) + if(data->set.ftp_response_timeout ) + /* if CURLOPT_FTP_RESPONSE_TIMEOUT is set, use that to determine + remaining time. Also, use "now" as opposed to "conn->now" + because ftp_response_timeout is only supposed to govern + the response for any given ftp response, not for the time + from connect to the given ftp response. */ + timeout = data->set.ftp_response_timeout - /* timeout time */ + Curl_tvdiff(Curl_tvnow(), now)/1000; /* spent time */ + else if(data->set.timeout) /* if timeout is requested, find out how much remaining time we have */ timeout = data->set.timeout - /* timeout time */ Curl_tvdiff(Curl_tvnow(), conn->now)/1000; /* spent time */ @@ -500,6 +500,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) */ data->set.ftp_create_missing_dirs = va_arg( param , long )?TRUE:FALSE; break; + case CURLOPT_FTP_RESPONSE_TIMEOUT: + /* + * An FTP option that specifies how quickly an FTP response must be + * obtained before it is considered failure. + */ + data->set.ftp_response_timeout = va_arg( param , long ); + break; case CURLOPT_FTPLISTONLY: /* * An FTP option that changes the command to one that asks for a list diff --git a/lib/urldata.h b/lib/urldata.h index 907bb5dc6..2a7198055 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -773,6 +773,7 @@ struct UserDefined { void *passwd_client; /* pass to the passwd callback */ long timeout; /* in seconds, 0 means no timeout */ long connecttimeout; /* in seconds, 0 means no timeout */ + long ftp_response_timeout; /* in seconds, 0 means no timeout */ long infilesize; /* size of file to upload, -1 means unknown */ long low_speed_limit; /* bytes/second */ long low_speed_time; /* number of seconds */ |