curl-library
FTP Delete with libcurl
Date: Mon, 6 May 2002 17:45:25 -0400
Hi,
I wonder if someone could help me figure out what I'm doing wrong here. I'm trying to delete a file via libcurl. The following is a very simple program to demonstrate how I'm doing this:
int main(void)
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "ftp://user:pass@host/path");
curl_easy_setopt(curl, CURLOPT_QUOTE, "DELE filename");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if(CURLE_OK != res) {
/* we failed */
fprintf(stderr, "curl replied: %d\n", res);
}
}
curl_global_cleanup();
return 0;
}
When I compile and run this program, I reliably get a segmentation fault. However, the following command using cURL works as expected:
curl -Q "DELE filename" ftp://user:pass@host/path
The segmentation fault occurs during curl_easy_perform. If I watch the TCP traffic, I get the following output (after password censorship):
220 ProFTPD 1.2.0pre10 Server (ProFTPD Default Installation) [badass.eng.clearway.com]
USER [username]
331 Password required for [username].
PASS [password]
230 User netcon logged in.
PWD
257 "/home/netcon" is current directory.
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth_at_sourceforge.net
Received on 2002-05-06