[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] evhttp client error handling
Azat Khuzhin wrote:
Also on which operating system did you work?
Ubuntu 10.04 LTS:
Linux chives 2.6.32-34-generic #77-Ubuntu SMP Tue Sep 13 19:39:17 UTC
2011 x86_64 GNU/Linux
But the operating system doesn't really matter. This is a general
problem with evhttp, regardless of OS.
Maybe this will be useful for you
http://instantbadger.blogspot.ru/2010/06/eafnosupport-socket-connection-issue-on.html
Sure, obviously you can sweep the problem under the carpet by only using
IPv4. That's what I'm doing now: I have a horrible little hack that
compares the hostname with "localhost" and replaces it with "127.0.0.1"
in that case.
But that does nothing to address the underlying problem that evhttp
doesn't support IPv6. Although IPv6 is still in the minority, and
adoption is slow, it's still something we ought to support. If evhttp
is IPv4-only, it is not future-proof.
On Sun, Jan 20, 2013 at 7:18 PM, Azat Khuzhin <dohardgopro@xxxxxxxxx> wrote:
But "ai" can't be NULL in "bind_socket_ai()", see
https://github.com/libevent/libevent/blob/0c2bacca43ffe452d4f5cdc4b57fd29a7795777d/http.c#L4088
Sure it can. It's explicitly called with NULL right here:
https://github.com/libevent/libevent/blob/b452a4345088dcc7e7491bcff612f9f11dfb17da/http.c#L4084
address and port are going to be NULL, because they come from
evcon->bind_address and evcon->bind_port:
https://github.com/libevent/libevent/blob/b452a4345088dcc7e7491bcff612f9f11dfb17da/http.c#L2336
and evcon->bind_address and evcon->bind_port default to NULL, and are
going to stay NULL, unless evhttp_connection_set_local_address() or
evhttp_connection_set_local_port() are called. But these wouldn't
normally be called in the client case. The example that I'm basing my
code off of doesn't call them:
http://archives.seul.org/libevent/users/Mar-2012/binGP2R6ys0C_.bin
and it doesn't make sense for the client to call them anyway. In the
client case, you want to use whichever local address will allow you to
reach the remote address. So we are once again back to our
chicken-and-egg problem, that you have to resolve the remote address
(and know whether it is IPv4 or IPv6) before you can create the socket.
It doesn't make sense any other way.
--Patrick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.