2188 Commits

Author SHA1 Message Date
Ross Lagerwall
d2b5f7223a Make uses of open() close-on-exec safe by introducing evutil_open_closeonexec.
In a multi-process/threaded environment, opening fds internally
without the close-on-exec flag could leak fds to child processes.
2012-02-11 21:10:22 -05:00
Nick Mathewson
0c483170be Add an empty section to the changelog for 2.0.18-stable 2012-02-10 22:20:05 -05:00
Nick Mathewson
5a807b7aa2 Correct a name in the credits. oops 2012-02-10 22:17:59 -05:00
Nick Mathewson
2d7bf0f78d Bump version to 2.0.17-stable-dev 2012-02-10 22:16:14 -05:00
Nick Mathewson
83e58ccd30 Update the credits in the readme release-2.0.17-stable 2012-02-10 18:39:31 -05:00
Nick Mathewson
0cdbd642e3 Finalize the changelog 2012-02-10 18:36:10 -05:00
Nick Mathewson
e49e289129 Update copyright notices to 2012 2012-02-10 17:29:53 -05:00
Nick Mathewson
8152b4c2b3 Bump version to 2.0.17-stable 2012-02-10 16:49:05 -05:00
Nick Mathewson
5d7bfa1519 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.
2012-02-10 11:24:51 -05:00
Nick Mathewson
19715a60e2 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
2012-02-09 15:07:19 -05:00
Nick Mathewson
6f6cebe356 Bring the changelog up to date 2012-02-06 21:18:25 -05:00
Nick Mathewson
5b4b8126de 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.
2012-02-06 12:37:40 -05:00
Greg Hewgill
d84d917099 Use C-style comments in C source files (for compatibility with compilers such as xlc on AIX). 2012-02-02 11:39:38 -05:00
Nick Mathewson
d6094b160f evdns: fix a bug in circular-queue implementation
found by Wang Qin
2012-02-01 14:56:43 -05:00
Nick Mathewson
9f9e259fda 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.
2012-01-26 15:04:24 -05:00
Nate R
c94a5f2a2c Do a memberwise comparison of threading function tables
Doing a memcmp risks comparing uninitialized padding bytes at the
end of the structure.
2012-01-24 17:15:50 -05:00
Nick Mathewson
438d4ff2bd Make event_base integrity check work on windows 2012-01-24 15:29:39 -05:00
Nick Mathewson
edc6d7d7fa Start writing a changelog for 2.0.17-stable 2012-01-24 15:09:04 -05:00
Nick Mathewson
5408ff3b89 Oops:remove an accidentally committed "sleep(1)" in a unit test 2012-01-24 11:16:26 -05:00
Nick Mathewson
dab91877bc Workaround in the unit tests for an apparent epoll bug in Linux 3.2 2012-01-24 11:04:19 -05:00
Nick Mathewson
3f18ad1b5f Fix a fd leak in event_reinit()
We were supposed to be closing the ev_signal_pair sockets.
2012-01-23 18:15:44 -05:00
Nick Mathewson
6e41cdc16b 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!
2012-01-23 17:59:16 -05:00
Nick Mathewson
3312b02036 Check event_base correctness at end of each unit test 2012-01-23 17:43:35 -05:00
Nick Mathewson
27737d55ae Add function to check referential integrity of an event_base 2012-01-21 12:55:15 -05:00
Catalin Patulea
790f6b3b10 Force strict validation of HTTP version in response.
This sometimes accepted invalid versions like 'ICY' (n = 0, major = undefined, sometimes > 1).
2012-01-20 11:37:38 -05:00
Nick Mathewson
7206e8cdd4 Suppress a gcc warning from ignoring fwrite return in http-sample.c
Found by Steve Snyder
2012-01-16 14:45:31 -05:00
Nick Mathewson
cba48c7d46 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.
2012-01-09 16:44:53 -05:00
Nick Mathewson
ecfc720a4f 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.
2012-01-09 11:49:41 -05:00
Nick Mathewson
f032516718 Remove bogus casts of socket to int before calling ev_callback
This should make 64-bit windows act better.

Found by Mark Heily.
2012-01-09 11:33:38 -05:00
Arno Bakker
da70fa705b Backport evhttp_connection_get_bufferevent to Libevent 2.0
Backport by Arno Bakker; original implementation in 8d3a8500f4
2011-12-14 16:17:19 -05:00
Nick Mathewson
7bbf6ca771 Slightly clarify evbuffer_peek documentation 2011-12-08 14:36:35 -05:00
Zack Weinberg
c986f2321d 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).)
2011-12-08 14:31:09 -05:00
Mike Frysinger
358c745e54 check for sysctl before we use it
Not all C libraries under Linux support the sysctl() func.
2011-12-08 11:39:48 -05:00
Colin Watt
19277763b2 Fix a silly compilation error with the sun compiler
Apparently, other compilers were allowing "return free(x)" in a
function returning void.
2011-12-06 13:35:54 -05:00
Nick Mathewson
11f36a5f76 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 .
2011-12-05 15:06:46 -05:00
Nick Mathewson
ba4d66961e Increment version to 2.0.16-stable-dev 2011-11-18 15:34:37 -05:00
Nick Mathewson
5de3fa3208 Increment version to 2.0.16-stable release-2.0.16-stable 2011-11-18 15:27:06 -05:00
Nick Mathewson
31c99bd28f Revise 2.0.16-stable changelog 2011-11-18 15:14:50 -05:00
Nick Mathewson
ebf82199df add comment to new consider_reading code 2011-11-17 17:42:45 -05:00
Mark Ellzey
2aa036fa04 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}
2011-11-17 11:59:41 -05:00
Nick Mathewson
96c562fa49 Move SSL rate-limit enforcement into bytes_to_read() 2011-11-17 11:54:07 -05:00
Mark Ellzey
a186e73200 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}
2011-11-17 11:45:49 -05:00
Nick Mathewson
6660c9a347 Revert "Avoid potential SSL read spinlocks"
This reverts commit fc52dbac87f4937f8306759506d6a2ad15ca244c.
2011-11-15 18:34:24 -05:00
Nick Mathewson
a62346dec7 Revert "openssl bufferevent has the same issue with writing as prior commit."
This reverts commit 7353663eb7c0b2a1caaaa5acd818515f156cf2ca.
2011-11-15 18:33:50 -05:00
Nick Mathewson
34045c8fd4 Add new entries to changelog, new credits to README 2011-11-15 17:22:12 -05:00
Nick Mathewson
b17b0eec02 Fix DNS memleak checks when running with malloc-replacement/debugging disabled 2011-11-15 17:11:42 -05:00
Nick Mathewson
e787413329 Don't try to make notifiable event_base when no threading fns are configured 2011-11-14 17:33:02 -05:00
Nick Mathewson
4e797f388f Warn when unable to construct base because of failing make_base_notifiable 2011-11-14 17:32:22 -05:00
Mark Ellzey
7353663eb7 openssl bufferevent has the same issue with writing as prior commit. 2011-11-14 11:52:59 -05:00
Mark Ellzey
fc52dbac87 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.
2011-11-14 11:52:51 -05:00