cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Where do I get the response from the SIZE command?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 18 Oct 2002 09:02:09 +0200 (MET DST)

On Thu, 17 Oct 2002, Guido Reina wrote:

> To ask the FTP server about the file size of a file, would it be something
> like this? (imagine the file is at: ftp://127.0.0.1/dir/my_file)

> #define REMOTE_URL "ftp://127.0.0.1/dir/"
>
> ...
> char buf_1 [] = "SIZE my_file";
> ...
> ...
> curl_easy_setopt(curl,CURLOPT_URL, REMOTE_URL);
> curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, my_curl_write_function);
>
> headerlist = curl_slist_append (headerlist, buf_1);

[I guess you'd add a CURLOPT_QUOTE too]

> res = curl_easy_perform(curl);
>
> The write function is called just once, and 'void *ptr' contains the
> listing of the directory 'dir'. How do I get the response from the SIZE
> command?

You'd need to use the debugfunction callback.

Normally, you can get the size of a file (even ftp) by using the NOBODY
option.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-18