aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'dirmngr/http.c')
-rw-r--r--dirmngr/http.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/dirmngr/http.c b/dirmngr/http.c
index 8e0701fab..c6dc077da 100644
--- a/dirmngr/http.c
+++ b/dirmngr/http.c
@@ -2908,7 +2908,7 @@ connect_server (ctrl_t ctrl, 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;
@@ -2918,6 +2918,8 @@ connect_server (ctrl_t ctrl, 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))
{
@@ -2996,9 +2998,11 @@ connect_server (ctrl_t ctrl, 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)