cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Adding CURLINFO_CONTENT_LENGTH to curl_getinfo()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 2 Feb 2001 08:50:35 +0100 (MET)

On Thu, 1 Feb 2001, Bob Schader wrote:

> CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
> CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,

> Add the following case statement to curl_getinfo() in
> lib/getinfo.c's switch(info) statement:
>
> case CURLINFO_CONTENT_LENGTH:
> *param_longp = (long)(data->progress.size_dl +
> data->progress.size_ul);
> break;

Hm. This seems a little overkill. There already are two options named
CURLINFO_SIZE_UPLOAD and CURLINFO_SIZE_DOWNLOAD that returns those size
fields, although separately so that you can decide for yourself which kind of
"content-length" you want.

Why would we need an option that just does a simple addition?

> I tried to implement this properly as a *param_doublep like
> I thought it should be, but it would crash on me even when I
> would statically set it's value to something like "1.0", so I
> tried casting it to long and it worked.

The reason for the doublep is to use a variable that supports a very large
number as 'long long' is not yet in every man's compiler! ;-)

> I see 7.6.1-pre2 has been released, but this functionality isn't included
> in it yet that I can see.

You really should use CVS if you want the bleeding edge.

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