1766 Commits

Author SHA1 Message Date
Nick Mathewson
fadbfd4e6e Clean up error handling in uri_parse a little 2010-10-18 14:43:54 -04:00
Nick Mathewson
7d45431e15 Do not silently truncate URIs in evhttp_uri_join. Also avoid evbuffer_pullup. 2010-10-18 14:38:48 -04:00
Nick Mathewson
86212341c5 Make evhttp_uri_parse and friends conform to memory management standards 2010-10-18 14:34:20 -04:00
Pavel Plesov
86dd720a66 Introduce absolute URI parsing helpers.
See evhttp_uri_parse(), evhttp_uri_free() and evhttp_uri_join() for details.
2010-10-18 14:30:29 -04:00
Nick Mathewson
f13e449b53 Merge branch 'http_parse' 2010-10-18 14:20:06 -04:00
Nick Mathewson
49f4bf7c57 Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct. 2010-10-18 13:58:02 -04:00
Nick Mathewson
e5870690fc Modernize header usage in bench_http.c 2010-10-18 13:53:31 -04:00
Nick Mathewson
9dc5f44a19 Increment version in git to 2.0.8-rc-dev 2010-10-14 22:12:32 -04:00
Nick Mathewson
ef18c994c3 Increment the version to 2.0.8-rc
NOTE: This is not the official release until I tag it.  If you see
    this commit, and you decide that Libevent 2.0.8-rc is now
    finalized, you might get something besides 2.0.8-rc.
release-2.0.8-rc
2010-10-14 18:36:07 -04:00
Nick Mathewson
15be0493f6 Changelog and readme for 2.0.8-rc 2010-10-14 18:35:11 -04:00
Nick Mathewson
4ebf9509f7 Fixes for MSVC compilation 2010-10-14 14:40:40 -04:00
Nick Mathewson
d3b096c011 Make the --enable-gcc-warnings option include signed comparison warnings 2010-10-14 13:54:15 -04:00
Nick Mathewson
e06f514d4e Fix signed/unsigned warnings on win32 2010-10-14 13:51:24 -04:00
Nick Mathewson
6be589ae68 Fix signed/unsigned warnings on opensolaris, where iov_len is signed 2010-10-14 13:48:40 -04:00
Nick Mathewson
e5c214a423 Fix -Wsigned-compare warnings in test/* 2010-10-14 13:16:41 -04:00
Nick Mathewson
f2763fa864 add limits.h to event_tagging.c so opensolaris will build 2010-10-14 13:16:00 -04:00
Nick Mathewson
5e4bafbb89 fix a signed/unsigned warning in kqueue.c 2010-10-14 13:15:32 -04:00
Nick Mathewson
02f6259fc3 New unit test for ssl bufferevents starting with connected SSLs. 2010-10-14 12:17:28 -04:00
Nick Mathewson
93bb7d8e19 Fix a case where an ssl bufferevent with CLOSE_ON_FREE didn't close its fd
This could happen when we got an SSL with a BIO already set on it.
2010-10-14 12:17:24 -04:00
Nick Mathewson
223ee40fde Avoid spurious reads from just-created open openssl bufferevents
When handshaking, we listen for reads or writes from the
transport. But when we're connected, we start out with writes enabled
and reads disabled, which means we should not have the transport read
for us.
2010-10-14 10:55:04 -04:00
Nick Mathewson
34331e456d The corrected bufferevent filter semantics let us fix our openssl tests 2010-10-14 10:55:04 -04:00
Nick Mathewson
ac27eb8276 Correct logic on disabling underlying bufferevents when disabling a filter
Previously, whenever writing was disabled on a bufferevent_filter (or
a filtering SSL bufferevent), we would stop writing on the underlying
bufferevent.  This would make for trouble, though, since if you
implemented common patterns like "stop writing once data X has been
flushed", your bufferevent filter would disable the underlying
bufferevent after the data was flushed to the underlying bufferevent,
but before actually having it written to the network.

Now, we have filters leave their underlying bufferevents enabled for
reading and writing for reading and writing immediately.  They are not
disabled, unless the user wants to disable them, which is now allowed.
To handle the case where we want to choke reading on the underlying
bufferevent because the filter no longer wants to read, we use
bufferevent_suspend_read().  This is analogous to the way that we use
bufferevent_suspend_write() to suspend writing on a filtering
bufferevent when the underlying bufferevent's output buffer has hit
its high watermark.
2010-10-14 10:55:04 -04:00
Nick Mathewson
34d64f8a34 Fix serious bugs in per-bufferevent rate-limiting code
Our old code was too zealous about deleting the refill events that
would actually make connections able to read or write again after
they had run out of bandwidth.  Under some circumstances, this could
cause a bufferevent to never actually refill one of its
rate-limiting buckets.

Also, the code treated setting a per-connection rate-limit on a
connection that already had a group-limit as if it were changing the
limit on a connection whose allocation had already run out.

This patch fixes both of those problems.
2010-10-12 13:54:07 -04:00
Nick Mathewson
819b171572 Handle rate-limiting for reading on OpenSSL bufferevents correctly.
We were looking at the number of bytes read on the wbio, not in the
rbio.  But these are usually different BIOs, and the reading is
supposed to happen on the rbio.
2010-10-12 12:59:46 -04:00
Nick Mathewson
7ad90f6a25 Merge branch '20_internal_prio' 2010-10-09 00:02:31 -04:00
Nick Mathewson
a8148cedcd New evhttp_uri(encode|decode) functions to handle + and NUL characters right
The old evhttp_decode_uri() function would act as tough it was doing
an (illegal, undefined) decode operation on a whole URL at once, and
treat + characters following a ? as different from + characters
preceding one.  But that's not useful: If you are decoding a URI
before splitting off query parameters, you are begging to fail as soon
as somebody gives you a value with an encoded & in it.

The new evhttp_uridecode() function takes an argument that says
whether to decode + signs.  Both uridecode and uriencode also now
support encoding or decoding to strings with internal 0-valued
characters.
2010-10-08 23:58:00 -04:00
Nick Mathewson
2e63a604da evhttp_encode_uri encodes all reserved characters, including !$'()*+,/:=@
Perviously, some characters not listed as "unreserved" by RFC 3986
(notably "!$'()*+,/:=@") were not encoded by evhttp_encode_uri.  This
made trouble, especially when encoding path components (where @ and /
are bad news) and parameters (where + should get encoded so it doesn't
later decode into a space).

Spotted by Bas Verhoeven.
2010-10-08 12:57:11 -04:00
Nick Mathewson
08ebd26730 Merge branch 'iovmax' 2010-10-07 21:06:25 -04:00
Nick Mathewson
120570356b Turn some booleans in evconnlistener_iocp into one-bit bitfields. 2010-10-07 18:11:38 -04:00
Christopher Davis
62b429afa8 Make iocp/listener/error work; don't accept again if lev is disabled. 2010-10-07 18:11:38 -04:00
Nick Mathewson
481ef92086 Fix allocation error for IOCP listeners. Probably harmless, since struct event is big 2010-10-07 18:11:37 -04:00
Nick Mathewson
127d4f2195 Add a LEV_OPT_THREADSAFE option for threadsafe evconnlisteners 2010-10-07 18:11:19 -04:00
Nick Mathewson
3b84489385 Tweak evhttp_parse_query hack to avoid breaking abi 2010-10-06 12:35:38 -04:00
Nick Mathewson
b1756d019d Let evhttp_parse_query return -1 on failure
We already detected certain malformed queries, but we responded by
aborting the query-parsing process half-way through without telling
the user.  Now, if query-parsing fails, no headers are returned, and
evhttp_parse_query returns -1.
2010-10-06 12:30:17 -04:00
Nick Mathewson
fdc640b02d Fix an EINVAL on evbuffer_write_iovec on OpenSolaris.
The writev() call is limited to at most IOV_MAX iovecs (or UIO_MAXIOV,
depending on whom you ask).  This isn't a problem anywhere we've
tested except on OpenSolaris, where IOV_MAX was a mere 16.

This patch makes us go from "use up to 128 iovecs when writing" to
"use up to 128 iovecs when writing, or IOV_MAX/UIO_MAXIOV, whichever
is less".  This is still wrong if you somehow find a platform that
defines IOV_MAX < UIO_MAXIOV, but I hereby claim that such a platform
is too stupid to worry about for now.

Found by Michael Herf.
2010-10-06 10:56:49 -04:00
Nick Mathewson
5b7a370636 Fix warnings on mingw with gcc 4.5 2010-10-05 14:29:48 -04:00
Nick Mathewson
145f221e8f Define symbolic constants to use in place of SHUT_RD etc 2010-10-05 13:06:32 -04:00
Christopher Davis
e0fd87085d Send a shutdown(SHUT_WR) before closing an http connection
This avoids getting an ECONNRESET from the TCP stack.

Fixes bug 2928690
2010-10-05 13:01:54 -04:00
Nick Mathewson
0faaee0165 Fix a spurious-call bug on epoll.c
We were trying to check whether any events had really been
notified on an fd before calling evmap_io_active on it, but instead
we were checking for an event pointer, which was always true.

In practice, this patch shouldn't change much, since epoll_wait
shouldn't return an event unless there is actually an event going
on.

Spotted by an anonymous bug reporter on Sourceforge.  Closes bug
3078425.
2010-09-30 23:15:47 -04:00
Nick Mathewson
a8b7674cd5 Merge remote branch 'github/signed_compare' 2010-09-28 01:09:17 -04:00
Nick Mathewson
a78ac0facb Merge remote branch 'github/win_lib' 2010-09-27 16:05:20 -04:00
Nick Mathewson
d49b5e3326 Do not search outside of the system directory for windows DLLs
Hardens against some attacks.
2010-09-27 15:45:34 -04:00
Sebastian Hahn
b395392746 Fix compile in kqueue.c
Commit 38d09606 removed the evsigbase pointer, but forgot to remove
an assignment to it in kqueue.c.
2010-09-27 21:14:28 +02:00
Nick Mathewson
9c8db0f804 Fix all warnings in the main codebase flagged by -Wsigned-compare
Remember, the code
   int is_less_than(int a, unsigned b) {
      return a < b;
   }
is buggy, since the C integer promotion rules basically turn it into
   int is_less_than(int a, unsigned b) {
      return ((unsigned)a) < b;
   }
and we really want something closer to
   int is_less_than(int a, unsigned b) {
      return a < 0 || ((unsigned)a) < b;
   }
.

Suggested by an example from Ralph Castain
2010-09-23 22:45:55 -04:00
Nick Mathewson
045eef4cde Unit tests for listener error callbacks 2010-09-23 14:23:45 -04:00
Simon Perreault
c4be8d82b3 Add error callback to evconnlistener 2010-09-22 15:54:18 -04:00
Nick Mathewson
e1198997bc Make event.c debugging messages report fds 2010-09-21 22:44:39 -04:00
Nick Mathewson
ec2b05eddd Make debugging output for epoll backend more comprehensive 2010-09-21 22:23:32 -04:00
Nick Mathewson
90651b327a Put internal events at highest priority
(If we allow user events to starve internal events, then internal events
never actually happen, signals don't get acked, etc)
2010-09-17 00:24:50 -04:00
Nick Mathewson
38d09606ac Remove event_base.evsigbase; nothing used it. 2010-09-15 12:50:31 -04:00