curl / Mailing Lists / curl-library / Single Mail


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

From: Richard Gray via curl-library <>
Date: Tue, 14 Aug 2018 11:23:11 -0400

myLC--- via curl-library wrote:
> On Mon, 13 Aug 2018, Richard Gray wrote:
> > I'm confused about what it is you are trying to do with
> > the list of addresses?
> ...
> If you have a list of IPs/hostnames, this is necessary to
> identify duplicate entries (public VPNs or proxies, for
> instance).

OK, filtering - got it.

> > It's not clear to me why you are trying to get libcurl to
> > return that address list.
> ...

You still haven't indicated what kind of access(es) you are trying to perform
with the potentially multiple addresses. Are trying to just find the first
one that works? Are you trying to actually access more than one of them? The
later case might be something like testing the various hosts behind a load

> > If you are on a modern system, you already have a way to
> > do this: getaddrinfo() or equivalent.
> That would imply doing it twice – libcurl would do it once
> and then you'd do the same afterwards.

No, you would do the resolves then tell libcurl to operate on any returned
address(es) you are interested in.

If the host(s) don't have a problem with an access using a literal IP for the
URL, just format URLs with literal IPs instead of host names.

If the host(s) need the actual host name you resolved against for TLS or other
purposes, will CURLOPT_CONNECT_TO not do what you want by telling libcurl not
to resolve the host name but instead use the IP you supply??

With either of these options, the host is not redundantly resolved and you are
in complete control of what IPs are ignored/accessed, if they are accessed
sequentially or in parallel, etc. I think this might be what you are after.
I don't see how an extension to get the full address list would help because
you'd still have to do something like the above for the rest of any addresses
you were interested in anyway.


Received on 2018-08-14