cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: FTP may not timeout

From: SM <nntp_at_iname.com>
Date: Wed, 07 Feb 2001 22:18:14 +0400

Hi Daniel,
At 10:12 07-02-2001 +0100, Daniel wrote:
>You're right. It could get a -1 returned when reading the socket, and that
>would not abort the loop in Curl_GetFTPResponse().

I tested the fix below and it does not cause a timeout. Curl keeps on
waiting even if it does not receive any data. Reading the socket does not
return a -1 as the connection has not been teared down.

>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;
> }

I used netcat to reproduce the problem on the server side. I set netcat to
listen on a port, then got Curl to ftp to that port. Curl waited
indefinitely as the value of keepon is zero.

Thanks
Received on 2001-02-07