cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Total file length

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 11 Dec 2000 14:45:04 +0100 (MET)

On Mon, 11 Dec 2000, Johan Nilsson wrote:

> I'm new to Curl so maybe this is a stupid question.

I don't think it is stupid.

> How can I find out the files total length (when starting to download,
> i.e. after the first response) using the easy interface without having to
> use a progress function?

You can't.

I could imagine adding a separate function or some option to
curl_easy_getinfo() that could get that ability. Or perhaps it would be even
better to add a separate function to use for querying the library during
operations (as curl_easy_getinfo() is otherwise only to be used after
transfers are done).

The problem is that we don't necessary know the size and we can't really tell
when we'll know it. Theoretically, from a very slow or loaded server sending
lots of headers, we could wait a long time for the length to get known and
the write function can be called numerous times before that.

> I don't want to parse any headers and I saw that this information was
> sent as an argument to the progress function.

Consider it an information I thought mostly was interestin for progress
information,

> I use a write function of my own and I wouldn't need to use the progress
> function if it wheren't for that feature.

Adding a progress function is a very minor thing, and if you pass a struct
you define you could set it as soon as the information is there and then your
program would get to know...

Of course I need people's views on this!

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/curl-library
Received on 2000-12-11