curl-library
Re: libcurl not sending QUIT to terminate control connection
Date: Mon, 19 Jan 2004 09:20:25 -0600
Daniel Stenberg wrote:
> On Sun, 18 Jan 2004, Joe Halpin wrote:
>
>>>Just note that having the (void)s there is not very nice code. Actually
>>>caring about errors is better.
>>
>>Normally I do. However, the only error I can see that would occur is for the
>>server to have closed its end of the connection (for example, crashing in
>>the middle of a send).
>
> Yes, and then it would be unnecessary to attempt to read the response. It
> could also time-out (both the send and the read).
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?).
>>I had thought that Curl_read() would detect that, but looking at it again I
>>see that it doesn't return a value of 0, so there isn't any way of telling
>>that the server has dropped the connection. I'll have to think about that a
>>bit more.
>
> It returns the size of the read data (in the 5th argument's pointed-to data),
> which indeed is 0 if you didn't get any. It also returns an error code for
> errors, and CURLE_OK if everything is OK.
Sorry, I meant to say Curl_GetFTPResponse(), since that's what I'm calling.
[...]
>>I'm not very familiar with the library though. I suspect you're correct
>>about calling Curl_ftp_quit() at the wrong point. Would it be ok for me to
>>add a parameter to Curl_ftp_disconnect() which indicates whether or not an
>>ftp control connection is being closed? Then I could know when to call
>>Curl_ftp_quit().
>
> This disconnect is always referring to the control connection. The data
> connection is treated differently.
Ahh, that's what I was missing. Good.
>>Incidentally, I tried running this with the memory debug option on but got
>>no output file.
>
> You need to give me some more info. What did you do to get an output file? If
> you build a full curl tool with --enable-debug, you get a curl binary that
> produces an output file (named 'memdump') if the environment variable
> CURL_MEMDEBUG is set.
Yes, I built it that way. I also stepped through it in a debugger to
make sure that the initialization function was being called, but still
don't see a file. I assume it goes in the current directory?
I'll go ahead and run the tests after making the change you wanted. I'll
try it out on Solaris with the watchmalloc facility as well, but I'm
pretty sure that the problem was as you described - I was calling
Curl_ftp_quit() after the memory had been freed.
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