cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: FTP may not timeout

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 7 Feb 2001 10:12:18 +0100 (MET)

On Wed, 7 Feb 2001, SM wrote:

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

You're right. It could get a -1 returned when reading the socket, and that
would not abort the loop in Curl_GetFTPResponse().

> Could Daniel please verify whether the above changes are correct?

I'd instead suggest this smaller fix (and this is soon committed to CVS):

--- ftp.c 2001/02/05 23:35:44 1.48
+++ ftp.c 2001/02/07 09:09:49
@@ -282,6 +282,8 @@
          */
         if(CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &keepon))
           keepon = FALSE;
+ else if(keepon < 0)
+ error = SELECT_ERROR;
         else if ((*ptr == '\n') || (*ptr == '\r'))
           keepon = FALSE;
       }

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
Received on 2001-02-07