2387435-http-ipv6.patch 1011 B

12345678910111213141516171819202122232425
  1. commit e6bd3e8b0ad99208c704b8e999dee9fd60267214
  2. author: dldmitry
  3. date: 2016-07-04T12:23:34+03:00
  4. revision: 2387435
  5. libevent: use ipv6 if possible in http client
  6. __BYPASS_CHECKS__
  7. --- libevent/bufferevent_sock.c (index)
  8. +++ libevent/bufferevent_sock.c (working tree)
  9. @@ -482,8 +482,12 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai,
  10. }
  11. /* XXX use the other addrinfos? */
  12. - bufferevent_socket_set_conn_address_(bev, ai->ai_addr, (int)ai->ai_addrlen);
  13. - r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen);
  14. + struct evutil_addrinfo *found_ai = ai;
  15. + while (found_ai->ai_addr->sa_family != AF_INET6 && found_ai->ai_next != NULL) {
  16. + found_ai = found_ai->ai_next;
  17. + }
  18. + bufferevent_socket_set_conn_address_(bev, found_ai->ai_addr, (int)found_ai->ai_addrlen);
  19. + r = bufferevent_socket_connect(bev, found_ai->ai_addr, (int)found_ai->ai_addrlen);
  20. if (r < 0)
  21. bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
  22. bufferevent_decref_and_unlock_(bev);