diff options
Diffstat (limited to 'dirmngr/http.c')
-rw-r--r-- | dirmngr/http.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/dirmngr/http.c b/dirmngr/http.c index 1ba8e79d2..c5f9f8d70 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -2903,7 +2903,7 @@ connect_server (const char *server, unsigned short port, unsigned int srvcount = 0; int hostfound = 0; int anyhostaddr = 0; - int srv, connected; + int srv, connected, v4_valid, v6_valid; gpg_error_t last_err = 0; struct srventry *serverlist = NULL; @@ -2913,6 +2913,8 @@ connect_server (const char *server, unsigned short port, init_sockets (); #endif /*Windows*/ + check_inet_support (&v4_valid, &v6_valid); + /* Onion addresses require special treatment. */ if (is_onion_address (server)) { @@ -2990,9 +2992,11 @@ connect_server (const char *server, unsigned short port, for (ai = aibuf; ai && !connected; ai = ai->next) { - if (ai->family == AF_INET && (flags & HTTP_FLAG_IGNORE_IPv4)) + if (ai->family == AF_INET + && ((flags & HTTP_FLAG_IGNORE_IPv4) || !v4_valid)) continue; - if (ai->family == AF_INET6 && (flags & HTTP_FLAG_IGNORE_IPv6)) + if (ai->family == AF_INET6 + && ((flags & HTTP_FLAG_IGNORE_IPv6) || !v6_valid)) continue; if (sock != ASSUAN_INVALID_FD) |