diff options
author | Werner Koch <[email protected]> | 2014-03-14 16:00:10 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-03-14 16:00:10 +0000 |
commit | 59b4fb5f4927908af06bb80ecd86adbf6e54ba14 (patch) | |
tree | 0dc9172d845c1de1124bdcbcb87ccfdd51fed529 /common/http.c | |
parent | dirmngr: Do not use brackets around legacy IP addresses. (diff) | |
download | gnupg-59b4fb5f4927908af06bb80ecd86adbf6e54ba14.tar.gz gnupg-59b4fb5f4927908af06bb80ecd86adbf6e54ba14.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | common/http.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/http.c b/common/http.c index d95a2fba9..541014153 100644 --- a/common/http.c +++ b/common/http.c @@ -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); |