curl-library
Re: CURLOPT_WRITEFUNCTION function getting called multiple time even the complete http response body is only 2155 bytes
Date: Mon, 22 Jun 2015 10:45:59 +0530
On 20-Jun-15 04:42 AM, Daniel Stenberg wrote:
> On Fri, 19 Jun 2015, Ganesh Nikam wrote:
>
>> 1. What do you mean by "as much as possible" here ? how libcurl
>> decides it ?
>
> It depends completley on what it receives. For every recv() call (and
> some other details Jay mentioned), libcurl will call the callback to
> deliver data.
>
>> 2. In my case, my complete http response boby is of 2155 bytes. For
>> such small response also libcurl breaks the message in two callbacks.
>> First with 1295 byte and other is 860 byte. What could be the reasons
>> for
>> calling callback two times for such small message size?
>
> Most probably libcurl received the data in two different recv() calls.
>
>> 3. I want to get the complete http response in single write_callbck
>> function.
>
> libcurl doesn't work like that.
>
>> is there is any way to get the complete size of the http response ?
>
> Sure, for example like this:
> http://curl.haxx.se/libcurl/c/getinmemory.html
>
>> My http server sends response in chunked encoding. is there a way
>> to get the chunked response size ?
>
> You can switch off transfer-encoding in libcurl, and then you get all
> the chunked data to deal with - but then you also have to do the
> entire chunked decoding yourself.
>>> Yes. I can do this. This is the good option and it will work for
me. Thanks for pointing it out.
- Ganesh
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-06-22