curl-library
RE: curl-library Digest, Vol 46, Issue 53
Date: Fri, 26 Jun 2009 16:12:40 +0800
> Message: 9
> Date: Fri, 26 Jun 2009 09:24:57 +0200 (CEST)
> From: Daniel Stenberg
> Subject: Re: How to get chunked http data and its length
> To: libcurl development
> Message-ID:
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
> 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.se
Maybe I didn't explain my problem clearly.
In fact, I just want to get one chunk data, not entire response body. So I must get each chunklength.
I know libcurl knows how large each chunk is, but can I?
Thanks
_________________________________________________________________
上Windows Live 中国首页,下载最新版Messenger!
http://www.windowslive.cn
Received on 2009-06-26