W dniu 2022-12-07 23:52, Daniel Stenberg via curl-library napisaĆ(a):
On Wed, 7 Dec 2022, Dmitry Karpov via curl-library wrote:
Exactly! Honoring exact TTLs will be a very good feature. I heard
complaints from some backend services who manipulated DNS records for
load balancing and used 20s TTL that libcurl didn't honor it and it
created performance issues. So, it will be definitely a good addition
to the library.
Sure, just a little complicated.
A primary reason the default name resolving in libcurl is still done
with getaddrinfo() and not with a third party library like c-ares is
that it is mighty hard to replicate its functionality. And
getaddrinfo() does not return TTL.
If we want to know the TTL for A and AAAA records while remaining 100%
compatible with names used all over, we need to use getaddrinfo()
*AND* do a separate lookup for the A and AAAA entries and use any
possible TTL values we get back. Double the number of DNS requests.
Not ideal.
You can also try to use res_query, which returns TTL as well. It is part
of 4.3BSD standard, so should be available on may *nix systems. Here is
example how to use it to get TTL:
https://stackoverflow.com/questions/18772674/extracting-ttl-value-of-a-dns-a-record
--
Regards
Daniel
--
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html