curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Issue with WRITE_FUNCTION callback , multi socket interface.

From: Badari Prasad via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 12 Mar 2019 20:28:37 +0530

Hi Daniel,
      In continuation with this callback issue I am facing [and as per
https://curl.haxx.se/mail/lib-2011-09/0232.html] , if server sends
Transfer-Encoding: chunked, server will send the size of the chunked data
and the actual data to the client, libcurl consumes this size of chunked
data and invokes write callback function when data arrives at the client.

I was just wondering if libcurl can also pass this size of each chunk and
then invokes write function callback, this way my application will know
size of the chunk and can handle the multiple function call backs. Is this
some how possible with libcurl ?

Thanks
 badari

On Tue, Mar 5, 2019 at 9:28 PM Badari Prasad <badari.hp_at_gmail.com> wrote:

> Thank you for response.
>
> On Mon 4 Mar, 2019, 12:37 Daniel Stenberg <daniel_at_haxx.se wrote:
>
>> On Mon, 4 Mar 2019, Badari Prasad via curl-library wrote:
>>
>> > Does libcurl provide any event to application like START_OF_READ when
>> > response is ready and END_OF_READ kind of event which I can make use of
>> for
>> > an http connection ? or any other better solution to this kind of issue
>> > where multiple responses for a single http request is received by
>> client.
>>
>> No.
>>
>> The response that curl gets is TCP. TCP is just a stream of bytes and
>> curl
>> reads bytes whenever there are any available on the network to read.
>> There's
>> no way for curl to make any other distinction of what is being delivered.
>>
>> If what comes over the TCP is multiple messages as you say, then you need
>> to
>> parse the contents or otherwise send markers in that content to make your
>> app
>> able to do the necessary separation.
>>
>> Also remember that due to routing, package retransmits etc, what looked
>> like
>> "gaps" between TCP segments from one end might not at all by any gaps in
>> the
>> other end, and data that is sent back to back might end up arriving with
>> time
>> between the packages.
>>
>> --
>>
>> / daniel.haxx.se
>>
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-03-12