cURL / Mailing Lists / curl-users / Single Mail

curl-users

FTP may not timeout

From: SM <nntp_at_iname.com>
Date: Wed, 07 Feb 2001 05:56:36 +0400

Hello,

I noticed that FTP may not timeout under specific circumstances. If the
connection to the FTP server is established and the server does not send
response, Curl waits indefinitely. I tracked down the problem to the
ftp.c. I made some changes in Curl_GetFTPResponse to work around that.

--- ftp.c Mon Feb 5 04:44:05 2001
+++ /new/ftp.c Mon Feb 5 04:55:11 2001
@@ -222,7 +222,7 @@
 {
   int nread;
   size_t keepon=TRUE;
- char *ptr;
+ char *ptr = 0;
   int timeout = 3600; /* in seconds */
   struct timeval interval;
   fd_set rkeepfd;
@@ -288,7 +288,11 @@
       if(keepon) {
         nread++;
         ptr++;
- }
+ } else if((*ptr == 0) && (keepon <= 0)) {
+ error = SELECT_TIMEOUT;
+ failf(data, "Transfer aborted due to timeout");
+ break;
+ }
     }
     *ptr=0; /* zero terminate */

Could Daniel please verify whether the above changes are correct?

Thanks
Received on 2001-02-07