cURL / Mailing Lists / curl-library / Single Mail


Re: PATCH: Handle DNS timeouts on multi-interfaces better

From: Jason Glasgow <>
Date: Thu, 1 Dec 2011 07:24:52 -0500

Attached is an updated patch that deals with the fact that if the c-ares
timeout is less than 1000us it gets rounded to zero, which when Curl_expire
is called removes *all* timeouts.

On Wed, Nov 30, 2011 at 5:11 PM, Jason Glasgow <> wrote:

> Please hold off on evaluating this patch. I've been doing some more
> testing and I am not sure it is right. -Jason
> On Wed, Nov 30, 2011 at 3:43 PM, Jason Glasgow <>wrote:
>> Attached is a patch to fix a problem I've been having with the
>> multi-interface. The problem that I've observed is that if the first name
>> server is not available, the multi interface does not invoke the socket_cb
>> when the DNS request to the first name server timesout.
>> This bug can be reproduced if Curl is complied with --enable_ares
>> and your code uses the multi socket interfaces and
>> the CURLMOPT_SOCKETFUNCTION option. The way I test is to set up an
>> iptables rule that discards the name server reply from the first name
>> server. This forces a timeout and then cares tries to use the secondary
>> name server. Without the patch, the client code is never informed of the
>> new socket that cares is using.
>> To test try:
>> iptables -I INPUT \
>> -s $(sed -n -e '/name/{s/.* //p;q}' /etc/resolv.conf)/32 \
>> -j REJECT
>> and then run a program which uses the multi-interface
>> -Jason

List admin:

Received on 2011-12-01