cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl not sending QUIT to terminate control connection

From: Joe Halpin <j.p.h_at_comcast.net>
Date: Mon, 19 Jan 2004 16:40:17 -0600

Daniel Stenberg wrote:
> On Mon, 19 Jan 2004, Joe Halpin wrote:
>
>
>>Ok, I'll check for CURLE_OK from Curl_ftpsendf() before calling
>>Curl_GetFTPResponse(). However, I still don't see what should be done if the
>>second call returns an error. We still have to close our side of the
>>connection, so we still have to call sclose() unconditionally anyway (or am
>>I missing something again?).
>
> No, you have nothing sensible to do, but I still like a good error code
> propagated back properly and then you can ignore it at the topmost level (like
> in Curl_ftp_disconnect), as it makes debugging this later easier, as you can
> simply add a check of one return code instead of having to add return codes
> all over.

Ok, I modified my changes to check the return code for both calls as such:

/***********************************************************************
  *
  * Curl_ftp_quit()
  *
  * This should be called before calling sclose() on an ftp control
  * connection (not data connections). We should then wait for the
  * response from the server before returning. The calling code
  * should then try to close the connection.
  *
  */
CURLcode Curl_ftp_quit(struct connectdata *conn)
{
   int nread;
   int ftpcode;
   CURLcode ret;

   ret = Curl_ftpsendf(conn, "%s", "QUIT");
   if(CURLE_OK == ret)
     ret = Curl_GetFTPResponse(&nread, conn, &ftpcode);

   return ret;
}

The only other changes I made were to add a prototype for this function
to ftp.h, and to call this function from Curl_ftp_disconnect().

Now when I run make test all the ftp test cases fail, although the test
data looks ok (QUIT is being sent, and a response is being received).
I've been looking at the perl script, but I don't see the problem. Any
ideas what I'm missing?

Thanks

Joe

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-19