cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS Lookups.

From: Keean Schupke <keean_at_fry-it.com>
Date: Thu, 31 Mar 2011 12:02:03 +0000

On 31 March 2011 11:46, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Thu, 31 Mar 2011, Keean Schupke wrote:
>
> We are using the CURLOPT_OPENSOCKETFUNCTION to open a socket to our
>> destination. We need to be able to replace the DNS lookup, as our socket
>> connect function takes the host name directly not an IP address.
>>
>
> So you're kind of doing a socks-like thing outside of libcurl? I can see
> how one could find a use for such a feature.
>
>
> We can get the hostname from curl_easy_getinfo with CURLINFO_EFFECTIVE_URL
>> inside the open-socket-function. What we need to do now is suppress the DNS
>> lookup, as the hostname will not be a resolvable name. Currently we push the
>> name into the DNS cache using CURLOPT_RESOLVE, but this does not work when
>> the remote server does a redirect.
>>
>
> The obvious immediate way is of course to not use libcurl's internal
> redirect following but to do it yourself (with libcurl's CURLINFO_*
> variables' assistance).
>
> libcurl doesn't have any pluggable way for an application to do the host
> name resolving. I wouldn't mind seeing such a way getting introduced, but I
> think it'll take some careful condiderations and planning first as it would
> then probably be wiser to allow a pluggable completely asynch resolver.
>
>
> Any suggestions as to the best way to disable DNS lookup for our non-DNS
>> hostnames?
>>
>
> An alternative approach that is transparent to libcurl is to
> LD_PRELOAD-replace the resolver functions libcurl uses - when built to use
> the synchronous resolver.
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

Could we provide an alternative to c-ares? Whats the API like?

Cheers,
Keean.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-31