cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how libcurl receives chunked data from http server?

From: Jerry G. Chiuan <jerry_at_oridus.com>
Date: Mon, 22 Sep 2003 16:46:20 -0700

> Subject: Re: how libcurl receives chunked data from http server?
> On Mon, 22 Sep 2003, Jerry G. Chiuan wrote:
>
> > Here, what is the purpose of receiving partial response data and then
call
> > write callback. why is it not designed to receive the whole response at
a
> > time? in single buffer?
>
> Because that would A) take LOTS of memory, and B) prevent libcurl to be
able
> to download lots of files (due to the amount of memory being smaller than
the
> file size).

I see, there is no free lunch : )
If libcurl doesn't hold the whole response in memory, the application has to
copy every partial response to another place before handling the whole
response. Anyway, there must be some guy who needs to keep the whole
response and plenty of memory is still required.

> > Is it because libcurl expects application to copy partial data from
buffer
> > and the buffer can be reused by libcurl for rest of response data? ( by
> > doing this, less memory would be consumed )
>
> Yes, and to allow any-size data to be downloaded. There's often no point
in
> keeping the entire response in memory. And if you DO want to, libcurl
still
> offers you the ability to do so.

you mean libcurl allows us to keep the whole response *without* patch?
could you please tell me how I have to do for libcurl to keep the whole
response?

Moreover, is it possible to keep it in single buffer?

Regds,
- Jerry

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-23