Nick Mathewson [Wed, 1 Jun 2011 17:48:02 +0000 (13:48 -0400)]
cygwin: make it possible to build DLLs
Patch from Brian Koehmstedt
Nick Mathewson [Mon, 30 May 2011 16:06:36 +0000 (12:06 -0400)]
Merge branch '20_select_nfds' into patches-2.0
Nick Mathewson [Mon, 30 May 2011 15:53:19 +0000 (11:53 -0400)]
Fix a fencepost bug in the select backend
This bug would sometimes lead us to looking one bit off the end of
the fdset arrays, and trying to activate a (nonexistent) event if
that bit was set.
Found by Harlann Stenn. Fixes a test failure on OpenSolaris.
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.
Found by Robert Ransom and Dave Hart.
Peter Rosin [Thu, 26 May 2011 08:10:57 +0000 (10:10 +0200)]
InitializeCriticalSectionAndSpinCount requires _WIN32_WINNT >= 0x0403.
Nick Mathewson [Fri, 27 May 2011 19:08:25 +0000 (15:08 -0400)]
Fix a couple of signed/unsigned warnings in http.c
Nick Mathewson [Fri, 27 May 2011 18:57:55 +0000 (14:57 -0400)]
Disable main/many_events_slow_add with evport backend
In 2.0 and earlier, evport only reports up to 8 events at a time, which
confuses this test badly.
Nick Mathewson [Thu, 26 May 2011 21:43:17 +0000 (17:43 -0400)]
Fix compilation.
Nick Mathewson [Thu, 26 May 2011 21:34:15 +0000 (17:34 -0400)]
Merge branch 'intcmp_overflow_fixes' into patches-2.0
Mark Ellzey [Wed, 25 May 2011 22:52:07 +0000 (18:52 -0400)]
updated EV_S(s)IZE definitions
Mark Ellzey [Wed, 25 May 2011 18:31:09 +0000 (14:31 -0400)]
Added overflow checks in evhttp_read_body and evhttp_get_body
Mark Ellzey [Wed, 25 May 2011 16:58:59 +0000 (12:58 -0400)]
Added several checks for under/overflow conditions in evhttp_handle_chunked_read
Sebastian Hahn [Thu, 26 May 2011 00:05:54 +0000 (02:05 +0200)]
Always use evutil_snprintf, even if OS provides it
In test/tinytest_local.h we can't redefine snprintf if the OS has it
defined already.
Peter Rosin [Wed, 25 May 2011 13:11:01 +0000 (15:11 +0200)]
Use evutil_gettimeofday instead of relying on the system gettimeofday.
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 22:03:38 +0000 (00:03 +0200)]
Make sure TINYTEST_LOCAL is defined when building tinytest.c
Peter Rosin [Wed, 25 May 2011 08:58:48 +0000 (10:58 +0200)]
unistd.h and sys/time.h might not exist.
Peter Rosin [Wed, 25 May 2011 08:57:16 +0000 (10:57 +0200)]
MSVC does not provide S_ISDIR, so provide it manually.
Peter Rosin [Wed, 25 May 2011 08:56:32 +0000 (10:56 +0200)]
Bring in the compile script from automake, if needed.
Peter Rosin [Wed, 25 May 2011 08:55:41 +0000 (10:55 +0200)]
Make the tests build when OpenSSL is not available.
Don't #define HAVE_OPENSSL (to zero) when OpenSSL is not available.
Code written as #ifdef HAVE_OPENSSL do not expect that.
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.
Nick Mathewson [Wed, 25 May 2011 20:51:25 +0000 (16:51 -0400)]
Fix new warnings from GCC 4.6
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'.
Nick Mathewson [Mon, 23 May 2011 21:45:14 +0000 (17:45 -0400)]
Fix a bug that prevented us from configuring IPv6 nameservers.
Kevin Ko [Mon, 23 May 2011 05:40:05 +0000 (01:40 -0400)]
Test case for
0848814ac49616
"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."
Kevin Ko [Sat, 21 May 2011 03:23:44 +0000 (23:23 -0400)]
Fix failing assertion introducd in commit
0d6622e
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).
Dave Hart [Fri, 20 May 2011 18:18:08 +0000 (14:18 -0400)]
Fix compilation with GCC 2, which had no __builtin_expect
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.
Sebastian Hahn [Thu, 5 May 2011 14:27:55 +0000 (16:27 +0200)]
Correctly detect openssl on windows
Sebastian Hahn [Thu, 5 May 2011 13:51:11 +0000 (15:51 +0200)]
Move the win32 detection in configure.in
Sebastian Hahn [Thu, 5 May 2011 13:49:38 +0000 (15:49 +0200)]
Use OPENSSL_LIBS in Makefile.am
Peter Rosin [Wed, 4 May 2011 14:37:58 +0000 (16:37 +0200)]
Libtool brings in the dependencies of libevent_openssl.la automatically
Peter Rosin [Wed, 4 May 2011 14:34:28 +0000 (16:34 +0200)]
libssl depends on libcrypto, not the other way around.
Nick Mathewson [Tue, 3 May 2011 18:22:48 +0000 (14:22 -0400)]
Oops; that new unit test breaks for epoll. Fix it.
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 [Tue, 3 May 2011 03:22:09 +0000 (23:22 -0400)]
Add missing words to EVLOOP_NONBLOCK documentation
Nick Mathewson [Thu, 28 Apr 2011 01:28:11 +0000 (21:28 -0400)]
Bump version to 2.0.11-stable-dev
Nick Mathewson [Thu, 28 Apr 2011 00:25:57 +0000 (20:25 -0400)]
Increment version number to 2.0.11-stable
Nick Mathewson [Thu, 28 Apr 2011 00:15:20 +0000 (20:15 -0400)]
Add more people to the acknowledgments
Nick Mathewson [Thu, 28 Apr 2011 00:03:46 +0000 (20:03 -0400)]
Changelog for 2.0.11-stable
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.
Nick Mathewson [Sat, 23 Apr 2011 06:35:17 +0000 (02:35 -0400)]
Use AM_CONDITIONAL, not AC_SUBST, to tell automake to build regress
For some reason, this makes mingw much happier about building
regress.exe by default. No, I'm afraid I don't know why.
Nick Mathewson [Sat, 23 Apr 2011 06:31:04 +0000 (02:31 -0400)]
Fix msvc build: it needed to know about _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE
Nick Mathewson [Sat, 23 Apr 2011 05:48:11 +0000 (01:48 -0400)]
Try to fix up CHECK_REGRESS hack to not break on win32
Nick Mathewson [Sat, 23 Apr 2011 05:47:43 +0000 (01:47 -0400)]
Add missing header for regress_http compilation on win32
Nick Mathewson [Sat, 23 Apr 2011 05:47:11 +0000 (01:47 -0400)]
Merge branch '20_iocp_conn_sockopt' into patches-2.0
Nick Mathewson [Fri, 22 Apr 2011 14:54:02 +0000 (10:54 -0400)]
call setsockopt correctly on connecting() IOCP-bufferevents so shutdown() will work
Sebastian Hahn [Sat, 23 Apr 2011 00:22:08 +0000 (02:22 +0200)]
Zero a struct sockaddr_in before using it
Found by Dave Heart
Sebastian Hahn [Sat, 23 Apr 2011 00:20:59 +0000 (02:20 +0200)]
Remote some dead code from dns-example.c
Found by Dave Heart
Sebastian Hahn [Mon, 11 Apr 2011 16:26:48 +0000 (18:26 +0200)]
Check return value of evbuffer_add_cb in tests
Caught by clang's static analyzer
Sebastian Hahn [Mon, 11 Apr 2011 16:03:02 +0000 (18:03 +0200)]
Be nice and "handle" error return values in sample code
Caught by clang's static analyzer
Sebastian Hahn [Mon, 11 Apr 2011 15:48:23 +0000 (17:48 +0200)]
Refactor test_getaddrinfo_async_cancel_stress()
Turns out it didn't need an event base set up.
Spotted by clang's static anaylzer
Sebastian Hahn [Mon, 11 Apr 2011 15:40:14 +0000 (17:40 +0200)]
add some (void) casts for unused variables
All these places already have an XXX marker, so we know we need to fix
them later. Let's not clutter the static analysis results with them.
Sebastian Hahn [Mon, 11 Apr 2011 15:32:03 +0000 (17:32 +0200)]
Actually send NULL request in http_bad_request_test
Issue caught by clang's static analyzer
Sebastian Hahn [Mon, 11 Apr 2011 15:23:08 +0000 (17:23 +0200)]
Add a forgotten return value check in the unit tests
Spotted by clang's static analyzer
Sebastian Hahn [Sun, 10 Apr 2011 12:03:39 +0000 (14:03 +0200)]
Add an assert to appease clang's static analyzer
It got confused because in EVLOCK_ASSERT_LOCKED(lock) there is an if
(lock) check.
Sebastian Hahn [Mon, 14 Mar 2011 03:24:33 +0000 (04:24 +0100)]
Fix possible NULL-deref in evdns_cancel_request
The clang static analyzer complained that base might be dereferenced
without being set, but this patch should fix another dereference issue.
Sebastian Hahn [Mon, 14 Mar 2011 03:13:55 +0000 (04:13 +0100)]
Add a forgotten NULL check to evhttp_parse_headers
Issue detected by the clang static analyzer
Sebastian Hahn [Sun, 10 Apr 2011 15:23:11 +0000 (17:23 +0200)]
Fix compilation under LLVM/clang with --enable-gcc-warnings
When compiling using clang (2.9 or lower) do not enable
-Wnormalized=id or -Woverride-init when --enable-gcc-warnings
or --enable-gcc-warnings-advisory is set as these options
are unsupported.
This commit is based on a patch for Tor
(git commit
56bdc844ba68ac0911efc7ad3398f1eafeaaac76 by Steven
Murdoch), Copyright (c) 2007-2011, The Tor Project, Inc.
Nick Mathewson [Thu, 21 Apr 2011 21:33:13 +0000 (17:33 -0400)]
Fix a memory leak on win32 socket->event map.
This would lose some memory every time an event_base was freed on win32.
Found by Dimitre Piskyulev.
Nick Mathewson [Thu, 21 Apr 2011 21:11:41 +0000 (17:11 -0400)]
Handle calloc failure in evdns. (Found by Dave Hart)
Nick Mathewson [Thu, 21 Apr 2011 17:30:22 +0000 (13:30 -0400)]
Merge branch '20_evdns_circular_list_patch' into patches-2.0
Nick Mathewson [Wed, 20 Apr 2011 17:27:31 +0000 (13:27 -0400)]
Fix a crash bug in evdns server circular list code
Really, this should use a circleq. That's a change for 2.1, though.
Nick Mathewson [Thu, 14 Apr 2011 18:15:13 +0000 (14:15 -0400)]
Fix a couple of memory leaks in samples/http-server.c. Found by Dave Hart.
Nick Mathewson [Wed, 13 Apr 2011 15:20:30 +0000 (11:20 -0400)]
Avoid a free(NULL) if out-of-memory in evdns_getaddrinfo. Found by Dave Hart
Nick Mathewson [Tue, 5 Apr 2011 21:21:12 +0000 (17:21 -0400)]
Fix the check for multicast or broadcast addresses in evutil_check_interfaces
First of all, it is totally okay to have an address end with .255,
depending on what your netmask is, so we shouldn't reject a local
address if it ends with .255.
Second, our check for ending with .255 was broken. So was our check
for class-d addresses.
Found by Dave Hart.
Nick Mathewson [Tue, 5 Apr 2011 21:17:51 +0000 (17:17 -0400)]
Merge branch '20_socktype_protocol_nomem' into patches-2.0
Nick Mathewson [Tue, 5 Apr 2011 20:32:39 +0000 (16:32 -0400)]
Check for allocation failures in apply_socktype_protocol_hack
Tomash Brechko [Thu, 31 Mar 2011 15:11:10 +0000 (19:11 +0400)]
Fix the case when failed evhttp_make_request() leaved request in the queue.
Tomash Brechko [Thu, 24 Mar 2011 12:52:34 +0000 (15:52 +0300)]
Fix subtle recursion in evhttp_connection_cb_cleanup().
Tomash Brechko [Wed, 23 Mar 2011 09:05:33 +0000 (12:05 +0300)]
Reset outgoing connection when read data in idle state.
Imagine server side is buggy and miscalculates Content-Length: in the
reply. Data arriving in idle state shouldn't make us crash, instead we
can just reset the connection.
Nick Mathewson [Wed, 23 Mar 2011 20:32:42 +0000 (16:32 -0400)]
Add comment to configure.in to explain gc-sections test logic
(Basically, we need access to conftest.err for the test to work properly.)
Dave Hart [Wed, 23 Mar 2011 20:22:57 +0000 (16:22 -0400)]
Fix for --gc-sections on NetBSD
This patch fixes http://bugs.ntp.org/1844, works around
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=40401, by
improving the test for support of --gc-sections to run a program which
reads a file using stdio built with --gc-sections, instead of simply
link the binary. This catches the buggy linker as the garbage
collection removes a tag NetBSD uses to distinguish its own elf
binaries from Linux ones, causing it to treat conftest as a Linux
binary and run it with the wrong syscall table.
Dave Hart [Wed, 23 Mar 2011 20:22:24 +0000 (16:22 -0400)]
Fix make distcheck & installation of libevent 1 headers
libevent/Makefile.am corrects a typo (thanks to Harlan for spotting it
once we realized make distcheck was broken when building the libevent
tearoff). The result was the include/ev*.h were not distributed nor
installed whether or not --disable-libevent-install was used. This
was introduced with the final round (3/3) of
--disable-libevent-install patch from me.
Christophe Fillot [Sat, 12 Mar 2011 17:08:19 +0000 (12:08 -0500)]
Fix incorrect assertions and possible use-after-free in evrpc_free()
Original description:
The following patch fixes incorrect assertions in evrpc_free():
evrpc_unregister_rpc() and evrpc_remove_hook() return 0 for success.
Also, in evrpc_unregister_rpc(), it is better to free RPC structure
at the end: evrpc_free() uses rpc->uri as "name" parameter when
calling evrpc_unregister_rpc(), then rpc->uri is freed, but we have
"registered_uri = evrpc_construct_uri(name)". So at this time "name"
is invalid.
Nick Mathewson [Tue, 8 Mar 2011 03:59:19 +0000 (22:59 -0500)]
Disable lazy gettimeofday/clock_gettime comparison for now
Nick Mathewson [Tue, 8 Mar 2011 03:45:10 +0000 (22:45 -0500)]
Merge branch '20_timescale' into patches-2.0
Nick Mathewson [Tue, 8 Mar 2011 02:55:47 +0000 (21:55 -0500)]
Followup for Tomash Brechko's http patch
This patch makes bufferevent_disable_hard() non-public, and
adds a comment about what it's for and why it's used.
Tomash Brechko [Thu, 24 Feb 2011 09:30:40 +0000 (12:30 +0300)]
Workaround libevent bug
https://sourceforge.net/tracker/index.php?func=detail&aid=
3078187&group_id=50884&atid=461324
The problem is that bufferevent_disable() doesn't disable EV_WRITE
when 'connecting' flag is set. However from evhttp_connection_reset()
we want to disable EV_WRITE for sure (we are closing the socket next).
So we add bufferevent_disable_hard(), which acts like
bufferevent_disable(), but resets 'connecting' flag before the call to
the actual handler.
TODO: bufferevent_disable_hard() shouldn't be public, remove it from
event2/bufferevent.h.
Nick Mathewson [Thu, 3 Mar 2011 20:34:22 +0000 (15:34 -0500)]
Have event_base_gettimeofday_cached() always return wall-clock time
Based on code by Dave Hart
Dave Hart [Thu, 3 Mar 2011 17:57:17 +0000 (12:57 -0500)]
Make --no-libevent-install apply to event1 headers too
Dave Hart [Fri, 25 Feb 2011 15:35:12 +0000 (10:35 -0500)]
Make --no-libevent-install apply to headers too
Sebastian Hahn [Wed, 23 Feb 2011 08:19:08 +0000 (09:19 +0100)]
Continue AM_CFLAGS to AM_CPPFLAGS correction
9c469db300e1b270a93c6b04c1709ac0f7751136 had started with the conversion
but left out another instance of incorrectly used AM_CFLAGS.
Dave Hart provided the suggestion for this fix.
Nick Mathewson [Tue, 22 Feb 2011 23:53:55 +0000 (18:53 -0500)]
Merge branch '20_uri_nonconformant' into patches-2.0
Nick Mathewson [Tue, 22 Feb 2011 21:20:42 +0000 (16:20 -0500)]
Make -ffunction-sections off-by-default in 2.0.x
I don't see how this can burn anybody, but I don't want to take
chances: new build options are something that should be done in an
alpha. To turn -ffunction-sections on, pass
--enable-function-sections to configure.
Nick Mathewson [Tue, 22 Feb 2011 21:14:16 +0000 (16:14 -0500)]
Remove nonfunctional enable_libevent_(install|regress)_def variables
Nick Mathewson [Tue, 22 Feb 2011 21:13:49 +0000 (16:13 -0500)]
Use $(), not @@, for LIBEVENT_GC_SECTIONS
Nick Mathewson [Tue, 22 Feb 2011 05:34:49 +0000 (00:34 -0500)]
Be explicit about how long event loops run in event.h documentation
Nick Mathewson [Tue, 22 Feb 2011 05:31:56 +0000 (00:31 -0500)]
Use %s with printf in test.sh
Dave Hart [Sun, 13 Feb 2011 07:27:42 +0000 (02:27 -0500)]
Correct an AM_CFLAGS to an AM_CPPFLAGS in test/Makefile.am
Dave Hart [Sun, 13 Feb 2011 07:05:04 +0000 (02:05 -0500)]
Add configure options to disable installation, regression tests
The main reason for disabling installation is if you're building
libevent as a subpackage for embedding: you want to have your main
package's "make all" build libevent, but you don't want your main
package's "make install" to install libevent.
Harlan Stenn [Sun, 13 Feb 2011 07:00:10 +0000 (02:00 -0500)]
Add -D_OSF_SOURCE to fix hpux builds
Dave Hart [Sun, 13 Feb 2011 06:50:40 +0000 (01:50 -0500)]
Use the gcc -ffunction-segments feature to allow gc when linking with static libevent
Harlan Stenn [Sun, 13 Feb 2011 06:42:58 +0000 (01:42 -0500)]
Check for getservbyname even if not on win32.
Harlan Stenn [Sun, 13 Feb 2011 06:39:10 +0000 (01:39 -0500)]
Fix autoconf bracket issues; make check for getaddrinfo include netdb.h
Harlan Stenn [Sun, 13 Feb 2011 06:34:40 +0000 (01:34 -0500)]
Skip check for zlib if we have no zlib.h
Harlan Stenn [Sun, 13 Feb 2011 06:30:37 +0000 (01:30 -0500)]
Make test-eof fail with a timeout if we never get an eof.
Previously, it would just wait forever.
Nick Mathewson [Sun, 13 Feb 2011 06:29:54 +0000 (01:29 -0500)]
FIX: comment internal headers used in sample code.
Nick Mathewson [Sun, 13 Feb 2011 06:27:06 +0000 (01:27 -0500)]
NM: Fix sample/http-server ipv6 fixes
Fix 1: Use #include "../xyz" rather than #include <../xyz>
Fix 2: util-internal.h includes ipv6-internal.h, which in turn defines
a replacement AF_INET6 on platforms that don't have it. As such,
the AF_INET6 checks shouldn't be needed. (right?)
Harlan Stenn [Sun, 13 Feb 2011 06:25:33 +0000 (01:25 -0500)]
Include util-internal.h as needed to build on platforms with no sockaddr_storage