cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: State of things for release?

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Wed, 30 Jul 2008 14:17:36 -0500

Dan Fandrich wrote:

> Simply put, do a complete ftp transaction with CURLOPT_NOBODY set to 1 to
> check the existence of the file, check the error code, then do a new one
> (with the same handle) with CURLOPT_NOBODY set to 0 to actually transfer
> the file.

I just tried it here, and it looks like CURLOPT_NOBODY
returns CURLE_OK even if the file doesn't exist, even
when CURLOPT_FAILONERROR is set. I also tried testing
the CURLINFO_RESPONSE_CODE and I am getting 350 in
either case, libcurl still sends REST even after a 550
response to SIZE. This was just a quick test, maybe I got
something wrong:

#include <curl/curl.h>

int main(int argc, char*argv[])
{
  CURL*curl=curl_easy_init();
  int rv;
  long resp;
  curl_easy_setopt(curl,CURLOPT_URL, argv[1]);
  curl_easy_setopt(curl,CURLOPT_NOBODY, 1);
  curl_easy_setopt(curl,CURLOPT_VERBOSE, 1);
  curl_easy_setopt(curl,CURLOPT_FAILONERROR, 1);
  rv=curl_easy_perform(curl);
  curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&resp);
  printf("rv=%d resp=%d\n", rv, resp);
  curl_easy_setopt(curl,CURLOPT_UPLOAD, 1);
  curl_easy_setopt(curl,CURLOPT_NOBODY, 0);
  rv=curl_easy_perform(curl);
}

 - Jeff
Received on 2008-07-30