curl_setup: disable IPv6 resolver without getaddrinfo

Also, use `CURLRES_IPV6` only for actual DNS resolution, not for IPv6
address support. This makes it possible to connect to IPv6 literals by
setting `ENABLE_IPV6` even without `getaddrinfo` support. It also fixes
the CMake build when using the synchronous resolver without
`getaddrinfo` support.

Closes https://github.com/curl/curl/pull/4662
This commit is contained in:
Marcel Raad 2019-11-26 15:06:31 +01:00
parent ab712afa8f
commit 67a08dca27
No known key found for this signature in database
GPG key ID: FE4D8BC5EE1701DD
4 changed files with 26 additions and 6 deletions

View file

@ -68,7 +68,7 @@ int main(int argc, char *argv[])
while(argc>arg) {
if(!strcmp("--version", argv[arg])) {
printf("resolve IPv4%s\n",
#ifdef ENABLE_IPV6
#if defined(CURLRES_IPV6)
"/IPv6"
#else
""
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
puts("Usage: resolve [option] <host>\n"
" --version\n"
" --ipv4"
#ifdef ENABLE_IPV6
#if defined(CURLRES_IPV6)
"\n --ipv6"
#endif
);
@ -107,7 +107,7 @@ int main(int argc, char *argv[])
atexit(win32_cleanup);
#endif
#ifdef ENABLE_IPV6
#if defined(CURLRES_IPV6)
if(use_ipv6) {
/* Check that the system has IPv6 enabled before checking the resolver */
curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);