cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Progress callback function arguments and download size

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 4 Apr 2007 22:08:33 +0200 (CEST)

On Wed, 4 Apr 2007, Dmitry Antipov wrote:

> 1) why not passing -1 as 2nd arg of progress callback if the download size
> can't be obtained ? This may be useful to distinguish between the cases when
> the size is _really_ unknown and the cases when the size is 0, i.e. when
> downloading an empty file.

Yes, possibly it should've been done like that but now we don't want to change
that behavior since we'll then risk breaking existing applications that rely
on the current way.

I've already pondered on "fixing" the progress callback by adding a new option
that would use a different function prototype which could also use curl_off_t
instead of doubles in its arguments etc. But demand/request for such work
hasn't really been vocal so I've just let it remain ideas.

> 2) Will CURLINFO_CONTENT_LENGTH_DOWNLOAD be also 0 if we didn't receive
> Content-Length: from the (brain-damaged) server at all ?

Yes. But note that it needn't be brain damaged to do that, it can also for
example provide data using chunked transfer-encoding or similar.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-04-04