cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: timeout_ms < 1000

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Fri, 14 May 2010 00:12:27 +0200

On Thursday 13 of May 2010 23:34:49 Yoni Rom wrote:
> I'm running 7.20.1 on linux with the PHP binding.
>
> Thanks for the reply. It is exactly what I was looking for and probably
> skipped it in the documentation.
>
> I will give it a try.
>
> After looking around a bit I saw your patch for 7.20.1, is there any
> preference for one over the other?

Do you mean the patch introducing the --enable-threaded-resolver configure
option?

http://github.com/bagder/curl/commit/79dc74e84de3e239f2c7e2e03317ad2bcf679ab7

That's the way to enable the threaded resolver on Linux. We use something
like that on rawhide Fedora right now. The feature is not entirely stable
though.

Each of them has its own positive and negative properties.

The c-ares name resolver is a bit saner for a library since it's thread-safe,
but doesn't use threads. The downside is that it implements the DNS lookup
on its own, bypassing the legacy glibc/NSS resolver stack. Consequently any
glibc/NSS plug-in like mDNS won't be taken into account with c-ares. There
is also a known problem with IPv6. It can't pass both IPv4 and IPv6 records
to libcurl per one URL. The related bugs are:

https://bugzilla.redhat.com/548269
https://bugzilla.redhat.com/554305

The threaded DNS resolver has been used on Windows for some time already, now
also brought up on Linux recently. It uses the system name resolver with all
the advantages it provides. To implement the timeout during resolve, it runs
the lookup in a separate thread, using pthread library for threading.

Generally it's not completely safe to use threads in such a generic library
like libcurl is. It may clash with the application or another library under
some circumstances. Nevertheless so can the alarm/sigsetjmp/longjmp solution
you're using right now for implementing the timeout ;-)

Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-14