4 ms·
I'm the author of the GitHub issue that the blog links to, and I'd like to thank Stefan for quickly acknowledging the problem and addressing the issue! I try to
by blaz0 1y ago
I'm the author of the GitHub issue that the blog links to, and I'd like to thank Stefan for quickly acknowledging the problem and addressing the issue! I try to keep one of our internal applications up to date with the latest libcurl version within a day or two of a release, so we sometimes hit fresh problems while running our battery of tests.
Ironically, our application has also struggled with blocking DNS resolution in the past, so I appreciate the discussion here. In case anyone is interested, here is a quick reference of the different asynchronous DNS resolution methods that you can use in a native code application for some of the most popular platforms:
- Windows/Xbox: GetAddrInfoExW / GetAddrInfoExCancel
- macOS/iOS: CFHostStartInfoResolution / CFHostCancelInfoResolution
- Linux (glibc): getaddrinfo_a / gai_cancel
- Android: android.net.DnsResolver.query (requires the use of JNI)
- PS5: proprietary DNS resolver API
- somat 1y agoIf we are doing a survey. I found a few more. It feels like we need to get everyone together in a room and say "we will let you out when you decide on a standard non-blocking address lookup" What a mess. - OpenBSD: getaddrinfo_async / asr_abort https://man.openbsd.org/asr_run - FreeBSD: dnsres_getaddrinfo / found no way to abort https://man.freebsd.org/cgi/man.cgi?query=dnsres
- jnwatson 1y agoAs the article mentions, why not just delegate it to a library dedicated to the solution? c-ares is a solid, well-maintained library.
- JosifA 1y agoUnfortunately, c-ares is not problem-free on all platforms. On iOS, its use triggers a local network access popup (it tries to reach your DNS server, which is often on your LAN). If a user denies acess, your app will simply not work. On Android, it's not compatible with some VPN apps. Those apps are to blame, but your users are going to blame you not them. So, at my previous company we ended up building libcurl with a threaded DNS resolver on both iOS and Android.
- wolletd 1y agoThis information about `getaddrinfo_a` should probably also be in the Github issue?