]> granicus.if.org Git - libevent/commitdiff
Patch from Ryan Phillips: accept ipv6 addresses returned by getaddrinfo in http.c
authorNick Mathewson <nickm@torproject.org>
Mon, 9 Nov 2009 18:50:20 +0000 (18:50 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 9 Nov 2009 18:50:20 +0000 (18:50 +0000)
svn:r1522

ChangeLog
http.c

index 4f02a17ceb4be1874f7247437c8cef564a26260f..c1a6e5ec20d3ec516069565ad3757d3db5366a62 100644 (file)
--- 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 8ad4523e8a12a44b48e0bbe73f92342b3b9d3eaf..2d869e5fcd2ff8da90fca933ef4a2332c41b7a14 100644 (file)
--- 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);