Early Ehlinger's CURLOPT_FTP_RESPONSE_TIMEOUT patch applied.
authorDaniel Stenberg <daniel@haxx.se>
Wed, 3 Sep 2003 22:02:40 +0000 (22:02 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 3 Sep 2003 22:02:40 +0000 (22:02 +0000)
CHANGES
include/curl/curl.h
lib/ftp.c
lib/url.c
lib/urldata.h

diff --git a/CHANGES b/CHANGES
index 776c9e6..d0e02d3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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.
index 96a8b4b..10ef77c 100644 (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;
 
index 5294605..cae5361 100644 (file)
--- a/lib/ftp.c
+++ b/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 */
index 40b718f..69c3677 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -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
index 907bb5d..2a71980 100644 (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 */