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.
Sebastian Hahn [Wed, 10 Aug 2011 17:11:55 +0000 (19:11 +0200)]
Ignore deprecation warnings on OS X
Starting with Lion, Apple decided to deprecate the system openssl. We
can start requiring users to install their own openssl once OS X doesn't
ship with it anymore.
Joachim Bauch [Mon, 4 Jul 2011 15:36:14 +0000 (11:36 -0400)]
Fix bug in SSL bufferevents backed by a bev with a write high-watermarks
Original mail:
the logic that handles write watermarks in "bio_bufferevent_write"
is not working. It currently doesn't write any data if the high
watermark is *above* the amount of data to write (i.e. when there
is actually enough room available).
Ed Day [Sat, 11 Jun 2011 04:49:24 +0000 (00:49 -0400)]
Fix tinytest invocation from windows shell
Original post:
This post is in response to a posting last December on a Windows
regression fork failure ([Libevent-users] Re: Libevent 2.0.10-stable
is released by Dongsheng Song). I noticed the question was not
answered and I recently experienced the same error myself when
trying to run the Windows regression tests myself.
I checked the return status from the CreateProcess call and found it
was "file not found". This led me to look at the command-line I was
using which was .\regress in a Visual Studio 2008 command prompt
window. Windows could not find the file because it did not have the
.exe extension on the end. The code that builds the command should
be modified to ensure the extension is present.
Nick Mathewson [Wed, 8 Jun 2011 18:56:19 +0000 (14:56 -0400)]
Report kqueue ebadf, epipe, and eperm as EV_READ events
When asked to add one side of a pipe, and the other side has been
closed, kqueue on NetBSD will say EBADF; kqueue on FreeBSD will say
EPIPE, and kqueue on OpenBSD will say EPERM. So treat all of these
as EV_READ events, to give the user an opportunity to notice that
the pipe is closed.
Diagnosed by Nicholas Marriott and Dale Rahn; based on a patch by
Nicholas Marriott.
Nick Mathewson [Mon, 6 Jun 2011 19:11:28 +0000 (15:11 -0400)]
Fix incorrect results from evbuffer_search_eol(EOL_LF)
Our evbuffer_strchr() function [which was only used for
search_eol(EOL_LF) could give incorrect results if it found its answer
in the first chunk but didn't start searching from the front of the
chunk.
Also, this patch adds unit tests for evbuffer_search_eol, particularly
in those cases that evbuffer_readln() tests didn't exercise.
Nick Mathewson [Sat, 28 May 2011 03:28:17 +0000 (23:28 -0400)]
Make the new http_connect_fail_test use a multicast addr, not broadcast
Turns out that FreeBSD does _not_ give a ENETUNREACH error when
told to make a TCP socket to 255.255.255.255, but it is quite happy
to do so for 239.10.20.30. So that's what we'll do.
Peter Rosin [Wed, 25 May 2011 09:04:43 +0000 (11:04 +0200)]
Fix winsock2.h #include issues with MSVC
Define WIN32_LEAN_AND_MEAN, so that windows.h does not bring in
winsock.h which in turn makes it impossible to #include <winsock2.h>
(at least with MSVC)
Peter Rosin [Wed, 25 May 2011 08:54:06 +0000 (10:54 +0200)]
Link with -lshell32 and -ladvapi32 on Win32.
SHGetSpecialFolderPath is in Shell32.dll and the RegOpenKey (et al) and
CryptGenRandom (et al) functions are in -ladvapi32.dll. MinGW is "nice"
and brings those in automatically, but specify them explicitly for
other tool chains.
Mansour Moufid [Mon, 23 May 2011 22:01:24 +0000 (18:01 -0400)]
Prevent size_t overflow in evhttp_htmlescape.
Modified the `html_replace' function so that it returns the length of
the replacement string instead of the string itself. This is used to
easily check for overflows of the `new_size' variable in the first for
loop of the `evhttp_htmlescape' function, and thus potential out of
bounds writes in the second for loop (if an overflow occurs in
new_size, then new_size < old_size). Also check that new_size + 1
doesn't overflow in mm_malloc(new_size + 1).
Removed the `scratch_space' variable from the `evhttp_htmlescape'
function since it wasn't actually used; also removed the `buf'
variable from the `evhttp_htmlescape' function since it was only used
by `scratch_space'.
"I'm not sure if you'll like my use of the limited broadcast address
for simulating an ENETUNREACH error with a TCP connection, but it's
the best that I could think of. Basically, we want to trigger a
non-EINPROGRESS error in evutil_socket_connect() immediately at the
connect() in order to bring about the assertion in the
evhttp_connection_fail() error handling code."
Patch in question:
- Fix the case when failed evhttp_make_request() leaved request in the queue.
- http://levent.git.sourceforge.net/git/gitweb.cgi?p=levent/libevent;a=commit;h=0d6622e
The above patch introduces a failing assertion in
evhttp_connection_fail(). This happens because the patch defers the
assignment of the outstanding request to the evcon->requests list,
while evhttp_connection_fail() assumes that the request lies in the
list.
One scenario in which this can happen is when the request list is
empty and a connection is made to an unreachable host. The assertion
will then fail after bufferevent_socket_connect() errors out (with
ENETUNREACH in my case).
Sebastian Hahn [Thu, 5 May 2011 16:02:42 +0000 (18:02 +0200)]
Fix a compile warning with zlib 1.2.4 and 1.2.5
I took this fix from Tor (commit 1a52e39c22d5, author Nick Mathewson,
Copyright (c) 2007-2011, The Tor Project, Inc.) and adapted it slightly
for libevent.
Nick Mathewson [Tue, 3 May 2011 17:54:57 +0000 (13:54 -0400)]
Fix a warn-and-fail bug in kqueue by providing kevent() room to report errors
Apparently, kevent fails gracefully if there is not enough space in its
output events array to report every _event_... but it just dies and returns
-1 if there is not enough space to report every _error_.
There are a couple of possible fixes here. One would to handle -1
returns from kevent better by re-growing the array and retrying... but
that seems a little error prone. Instead, I'm just going to say that
the events array must be large enough to handle all the errors.
This patch also adds a unit test designed to make sure that our
many-events-out code works even if not all the events are added at
once.
Nick Mathewson [Wed, 27 Apr 2011 03:42:01 +0000 (23:42 -0400)]
Fix clang warning when resetting connection
This was a regression on 2.0.10-stable: clang was warning about
values that were unused (because event_debug wasn't using them unless
USE_DEBUG was defined). Found by Sebastian Hahn.