cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_perform with CURLOPT_NOBODY = 1 returns 0 when ftp file does not exist.

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sun, 28 Sep 2008 18:47:58 -0700

On Sun, Sep 28, 2008 at 01:25:34PM -0300, Carlos Alloatti wrote:
> When calling curl_easy_perform with CURLOPT_NOBODY set to 1, setting
> CURLOPT_URL to a non-existing file in an FTP server, the return value
> is 0.
>
> I am using this to latter get the file size with
> CURLINFO_CONTENT_LENGTH_DOWNLOAD.
>
> The returned file size is -1 in this case, but maybe curl_easy_perform
> should not return 0, but something else, like
> CURLE_REMOTE_FILE_NOT_FOUND
>
> Under the same circumstances, with CURLOPT_NOBODY set to 0, the return
> value is 19, CURLE_FTP_COULDNT_RETR_FILE
>
> Sorry I cannot provide repro code, I am actually wrapping libcurl in a
> Visual FoxPro class, and I know the Visual FoxPro code will be useless
> in this case.

I tried this using the curl command-line client to try to reproduce this:

  curl ftp://ftp.mozilla.org/invalid-file
  curl -I ftp://ftp.mozilla.org/invalid-file

and in both cases got error 19, CURLE_FTP_COULDNT_RETR_FILE.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-09-29