1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

Early Ehlinger's CURLOPT_FTP_RESPONSE_TIMEOUT patch applied.

This commit is contained in:
Daniel Stenberg 2003-09-03 22:02:40 +00:00
parent 6a678f6d64
commit f2d422235b
5 changed files with 40 additions and 3 deletions

15
CHANGES
View File

@ -6,6 +6,21 @@
Changelog
Early (4 September)
- Added CURLOPT_FTP_RESPONSE_TIMEOUT - allows user to set strict timeout
requirements on the FTP server's ability to respond to individual commands
without placing global requirements on transfer or connect time. Files
affected:
- include/curl/curl.h
Added option CURLOPT_FTP_RESPONSE_TIMEOUT
- lib/ftp.c
Added branch inside Curl_GetFTPResponse to check for
data->set.ftp_response_timeout
- lib/url.c
Modified Curl_setopt to recognize CURLOPT_FTP_RESPONSE_TIMEOUT
- lib/urldata.h
Added ftp_response_timeout to struct UserDefined
Daniel (3 September)
- Peter Pentchev found and fixed two problems in the test suite's web server
code, that made it segfault at times.

View File

@ -29,7 +29,7 @@
/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "7.10.7"
#define LIBCURL_VERSION "7.10.8-test2"
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
@ -45,7 +45,7 @@
always a greater number in a more recent release. It makes comparisons with
greater than and less than work.
*/
#define LIBCURL_VERSION_NUM 0x070a07
#define LIBCURL_VERSION_NUM 0x070a08
#include <stdio.h>
@ -678,6 +678,12 @@ typedef enum {
Note that setting multiple bits may cause extra network round-trips. */
CINIT(PROXYAUTH, LONG, 111),
/* FPT Option that changes the timeout, in seconds, associated with
getting a response. This is different from transfer timeout time and
essentially places a demand on the FTP server to acknowledge commands
in a timely manner. */
CINIT(FTP_RESPONSE_TIMEOUT, LONG , 112),
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

View File

@ -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 */

View File

@ -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

View File

@ -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 */