mirror of
https://github.com/curl/curl.git
synced 2026-08-26 16:23:32 +03:00
Early Ehlinger's CURLOPT_FTP_RESPONSE_TIMEOUT patch applied.
This commit is contained in:
parent
6a678f6d64
commit
f2d422235b
5 changed files with 40 additions and 3 deletions
10
lib/ftp.c
10
lib/ftp.c
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue