From 37e23f806be8665f35b83ae61440faece86e7e61 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 9 Nov 2009 18:50:20 +0000 Subject: [PATCH] Patch from Ryan Phillips: accept ipv6 addresses returned by getaddrinfo in http.c svn:r1522 --- ChangeLog | 1 + http.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f02a17c..c1a6e5ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,7 @@ Changes in 2.0.3-alpha: o Alternative queue-based timeout algorithm for programs that use a large number of timeouts with the same value. o New event_base_config option to disable the timeval cache entirely. o Make EV_PERSIST timeouts more accurate: schedule the next event based on the scheduled time of the previous event, not based on the current time. + o Allow http.c to handle cases where getaddrinfo returns an IPv6 address. Patch from Ryan Phillips. Changes in 2.0.2-alpha: diff --git a/http.c b/http.c index 8ad4523e..2d869e5f 100644 --- a/http.c +++ b/http.c @@ -3049,7 +3049,7 @@ bind_socket_ai(struct addrinfo *ai, int reuse) int serrno; /* Create listen socket */ - fd = socket(AF_INET, SOCK_STREAM, 0); + fd = socket(ai ? ai->ai_family : AF_INET, SOCK_STREAM, 0); if (fd == -1) { event_sock_warn(-1, "socket"); return (-1); @@ -3095,7 +3095,7 @@ make_addrinfo(const char *address, ev_uint16_t port) int ai_result; memset(&ai, 0, sizeof(ai)); - ai.ai_family = AF_INET; + ai.ai_family = AF_UNSPEC; ai.ai_socktype = SOCK_STREAM; ai.ai_flags = AI_PASSIVE; /* turn NULL host name into INADDR_ANY */ evutil_snprintf(strport, sizeof(strport), "%d", port); -- 2.40.0