cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl multi and asiohiper

From: Thomas Sanchez <thomas.sanchz_at_gmail.com>
Date: Wed, 5 Mar 2014 15:24:38 +0100

Hi,
Sorry for the delay !

2014-02-25 17:57 GMT+01:00 Daniel Stenberg <daniel_at_haxx.se>:
> On Sun, 23 Feb 2014, Thomas Sanchez wrote:
>
>> It is said that when curl_multi_socket_action is called it will call the
>> CURLMOPT_SOCKETFUNCTION *if the status was updated*, this means, if the
>> status is not updated the socket should be rescheduled to wait for the same
>> type of event.
>
>
> I like to see the events you wait for as persistent. You get informed by
> libcurl about what to wait for, and those events should remain in place
> until libcurl tells the application to remove them. So you don't really
> "reschedule" events, you keep waiting for all the events libcurl has asked
> for until it tells you to remove those events.

Yes, but this was not implemented like this in the asiohiper example,
this is why I was mistaken :)

>
> Of course, specific event library implementation details may call for events
> to have to be set again, but that sounds like stupid design and I know there
> are several event libs that don't work like that.

I initially thought that the socket are being set to be non blocking
and the multi_socket_action continues the current action until
something block and then the socket_cb would have been called back.

>
> Is this a correct description of "asio" in this use case?

Asio will call the callback when the socket is ready (whether it is
for a write or a read according to the action you asked for), but if
one wants to read or write again, the async_read/write must be called
again

>
> If your event lib works like that, I would suggest you keep a copy of the
> events libcurl wants and their properties so that can set them again at
> will.
>
>

Yes this is what I did in the end and it works fine.

>> To trigger the bug, one can simply modify the url to a complete google url
>> like: http://www.google.fr/ which do not trigger a redirection but a
>> complete page with a chunked response.
>
>
> If you have any suggested improvements for the example, we'll be happy to
> update it! I don't know much about asio and I'll admit I haven't studied the
> asiohiper source code very carefully.
>

Currently I do not have the time to do it properly, but this is
something I have in mind :)

-- 
Thomas Sanchez
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-05