curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Retrieve all addresses mapped to specific host, not just one IP

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 13 Aug 2018 12:24:34 +0200 (CEST)

On Mon, 13 Aug 2018, myLC--- via curl-library wrote:

>> I think most existing users would presume such data to become available via
>> curl_easy_getinfo(), like the primary IP and friends already are.
>
> I'm obvious not that acquainted with curl. I took a glance at the source.
> Unless I'm mistaken, you are using a renamed addrinfo struct on the inside.

Yes, although not just renamed, it's an actual private version of the entire
struct.

> Could it lead to problems with multiple threads, if you simply passed a
> pointer to that (chain of) struct(s) via curl_easy_getinfo?

We never export internal data like that. Export data needs to get their own
struct if a struct is to be used so that we don't mix internal representations
with what we promise in external APIs/ABIs.

But more so: there's no guarantee that we have the name resolved data left
around after a transfer is complete as it is only saved in the DNS cache for a
certain (customizable) time. We would probably need to convert the internal
data to the exportable representation at the lookup time.

> By using the callback after having resolved the hostname, you'd dispose of
> this burden.

Sure, I'm not totally against a callback. But we'd still have to convert the
representation to something that we think we can stick to for the forseeable
future even if the internals would change...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-08-13