Nick Mathewson [Fri, 10 Feb 2012 22:29:53 +0000 (17:29 -0500)]
Update copyright notices to 2012
Nick Mathewson [Fri, 10 Feb 2012 21:49:05 +0000 (16:49 -0500)]
Bump version to 2.0.17-stable
Nick Mathewson [Fri, 10 Feb 2012 16:24:51 +0000 (11:24 -0500)]
In the kqueue backend, do not report EBADF as an EV_READ
We were doing this because of (correct) reports that NetBSD gives an
EBADF when you try to add the write side of a pipe for which the
read side has been closed. But on most kqueue platforms, that
doesn't happen, and on *all* kqueue platforms, reporting a
nonexistent fd (which we usually have if we have seen EBADF) as
readable tends to give programs a case of the vapors.
Nicholas Marriott wrote the original patch here; I did the comment
fixes.
Nick Mathewson [Thu, 9 Feb 2012 20:07:19 +0000 (15:07 -0500)]
Avoid crash when freeing event_iocp and using event_set_mem_functions
There was a calloc that needed to be an mm_calloc.
Reported by "fffvvvzz" on sourceforge. Ticket
3486114
Nick Mathewson [Tue, 7 Feb 2012 02:18:25 +0000 (21:18 -0500)]
Bring the changelog up to date
Nick Mathewson [Mon, 6 Feb 2012 17:24:49 +0000 (12:24 -0500)]
Loop on filtering SSL reads until we are blocked or exhausted.
This is not a perfect fix, but it's much much better than the
current buggy behavior, which could lead to filtering SSL
connections that just stopped reading.
Based on ideas by Maseeb Abdul Qadir and Mark Ellzey.
Greg Hewgill [Sun, 20 Nov 2011 20:41:55 +0000 (09:41 +1300)]
Use C-style comments in C source files (for compatibility with compilers such as xlc on AIX).
Nick Mathewson [Wed, 1 Feb 2012 19:56:43 +0000 (14:56 -0500)]
evdns: fix a bug in circular-queue implementation
found by Wang Qin
Nick Mathewson [Thu, 26 Jan 2012 20:04:24 +0000 (15:04 -0500)]
Better workaround for Linux 3.2 edge-triggered epoll bug
On further investigation, it appears that this problem is limited to
AF_UNIX sockets, so let's just do the test on AF_INET sockets.
Nate R [Tue, 24 Jan 2012 22:15:50 +0000 (17:15 -0500)]
Do a memberwise comparison of threading function tables
Doing a memcmp risks comparing uninitialized padding bytes at the
end of the structure.
Nick Mathewson [Tue, 24 Jan 2012 20:29:39 +0000 (15:29 -0500)]
Make event_base integrity check work on windows
Nick Mathewson [Tue, 24 Jan 2012 20:09:04 +0000 (15:09 -0500)]
Start writing a changelog for 2.0.17-stable
Nick Mathewson [Tue, 24 Jan 2012 16:16:26 +0000 (11:16 -0500)]
Oops:remove an accidentally committed "sleep(1)" in a unit test
Nick Mathewson [Tue, 24 Jan 2012 16:04:19 +0000 (11:04 -0500)]
Workaround in the unit tests for an apparent epoll bug in Linux 3.2
Nick Mathewson [Mon, 23 Jan 2012 23:15:44 +0000 (18:15 -0500)]
Fix a fd leak in event_reinit()
We were supposed to be closing the ev_signal_pair sockets.
Nick Mathewson [Mon, 23 Jan 2012 22:59:16 +0000 (17:59 -0500)]
Fix a list corruption bug when using event_reinit() with signals present
While re-adding all the events, event_reinit() could add a signal
event, which could then cause evsig_add() to add the
base->sig.ev_signal event. Later on its merry path through
base->eventqueue, event_reinit() would find that same event and give
it to event_io_add a second time. This would make the ev_io_next
list for that fd become circular. Ouch!
Nick Mathewson [Mon, 23 Jan 2012 22:43:35 +0000 (17:43 -0500)]
Check event_base correctness at end of each unit test
Nick Mathewson [Sat, 21 Jan 2012 17:55:15 +0000 (12:55 -0500)]
Add function to check referential integrity of an event_base
Catalin Patulea [Tue, 10 Jan 2012 23:33:58 +0000 (18:33 -0500)]
Force strict validation of HTTP version in response.
This sometimes accepted invalid versions like 'ICY' (n = 0, major = undefined, sometimes > 1).
Nick Mathewson [Mon, 16 Jan 2012 19:45:31 +0000 (14:45 -0500)]
Suppress a gcc warning from ignoring fwrite return in http-sample.c
Found by Steve Snyder
Nick Mathewson [Mon, 9 Jan 2012 21:44:53 +0000 (16:44 -0500)]
Fix a race condition in the dns/bufferevent_connect_hostname test.
As originally written, the test would only pass if the accept()
callbacks for the evconnlistener were all invoked before the last of
the CONNECTED/ERROR callbacks for the connecting/resolving bufferevent
had its call to event_base_loopexit() complete. But this was only
accidentally true in 2.0, and might not be true at all in 2.1 where
we schedule event_base_once() callbacks more aggressively.
Found by Sebastian Hahn.
Nick Mathewson [Mon, 9 Jan 2012 16:49:41 +0000 (11:49 -0500)]
Make evconnlistener work around bug in older Linux when getting nmapped
Older Linuxes sometimes respond to some nmap probes by having accept()
return a success but with socklen 0. That can lead to confusing behavior
when you go to process the sockaddr.
Nick Mathewson [Mon, 9 Jan 2012 16:33:38 +0000 (11:33 -0500)]
Remove bogus casts of socket to int before calling ev_callback
This should make 64-bit windows act better.
Found by Mark Heily.
Arno Bakker [Wed, 14 Dec 2011 21:17:19 +0000 (16:17 -0500)]
Backport evhttp_connection_get_bufferevent to Libevent 2.0
Backport by Arno Bakker; original implementation in
8d3a8500f4
Nick Mathewson [Thu, 8 Dec 2011 19:36:32 +0000 (14:36 -0500)]
Slightly clarify evbuffer_peek documentation
Zack Weinberg [Thu, 8 Dec 2011 19:30:20 +0000 (14:30 -0500)]
Fix behavior of evbuffer_peek(buf,-1,NULL,NULL,0)
(Patch altered by nickm to not affect the behavior of
evbuffer_peek(buf,-1,NULL,vec,n_vec).)
Mike Frysinger [Thu, 8 Dec 2011 16:39:48 +0000 (11:39 -0500)]
check for sysctl before we use it
Not all C libraries under Linux support the sysctl() func.
Colin Watt [Tue, 6 Dec 2011 18:35:54 +0000 (13:35 -0500)]
Fix a silly compilation error with the sun compiler
Apparently, other compilers were allowing "return free(x)" in a
function returning void.
Nick Mathewson [Mon, 5 Dec 2011 20:02:27 +0000 (15:02 -0500)]
Be absolutely sure to clear pncalls before leaving event_signal_closure
I thought we'd fixed the cases where this could come up, but
apparently having an event_base_break() happen while processing
signal events could get us in trouble.
Found by Remi Gacogne. Sourceforge issue
3451433 .
Nick Mathewson [Fri, 18 Nov 2011 20:34:37 +0000 (15:34 -0500)]
Increment version to 2.0.16-stable-dev
Nick Mathewson [Fri, 18 Nov 2011 20:27:06 +0000 (15:27 -0500)]
Increment version to 2.0.16-stable
Nick Mathewson [Fri, 18 Nov 2011 20:14:50 +0000 (15:14 -0500)]
Revise 2.0.16-stable changelog
Nick Mathewson [Thu, 17 Nov 2011 22:42:45 +0000 (17:42 -0500)]
add comment to new consider_reading code
Mark Ellzey [Thu, 17 Nov 2011 16:59:41 +0000 (11:59 -0500)]
Avoid spinning on OpenSSL reads
Previously, if some sender were generating data to read on an
OpenSSL connection as fast as we could process it, we could easily
wind up looping on an openssl do_read operation without ever
considering other sockets.
The difference between this and the original method in
consider_reading() is that it only loops for a single completed
*frame* instead of looping until fd is drained or an error condition
was triggered.
{Patch split out by nickm}
Nick Mathewson [Thu, 17 Nov 2011 16:54:07 +0000 (11:54 -0500)]
Move SSL rate-limit enforcement into bytes_to_read()
Mark Ellzey [Thu, 17 Nov 2011 16:45:49 +0000 (11:45 -0500)]
Refactor amount-to-read calculations in buffervent_ssl consider_reading()
Split up consider_reading()'s conditional checks into another function
can_read() for simplicity sake.
{Split into a separate patch by nickm}
Nick Mathewson [Tue, 15 Nov 2011 23:34:24 +0000 (18:34 -0500)]
Revert "Avoid potential SSL read spinlocks"
This reverts commit
fc52dbac87f4937f8306759506d6a2ad15ca244c.
Nick Mathewson [Tue, 15 Nov 2011 23:33:50 +0000 (18:33 -0500)]
Revert "openssl bufferevent has the same issue with writing as prior commit."
This reverts commit
7353663eb7c0b2a1caaaa5acd818515f156cf2ca.
Nick Mathewson [Tue, 15 Nov 2011 22:22:12 +0000 (17:22 -0500)]
Add new entries to changelog, new credits to README
Nick Mathewson [Tue, 15 Nov 2011 22:11:42 +0000 (17:11 -0500)]
Fix DNS memleak checks when running with malloc-replacement/debugging disabled
Nick Mathewson [Mon, 14 Nov 2011 22:33:02 +0000 (17:33 -0500)]
Don't try to make notifiable event_base when no threading fns are configured
Nick Mathewson [Mon, 14 Nov 2011 22:32:22 +0000 (17:32 -0500)]
Warn when unable to construct base because of failing make_base_notifiable
Mark Ellzey [Mon, 14 Nov 2011 15:57:15 +0000 (10:57 -0500)]
openssl bufferevent has the same issue with writing as prior commit.
Mark Ellzey [Mon, 14 Nov 2011 15:24:07 +0000 (10:24 -0500)]
Avoid potential SSL read spinlocks
OpenSSL bufferevents with deferred callbacks enabled under high load will
spinlock in the function consider_reading(). This loop continues until all
data has been read.
Because of this condition; openssl bufferevents will never return back into
event_base_loop() until SSL_read has determined data is no longer ready.
As of yet I have not found a reason why this while loop exists, so this patch
just swaps out while for if.
If needed I can write same code which would trigger this effect; optionally
libevhtp has a test.c program which can be run with the following flags:
./test -s <keyfile.pem>
curl -vvvv -k -d@<HUGE_ASS_FILE> https://127.0.0.1:8081/
The return data will include the number of times the readcb got data and the
length of that read.
Without this patch, you are likely to see a small amount of "bytes read....",
otherwise the "bytes read..." return data should show much more reasonable
numbers.
Gisle Vanem [Wed, 9 Nov 2011 05:17:56 +0000 (00:17 -0500)]
Improve win32 behavior of dns-sample.c codex
Mansour Moufid [Thu, 3 Nov 2011 15:43:49 +0000 (11:43 -0400)]
Fix typo in whatsnew-2.0.txt
Nick Mathewson [Wed, 2 Nov 2011 20:09:15 +0000 (16:09 -0400)]
Fix an evbuffer crash in evbuffer_remove_buffer()
Found by Greg Hazel.
Greg Hazel [Wed, 2 Nov 2011 22:19:05 +0000 (15:19 -0700)]
improve test to remove at least one buffer from src
Greg Hazel [Tue, 1 Nov 2011 20:44:40 +0000 (13:44 -0700)]
unit test for remove_buffer bug
Nick Mathewson [Mon, 31 Oct 2011 02:32:18 +0000 (22:32 -0400)]
Fix compile warning from saying event2/*.h inside a comment
Based on a patch by Adrian Chadd
Jamie Iles [Wed, 26 Oct 2011 12:24:30 +0000 (13:24 +0100)]
epoll: close fd on alloc fail at initialization
If the memory allocations fail then we free any other allocated
structures but don't close the file descriptor resulting in an leak of
fd's.
Nick Mathewson [Mon, 24 Oct 2011 17:18:09 +0000 (13:18 -0400)]
Update copyright dates to 2011.
Nick Mathewson [Thu, 20 Oct 2011 02:59:47 +0000 (22:59 -0400)]
Add note about evhttp_send_reply_end to its doxygen
Leonid Evdokimov [Wed, 19 Oct 2011 13:44:17 +0000 (17:44 +0400)]
More detailed message in case of libevent self-debugging failure.
Nick Mathewson [Thu, 20 Oct 2011 02:41:11 +0000 (22:41 -0400)]
Style and comment tweaks for dns/leak* tests
Leonid Evdokimov [Tue, 18 Oct 2011 13:49:40 +0000 (17:49 +0400)]
Leonid Evdokimov [Wed, 19 Oct 2011 18:38:37 +0000 (22:38 +0400)]
Empty DNS reply with OK status is another way to say NODATA.
Sometimes DNS reply has nothing but query section. It does not look like
error, so it should be treated as NODATA with TTL=0 as soon as there is
no SOA record to deduce negative TTL from.
Leonid Evdokimov [Wed, 19 Oct 2011 18:36:12 +0000 (22:36 +0400)]
Tests for
94fba5b and
f72e8f6
Nick Mathewson [Wed, 12 Oct 2011 05:00:23 +0000 (01:00 -0400)]
Bump version to 2.0.15-stable-dev
Nick Mathewson [Wed, 12 Oct 2011 04:39:22 +0000 (00:39 -0400)]
Credit a patch from a one-named user
Nick Mathewson [Wed, 12 Oct 2011 04:22:17 +0000 (00:22 -0400)]
Increment version to 2.0.15-stable
Nick Mathewson [Wed, 12 Oct 2011 04:16:12 +0000 (00:16 -0400)]
Add changelog for 2.0.15-stable
Greg Hazel [Mon, 10 Oct 2011 15:24:43 +0000 (08:24 -0700)]
refer to non-deprecated evdns functions in comments
Nick Mathewson [Thu, 6 Oct 2011 19:11:50 +0000 (15:11 -0400)]
Merge remote-tracking branch 'github/20_addfile_ssl' into patches-2.0
Nick Mathewson [Mon, 3 Oct 2011 16:49:02 +0000 (12:49 -0400)]
Fix some "value never used" warnings with gcc 4.6.1
Nick Mathewson [Mon, 3 Oct 2011 16:45:36 +0000 (12:45 -0400)]
Make write-checking fixes use tt_fail_perror
Mark Ellzey [Tue, 12 Jul 2011 17:05:36 +0000 (13:05 -0400)]
Fixed compiler warnings for unchecked read/write calls.
Nick Mathewson [Thu, 29 Sep 2011 13:30:04 +0000 (09:30 -0400)]
Prefer mmap to sendfile unless a DRAINS_TO_FD flag is set. Allows add_file to work with SSL.
The sendfile() implementation for evbuffer_add_file is potentially more
efficient, but it has a problem: you can only use it to send bytes over
a socket using sendfile(). If you are writing bytes via SSL_send() or
via a filter, or if you need to be able to inspect your buffer, it
doesn't work.
As an easy fix, this patch disables the sendfile-based implementation of
evbuffer_add_file on an evbuffer unless the user sets a new
EVBUFFER_FLAG_DRAINS_TO_FD flag on that evbuffer, indicating that the
evbuffer will not be inspected, but only written out via
evbuffer_write(), evbuffer_write_atmost(), or drained with stuff like
evbuffer_drain() or evbuffer_add_buffer(). This flag is off by
default, except for evbuffers used for output on bufferevent_socket.
In the future, it could be interesting to make a best-effort file
segment implementation that tries to send via sendfile, but mmaps on
demand. That's too much complexity for a stable release series, though.
Nick Mathewson [Wed, 28 Sep 2011 13:22:17 +0000 (09:22 -0400)]
Make evbuffer callbacks get the right n_added value after evbuffer_add
Patch from Alex.
Nick Mathewson [Mon, 26 Sep 2011 15:07:58 +0000 (11:07 -0400)]
Merge branch '20_loopbreak_in_signal' into patches-2.0
Nick Mathewson [Sun, 25 Sep 2011 11:39:00 +0000 (07:39 -0400)]
Use _SOURCES, not _sources, in sample/Makefile.am
Found by Adrian Chadd
Sergey Avseyev [Thu, 15 Sep 2011 10:06:38 +0000 (13:06 +0300)]
le-proxy and regress depend on openssl directly
Leonid Evdokimov [Wed, 10 Aug 2011 11:58:47 +0000 (15:58 +0400)]
Add DNS_ERR_NODATA error code to handle empty replies.
Leonid Evdokimov [Wed, 10 Aug 2011 11:58:19 +0000 (15:58 +0400)]
Fix docstring in dns.h
Nick Mathewson [Sat, 10 Sep 2011 00:53:30 +0000 (20:53 -0400)]
When a signal callback is activated to run multiple times, allow event_base_loopbreak to work even before they all have run.
Found by Abilio Marques.
Leonid Evdokimov [Tue, 30 Aug 2011 20:56:45 +0000 (00:56 +0400)]
DNS: add ttl for negative answers using RFC 2308 idea.
Nick Mathewson [Wed, 31 Aug 2011 15:25:11 +0000 (11:25 -0400)]
Increment version to 2.0.14-stable-dev
Nick Mathewson [Wed, 31 Aug 2011 04:23:20 +0000 (00:23 -0400)]
Credit new contributors for 2.0.14-stable
Nick Mathewson [Wed, 31 Aug 2011 02:35:51 +0000 (22:35 -0400)]
Pick a release date for the changelog
Nick Mathewson [Wed, 31 Aug 2011 02:28:02 +0000 (22:28 -0400)]
Bump version to 2.0.14-stable
Joachim Bauch [Mon, 29 Aug 2011 21:39:26 +0000 (23:39 +0200)]
clear read watermark on underlying bufferevent when creating filtering bev to fix potentially failing fragmented ssl handshakes
Nick Mathewson [Mon, 29 Aug 2011 17:40:03 +0000 (13:40 -0400)]
Checkpoint changelog entries for 2.0.14-stable
Nick Mathewson [Thu, 25 Aug 2011 01:39:28 +0000 (21:39 -0400)]
Correctly terminate IO on an async bufferevent on bufferevent_free
Nick Mathewson [Wed, 24 Aug 2011 22:42:12 +0000 (18:42 -0400)]
Have test-ratelim.c support IOCP
Nick Mathewson [Wed, 24 Aug 2011 22:41:35 +0000 (18:41 -0400)]
Make IOCP rate-limiting group support stricter and less surprising.
Previously, we wouldn't decrement read/write buckets because of IOCP
reads and writes until those reads and writes were complete. That's
not so bad on the per-connection front. But for group limits, the
old approach makes us launch a huge amount of reads and writes
whenever the group limit becomes positive, and then decrement the
limit to a hugely negative number as they complete.
With this patch, we decrement our read buckets whenever we launch an
IOCP read or write, based on the maximum that tried to read or
write. Later, when the operations finish, we re-increment the
bucket based on the portion of the request that couldn't finish.
Nick Mathewson [Wed, 24 Aug 2011 22:42:00 +0000 (18:42 -0400)]
Support negative arguments to _bufferevent_decrement_(read/write)_buckets()
Nick Mathewson [Sun, 28 Aug 2011 18:03:10 +0000 (14:03 -0400)]
Cleanup on
7c11e51e1ab: fix strtol usage
Nick Mathewson [Sun, 28 Aug 2011 18:02:40 +0000 (14:02 -0400)]
Cleanup on
7c11e51e1ab: restore c90 declaration compliance
Harlan Stenn [Sat, 27 Aug 2011 09:48:11 +0000 (05:48 -0400)]
Clean up some problems identified by Coverity.
Nick Mathewson [Wed, 24 Aug 2011 20:17:05 +0000 (16:17 -0400)]
Make rate limiting work with common_timeout logic
Nick Mathewson [Thu, 18 Aug 2011 19:09:44 +0000 (15:09 -0400)]
Merge branch '20_iocp_fixes' into patches-2.0
Nick Mathewson [Thu, 18 Aug 2011 16:35:27 +0000 (12:35 -0400)]
Make overlapped reads result in evbuffer callbacks getting invoked
Nick Mathewson [Thu, 18 Aug 2011 15:41:55 +0000 (11:41 -0400)]
IOCP: don't launch reads or writes on an unconnected socket
Dave Hart [Mon, 15 Aug 2011 18:40:32 +0000 (14:40 -0400)]
Try to fix 'make distcheck' errors when building out-of-tree
Nick Mathewson [Thu, 18 Aug 2011 01:47:19 +0000 (21:47 -0400)]
Merge branch '20_low_ratelim' into patches-2.0
Michael Herf [Mon, 15 Aug 2011 17:39:10 +0000 (13:39 -0400)]
Solaris sendfile: correctly detect amount of data sent
Original message:
Solaris sendfile seems to fail when sending moderately large (<1GB)
files. Not a 32/64 problem, but a buffer problem.
Anyone else ever try this? It is definitely broken in http-server.c.
It seems to be broken in the following way:
When sendfile sends partial data (EAGAIN, would block), "res" is
always -1, rather than the amount sent.
Here's a patch that reads from the "offset" pointer instead to
discover what was sent. This seems to work:
Leonid Evdokimov [Wed, 10 Aug 2011 23:24:06 +0000 (03:24 +0400)]
Fix request_finished memory leak with debugging turned on.
Leonid Evdokimov [Wed, 10 Aug 2011 23:10:08 +0000 (03:10 +0400)]
Fix evsig_dealloc memory leak with debugging turned on.
Leonid Evdokimov [Wed, 10 Aug 2011 23:06:07 +0000 (03:06 +0400)]
Another docstring fix.
Nick Mathewson [Thu, 11 Aug 2011 19:15:17 +0000 (15:15 -0400)]
Fix handling of group rate limits under 64 bytes of burst
The "min_share" logic, which was designed to prevent piles of
extremely small writes when running up against a group rate limit,
could lead to confusing behavior if you ever set a min_share less
than your burst rate. If that happened, then as soon as your group
rate limit was exhausted, you'd stop reading/writing, and never
start again, since the amount readable/writeable would never
actually hit min_share.
We now cap min_share at the rate per tick.
Found by George Kadianakis