curl-library
libcurl not sending QUIT to terminate control connection
Date: Sun, 18 Jan 2004 14:25:37 -0600
I'm working on a patch to get libcurl to send QUIT before terminating
the control connection. I thought I had figured out what needed to be
done, and it is sending QUIT, but I'm getting SEGV in
Curl_GetFTPResponse now, so I'm obviously missing something.
I added the following function
void Curl_ftp_quit(struct connectdata *conn)
{
int nread;
int ftpcode;
(void) Curl_ftpsendf(conn, "%s", "QUIT");
(void) Curl_GetFTPResponse(&nread, conn, &ftpcode);
}
And called it like this from Curl_disconnect()
if(-1 != conn->sock[FIRSTSOCKET]) {
/*
* If this is an ftp connection, then FIRSTSOCKET is the control
* connection. Send a QUIT message and get any response back
* before actually closing the connection.
*/
if(PROT_FTP == conn->protocol)
Curl_ftp_quit(conn);
sclose(conn->sock[FIRSTSOCKET]);
}
It crashes in Curl_GETFTPResponse at line 296
memcpy(ptr, ftp->cache, (int)ftp->cache_size);
According to GDB, ftp->cache is an invalid pointer here.
I'm probably missing something obvious, I've been starting at code too
long. Anyone see 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-18