2144 Commits

Author SHA1 Message Date
Nick Mathewson
8254de765d Fix windows file segment mappings
Instead of mapping enough bytes for each segment, we were failing to
take into account the slop created by rounding the segment position
down to the nearest page.

Should fix bug 3142394 found by Sebastian Hahn.
2011-06-02 17:09:53 -04:00
Nick Mathewson
7b9d13957f Try to squeeze a little more speed out of EVBUFFER_EOL_CRLF 2011-06-01 14:19:13 -04:00
Nick Mathewson
25fe382981 Merge remote-tracking branch 'github/master' 2011-06-01 14:02:56 -04:00
Nick Mathewson
d70dd22009 Merge pull request #17 from minaguib/master
Improve speed of EVBUFFER_EOL_CRLF
2011-06-01 11:02:48 -07:00
Nick Mathewson
36f745df22 Merge remote-tracking branch 'origin/patches-2.0' 2011-06-01 13:52:27 -04:00
Nick Mathewson
d54d3fc40d cygwin: make it possible to build DLLs
Patch from Brian Koehmstedt
2011-06-01 13:48:02 -04:00
Mina Naguib
5dde0f0424 Roughly 20% speed increase when line-draining a buffer using EVBUFFER_EOL_CRLF 2011-05-31 13:56:56 -04:00
Nick Mathewson
5926d601bb Merge branch '21_evport_improved' 2011-05-30 12:10:26 -04:00
Nick Mathewson
0dca19bb8e Merge remote-tracking branch 'origin/patches-2.0' 2011-05-30 12:09:18 -04:00
Nick Mathewson
87c0dff6aa Merge branch '20_select_nfds' into patches-2.0 2011-05-30 12:06:36 -04:00
Nick Mathewson
d90149d4b6 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.
2011-05-30 11:53:19 -04:00
Nick Mathewson
257651a48c Merge remote-tracking branch 'origin/patches-2.0' 2011-05-27 23:33:40 -04:00
Nick Mathewson
f47c15e7ba 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.
2011-05-27 23:30:06 -04:00
Nick Mathewson
942e22681f Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	evthread_win32.c
	listener.c
2011-05-27 23:19:11 -04:00
Peter Rosin
816115a17e InitializeCriticalSectionAndSpinCount requires _WIN32_WINNT >= 0x0403. 2011-05-27 23:14:10 -04:00
Nick Mathewson
94b8e676f3 Allow base-notification functions to exist without setting an fd
The kqueue and evport backends can make good use of this.
2011-05-27 22:54:16 -04:00
Nick Mathewson
e903db3362 Reenable main/many_events_slow_add for evport in 2.1
The various evport fixes should let it actually work again
2011-05-27 15:31:40 -04:00
Nick Mathewson
c04d927637 evport: Remove artificial low limit on max events per getn call
Previously, evport could only handle up to 8 events per time through
the loop.  This would impose an artificially high number of syscalls
on us to retrieve a large number of events.

This code allows the EVLOOP_* flags to work more similarly to how
they do on other platforms (up to 4096 events per syscall).  Dispite
dire warning (from 2006), doing this won't impose a big incremental
RAM penalty: if you have 4096 events firing at once, you necessarily
have a proportional number of events pending, and their associated
data structures are already costing a good bit of RAM.

This patch makes the main/many_events_slow_add test pass again.
2011-05-27 15:10:46 -04:00
Nick Mathewson
849a5cffa8 evport: don't scan more events in ed_pending than needed 2011-05-27 15:10:45 -04:00
Nick Mathewson
276ec0ef42 evport: Use portev_user to remember fdinfo struct 2011-05-27 15:10:45 -04:00
Nick Mathewson
0f77efef8b evport: Remove a linear search over recent events when reactivating them 2011-05-27 15:10:44 -04:00
Nick Mathewson
4687ce4f80 evport: use evmap_io to track fdinfo status. Should save time and RAM. 2011-05-27 15:10:43 -04:00
Nick Mathewson
356720a23b Merge remote-tracking branch 'origin/patches-2.0' 2011-05-27 15:09:54 -04:00
Nick Mathewson
203ba2742f Fix a couple of signed/unsigned warnings in http.c 2011-05-27 15:08:25 -04:00
Nick Mathewson
c11c6fcd82 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.
2011-05-27 14:58:21 -04:00
Nick Mathewson
29e5f7ea1b Merge remote-tracking branch 'origin/patches-2.0' 2011-05-26 17:45:54 -04:00
Nick Mathewson
dbb3c65288 Fix compilation. 2011-05-26 17:43:17 -04:00
Nick Mathewson
f0c9b51cc7 Merge branch 'intcmp_overflow_fixes' into patches-2.0 2011-05-26 17:34:15 -04:00
Mark Ellzey
1814ae9677 updated EV_S(s)IZE definitions 2011-05-26 17:33:18 -04:00
Mark Ellzey
84560fc4dc Added overflow checks in evhttp_read_body and evhttp_get_body 2011-05-26 17:33:18 -04:00
Mark Ellzey
a27927229f Added several checks for under/overflow conditions in evhttp_handle_chunked_read 2011-05-26 17:33:18 -04:00
Nick Mathewson
95f70166df Merge remote-tracking branch 'origin/patches-2.0' 2011-05-25 21:20:31 -04:00
Sebastian Hahn
d1b2d11bb5 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.
2011-05-26 02:05:54 +02:00
Peter Rosin
d41f3ea24e Do not define WIN32 in Makefile.nmake 2011-05-25 20:04:53 -04:00
Peter Rosin
85078b1faf In configure, test for _WIN32 not WIN32. 2011-05-25 20:04:45 -04:00
Nick Mathewson
9f560bfa11 Use "_WIN32", not WIN32: it's standard and we don't need to fake it
This patch was automatically generated with perl.

Based on a patch by Peter Rosin.
2011-05-25 20:03:15 -04:00
Nick Mathewson
0e95950e60 Merge remote-tracking branch 'origin/patches-2.0' 2011-05-25 19:46:14 -04:00
Peter Rosin
0de87fe69c Use evutil_gettimeofday instead of relying on the system gettimeofday. 2011-05-25 19:44:06 -04:00
Peter Rosin
3d768dc967 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)
2011-05-25 19:44:06 -04:00
Peter Rosin
8fa030c032 Make sure TINYTEST_LOCAL is defined when building tinytest.c 2011-05-25 19:44:06 -04:00
Peter Rosin
fe93022a66 unistd.h and sys/time.h might not exist. 2011-05-25 19:44:06 -04:00
Peter Rosin
70be7d17e4 MSVC does not provide S_ISDIR, so provide it manually. 2011-05-25 19:44:06 -04:00
Peter Rosin
f3c7a4c165 Bring in the compile script from automake, if needed. 2011-05-25 19:44:06 -04:00
Peter Rosin
07c41bead2 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.
2011-05-25 19:44:06 -04:00
Peter Rosin
86090ee198 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.
2011-05-25 19:44:06 -04:00
Nick Mathewson
9155b09534 Merge remote-tracking branch 'origin/patches-2.0' 2011-05-25 16:52:50 -04:00
Nick Mathewson
06a714ffe4 Fix new warnings from GCC 4.6 2011-05-25 16:52:03 -04:00
Nick Mathewson
173509d9b6 Merge remote-tracking branch 'origin/patches-2.0' 2011-05-23 18:25:05 -04:00
Mansour Moufid
06c51cdf93 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'.
2011-05-23 18:01:24 -04:00
Nick Mathewson
a9fe47f076 Merge remote-tracking branch 'origin/patches-2.0' 2011-05-23 17:50:45 -04:00