[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] evhttp and ipv6
On Fri, Apr 15, 2011 at 5:41 AM, Alexey Ozeritsky <aozeritsky@xxxxxxxxx> wrote:
> HI,
>
> HTTP-client from evhttp (libevent-2.0.10-stable) does not work with
> ipv6 because it creates AF_INET socket.
> Patch that solves that problem attached.
>
This is indeed a bug, but it needs a better fix. The code you
attached will add an extra blocking name lookup to every http request
for which bind_address isn't set. (The extra lookup is bad because it
duplicates the name lookup that will happen later; having it be a
blocking lookup is bad because it's not great to have people's
programs pause while waiting for a DNS server to respond.)
Instead, I wonder if we can get away with simply not setting the fd at
all when we're not binding a socket. That way,
bufferevent_socket_connect_hostname can do the right thing and
allocate the socket later, once it knows what address family to use.
This would require some changes in the evhttp code, though, especially
at any point where we look at evcon->fd to see whether the connection
is set up or not.
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.