curl-library
Change in FTP output from 7.16.2 and 7.16.4.....
Date: Sun, 15 Jul 2007 06:15:29 -0400
Hi all,
I am new to the list but have used the curl library for some time
doing some FTP stuff in C.
When I upgraded from 7.16.2 to 7.16.4, I have noticed a change in
behavior. Now, when doing an FTP delete, I get the string "Accept-
ranges: bytes" output to stdout. I have tried turning this off with
the following, but nothing seems to make a difference.
Any hints would be appreciated as to how I can turn off the 'Accept-
ranges: bytes' message.
Phil
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_buff); // to
send errors to a buffer...
-----or-----
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0); // to turn off
verbose mode...
-----or-----
size_t curl_header_fn( void *ptr, size_t size, size_t nmemb, void
*stream)
{
return size * nmemb;
}
...
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION,
curl_header_fn); // to catch headers...
-----or-----
size_t curl_debug_fn(CURL *, curl_infotype, char *, size_t, void *)
{
return 0;
}
...
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION , curl_debug_fn); //
to catch debug info...
-----or-----
FILE * curl_f = fopen(.....); // open a tmp file
curl_easy_setopt(curl, CURLOPT_STDERR , curl_f); // to catch
stderr...
---------------------------
Here is a snip of how I do an FTP delete:
---------------------------
....
string delcommand;
sprintf(delcommand, "DELE %s", nameptr);
CURL *curl;
CURLcode res;
struct curl_slist *headerlist=NULL;
printf("curl delete_file_or_directory -----------------------
\n"); // 'Accept-ranges: bytes' happens after this....
curl = curl_easy_init();
if (curl)
{
headerlist = curl_slist_append(headerlist, delcommand);
if (_active_ftp)
curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_debug_fn); <---
here is where I have been putting the above lines
curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
// went away in 7.11.1 ?? curl_easy_setopt(curl, CURLOPT_MUTE, 1);
curl_easy_setopt(curl, CURLOPT_URL, escaped_url);
curl_easy_setopt(curl, CURLOPT_QUOTE, headerlist);
res = curl_easy_perform(curl); <----- here is where the 'Accept-
ranges: bytes' is happening
curl_easy_cleanup(curl);
}
curl_slist_free_all(headerlist);
printf("END curl delete_file_or_directory -----------------------\n");
Received on 2007-07-15