aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common/http.c8
-rw-r--r--common/http.h10
2 files changed, 12 insertions, 6 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);
diff --git a/common/http.h b/common/http.h
index bea9f07f1..224128b94 100644
--- a/common/http.h
+++ b/common/http.h
@@ -74,10 +74,12 @@ http_req_t;
/* We put the flag values into an enum, so that gdb can display them. */
enum
{
- HTTP_FLAG_TRY_PROXY = 1,
- HTTP_FLAG_SHUTDOWN = 2,
- HTTP_FLAG_LOG_RESP = 8,
- HTTP_FLAG_IGNORE_CL = 32
+ HTTP_FLAG_TRY_PROXY = 1, /* Try to use a proxy. */
+ HTTP_FLAG_SHUTDOWN = 2, /* Close sending end after the request. */
+ HTTP_FLAG_LOG_RESP = 8, /* Log the server respone. */
+ HTTP_FLAG_IGNORE_CL = 32, /* Ignore content-length. */
+ HTTP_FLAG_IGNORE_IPv4 = 64, /* Do not use IPv4. */
+ HTTP_FLAG_IGNORE_IPv6 = 128 /* Do not use IPv6. */
};
struct http_context_s;