cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: clarification about maxdownload vs. size

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 1 Feb 2010 23:51:17 +0100 (CET)

On Mon, 1 Feb 2010, Chris Conroy wrote:

> struct SingleRequest has two variables that serve two very similar purposes,
> size and maxdownload. Here are the comments at their declaration.
>
> curl_off_t size; /* -1 if unknown at this point */
>
> curl_off_t maxdownload; /* in bytes, the maximum amount of data to
> fetch,-1 means unlimited */
>
> Yet, in tracing through the code, they seem to be used fairly
> interchangeably. I am curious what the real distinction between the two of
> them is because it's not abundantly clear to me why there should be two
> separate variables given that they seem to (almost?) always be set to the
> same value.

'size' is the discovered size of the entity that is to be downloaded.

'maxdownload' can be a pre-configured maximum amount of data to download, but
if it isn't set to something it is often set to the value of 'size' to make
things handy.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-01