curl / Mailing Lists / curl-library / Single Mail

curl-library

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

From: myLC--- via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 11 Aug 2018 11:56:14 +0200

Hello, :-)

I'm new to (lib)curl. I decided that this was the most
complete network implementation, after ditching Qt for
continuous multithreading issues.

I would like to know how we can retrieve all the IP
addresses which are mapped to a host.

Assuming we have the URL
https://example.buzz/bingo_results/

and assuming further that there are 5 addresses mapped to
this hostname:
10.0.0.11, 10.0.0.12, 10.0.0.13,
fd0e:34f4:760f:5bd6:0123:4567:89ab:cdef,
fd0e:34f4:760f:5bd6:aaaa:bbbb:cccc:dddd

How would I get them from libcurl?

The "inbound" network implementation (TR) of C++ (Boost
ASIO) returns an iterator upon having resolved a hostname.
If I'm correct, the implementation chooses the IP randomly
when connecting. Likewise, it tries the entire list of IPs
before giving up. I haven't checked out libcurl's source-
code, but I'm guessing that you will do something similar.
Virtually all the functions for resolving hostnames return
all the addresses (getaddrinfo, for instance).
Therefore, at some point, libcurl must have this
information. So, how do I get that list of all addresses?
I'm inquiring, because I would hate to employ a second
engine/dispatcher for this.

Thank you very much for your help!

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