1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

dirmngr: Make use of IPv4 and IPV6 more explicit.

* common/http.c (connect_server): Handle the new flags.
* common/http.h (HTTP_FLAG_IGNORE_IPv4, HTTP_FLAG_IGNORE_IPv4): New.
* dirmngr/ks-engine-hkp.c (map_host): Add arg r_httpflags.
(make_host_part): Ditto.
(send_request): Add arg httpflags.
(ks_hkp_search, ks_hkp_get, ks_hkp_put): Handle httpflags.
This commit is contained in:
Werner Koch 2014-03-14 17:00:10 +01:00
parent d7fbefeb82
commit 59b4fb5f49
3 changed files with 47 additions and 18 deletions

View file

@ -1,6 +1,7 @@
/* http.c - HTTP protocol handler
* Copyright (C) 1999, 2001, 2002, 2003, 2004, 2006, 2009, 2010,
* 2011 Free Software Foundation, Inc.
* Copyright (C) 2014 Werner Koch
*
* This file is part of GnuPG.
*
@ -1706,8 +1707,6 @@ connect_server (const char *server, unsigned short port,
#ifdef HAVE_W32_SYSTEM
unsigned long inaddr;
#endif
/* Not currently using the flags */
(void)flags;
*r_host_not_found = 0;
#ifdef HAVE_W32_SYSTEM
@ -1790,6 +1789,11 @@ connect_server (const char *server, unsigned short port,
for (ai = res; ai && !connected; ai = ai->ai_next)
{
if (ai->ai_family == AF_INET && (flags & HTTP_FLAG_IGNORE_IPv4))
continue;
if (ai->ai_family == AF_INET6 && (flags & HTTP_FLAG_IGNORE_IPv6))
continue;
if (sock != -1)
sock_close (sock);
sock = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);