Azat Khuzhin [Tue, 1 Oct 2013 15:12:13 +0000 (19:12 +0400)]
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.
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
Ross Lagerwall [Sun, 15 Sep 2013 19:48:15 +0000 (21:48 +0200)]
rpcgen: Generate regress.gen.[c,h] in build rather than src dir
Currently an out-of-tree build will either write to the src dir or reuse
the existing regress.gen.[c,h]. But if building from a read-only git
tree (or if the git dir is cleaned), these files will not exist and the
build fails. So write the files to the build dir. If the system does
not have python, the regress.gen.[c,h] will be used from the src dir if
they exist.
The evhttp_send_reply method invokes evhttp_write_buffer with a
callback that may release the underlying request object and
bufferevent upon completion. This cleanup callback is invoked by the
underlying bufferevent's write callback. Improperly enabling write
events before referencing the bufferevent could lead to use after free
and memory corruption.
Azat Khuzhin [Tue, 13 Aug 2013 14:19:50 +0000 (18:19 +0400)]
sample: drop uri_root from base_url in http-server.
By default there is "0.0.0.0", and this address will work only from
the same machine, and besides there is no need in uri_root in base_url,
because it will be added automatically by browser.
Nick Mathewson [Tue, 6 Aug 2013 23:06:58 +0000 (19:06 -0400)]
Add some assertions to please coverity.
In event_process_active_single_queue, EVLIST_INIT must be set on any
event that uses one of the event-only closures, and so "ev" will be
set in those cases. But coverity's worried here (CIDs numerous). So
instead, just add the assertions that should make it happy.
Maxime Henrion [Wed, 31 Jul 2013 15:02:07 +0000 (15:02 +0000)]
Add checks for evhttp_connection_get_server() in unit tests.
They validate that this function behave as expected; that is, it returns
NULL for outgoing connections, and returns the HTTP server object that
received the connection for incoming ones.
Azat Khuzhin [Fri, 10 May 2013 23:53:11 +0000 (03:53 +0400)]
Fix SEGFAULT after evdns_base_resume if no nameservers installed.
If there is no nameservers installed, using
evdns_base_nameserver_ip_add(), than evdns_base_resume() will SEGFAULT,
because of NULL dereference in evdns_requests_pump_waiting_queue()
Maxime Henrion [Thu, 16 May 2013 16:38:39 +0000 (16:38 +0000)]
If evsel->del() fails, don't leave the evmap in an inconsistent state.
This fixes assertion failures in cases where epoll() fails with EBADF
-- the root cause for which is as of yet unknown. It seems something
(OpenSSL?) is closing the file descriptor under our feet.
Azat Khuzhin [Mon, 13 May 2013 19:50:30 +0000 (19:50 +0000)]
Fix dns/leak_resume_send_err test.
Because we don't cancel request,
and want our callback to recieve DNS_ERR_SHUTDOWN,
we use deferred callback, and there was
- one extra malloc(),
@see reply_schedule_callback()
- and one missing free
@see request_finished() (req->handle->pending_cb = 1)
than we don't need to count in testleak_cleanup()
So just decrement allocated_chunks to 2,
like we already take care about it.
Azat Khuzhin [Fri, 10 May 2013 23:53:11 +0000 (03:53 +0400)]
Fix SEGFAULT after evdns_base_resume if no nameservers installed.
If there is no nameservers installed, using
evdns_base_nameserver_ip_add(), than evdns_base_resume() will SEGFAULT,
because of NULL dereference in evdns_requests_pump_waiting_queue()