]> granicus.if.org Git - libevent/commit
http: implement new evhttp_connection_get_addr() api.
authorAzat Khuzhin <a3at.mail@gmail.com>
Tue, 1 Oct 2013 15:12:13 +0000 (19:12 +0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 14 Oct 2013 15:22:29 +0000 (11:22 -0400)
commit0c7f0405e36c45c88139189dd4c720aa0c4903f5
tree6693dd271741ea3f3b16c55e60d02ee2533729da
parent4464bd23963267615d759eb6377cf1bb13f7d47f
http: implement new evhttp_connection_get_addr() api.

Basically tcp final handshake looks like this:
    (C - client, S - server)
    ACK[C] - FIN/ACK[S] - FIN/ACK[S] - ACK [C]

However there are servers, that didn't close connection like this,
while it is still _considered_ as valid, and using libevent http layer
we can do requests to such servers.

Modified handshake:
    (C - client, S - server)
    ACK[C] - RST/ACK[S] - RST/ACK[S]

And in this case we can't extract IP address from socket, because it is
already closed, and getpeername() will return: "transport endpoint is not connected".
So we need to store address that we are connecting to, after we know it,
and that is what this patch do.

I have reproduced it, however it have some extra packages.
(I will try to fix it)
https://github.com/azat/nfq-examples/blob/master/nfqnl_rst_fin.c
http-internal.h
http.c
include/event2/http.h