On Mon, Nov 22, 2021 at 01:26:41PM +0100, Marcel via curl-library wrote: > I'm in need of a callback, that let me resolve a domain to an IP address. > > I have a modem module which communicates via AT commands with my embedded > linux device. > The only thing currently not working is resolving DNS names. > > There is a way of defining DNS names beforehand (using CURLOPT_RESOLVE), but > I don't see a way of using it for dynamic queries, e.g. during or before a > connect.
Is the problem that the name doesn't resolve at all or resolves incorrectly? If the latter, then you should be able to use the CURLOPT_OPENSOCKETFUNCTION and CURLOPT_SOCKOPTFUNCTION callbacks to substitute the right address by ignoring the supplied address and opening the socket with the right one. If the former, I would think you could just extract the host name from the URL using the curl_url API and populate the DNS cache after resolving the name yourself. There are a few boundary cases (redirects, certificate revocation checks, proxies, etc.) with this approach but the simple cases should work fine. Dan -- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
