curl-library
Re: How to get chunked http data and its length
Date: Fri, 26 Jun 2009 09:24:57 +0200 (CEST)
On Fri, 26 Jun 2009, xuhf wrote:
> When libcurl receives http response using chunked, how do I know the length
> of the chunk data?
You mean the entire response body? You don't know that size until the whole
thing has been received. That's in fact the whole point with chunked transfer
encoding!
> Another word, can libcurl tells the length?
It reads the data, chunk by chunk, and it knows how large each chunk is and it
knows when the server has sent the last chunk and then it has reached the end.
So no, libcurl doesn't know the size of anything else than the currently read
chunk.
> Or libcurl will receive all the chunk data and then call write function?
libcurl "decodes" the chunked encoding and calls the write function, so an
application will never see any encoding or even need to bother about it being
there or not.
-- / daniel.haxx.seReceived on 2009-06-26