409 Commits

Author SHA1 Message Date
Nick Mathewson
26049c2f93 Merge remote branch 'github/20_getaddrinfo_cancel_v2' 2010-11-22 16:24:52 -05:00
Nick Mathewson
9531763ab0 Disable changelist for epoll by default because of Linux dup() bug; add an option and/or an envvar to reenable it for speed.
Rename option to control epoll changelist; make epoll changelist off by default
2010-11-22 15:50:36 -05:00
Nick Mathewson
494186129f Use the US-English "canceled", not the UK "cancelled". 2010-11-19 12:08:29 -05:00
Nick Mathewson
057a51468e Clarify EVLOOP_* documentation to be more precise. 2010-11-14 19:34:49 -05:00
Nick Mathewson
5c8a59e886 Merge remote branches 'github/20_evdns_cancel_segfault_v2', 'github/20_http_close_detect', 'github/20_http_versions', 'github/20_more_http_methods', 'github/20_shutdown_iocp_listener' and 'github/20_win64_fixes' 2010-11-09 10:19:05 -05:00
Nick Mathewson
229714d123 Fix a mistake in http documentation found by Julien Blache 2010-11-04 16:04:28 -04:00
Nick Mathewson
f5b391e22e Tweak interface for allowed methods 2010-11-04 11:53:36 -04:00
Felix Nawothnig
75a73414a4 Define enumerators for all HTTP methods, including PATCH from RFC5789
This patch defines enumerators for all HTTP methods that exist
(including PATCH introduced in RFC 5789).

It also makes them bit-masky (that's not a word, is it?), breaking
binary- but not source-code compatibility.

evhttp now stores a bitmask specifying for which methods requests to
dispatch and which ones to reject with "405 Method Not Allowed".

By default that's the ones we currently have (GET, POST, HEAD, PUT,
DELETE), thereby keeping functional compatibility (besides the minor
change that one of the other methods will now cause 405 instead of
400. But I believe that could even be considered a bug-fix).

evhttp is extended by evhttp_set_allowed_methods() with which the
user can change that bitmask.

no regressions here and my test-app still works. Haven't yet
actually tested any of the new methods.

What's obviously missing here is the special logic for the methods:

OPTIONS: We should be fine here - I believe our current dispatch
logic should work fine. Some convenience functions would be fine
though.

TRACE: I'm pretty certain we should never dispatch this to the
callbacks and simply implement the necessary functionality built-in.

CONNECT: Pretty straight-forward to implement (and considering the
framework in which we implement it very efficient too). Should
probably go built-in.

PATCH: Except for checking the RFC against our pre-dispatch logic
(there just might be some "MUST not have Some-Header" lurking
somewhere) there is nothing to be done here, this is completely up
to the user. Nothing to do.
2010-11-04 11:53:36 -04:00
Nick Mathewson
22e0a9b2e8 Add evhttp_response_code to remove one more reason to include http_struct.h 2010-11-03 15:12:08 -04:00
Nick Mathewson
73bf07fe9b Merge remote branch 'github/20_abi_breaks' 2010-10-26 21:33:13 -04:00
Nick Mathewson
a4063c06f9 Note that 2.0.9 will break the ABI, and make changes we were postponing.
We had to turn a couple of 32-bit size arguments into 64-bit arguments
or size_t arguments (since otherwise we would have had to do it post
2.0.x-stable, and that would be worse).
2010-10-26 10:38:30 -04:00
Nick Mathewson
2cbb1a161e Make rate-limits go up to SIZE_MAX/EV_SSIZE_MAX, not just INT32_MAX
Someday, when networks are far faster and people frequently want a
burst value greater than 2GB per tick, this will seem very forsightful
indeed.

For now, it breaks ABI, but not source.  Fixes bug 3092096.
2010-10-26 10:27:29 -04:00
Nick Mathewson
9c71a3413a Merge remote branch 'github/http_and_listener' 2010-10-25 15:13:32 -04:00
Nick Mathewson
ac7e52d84d Make evbuffer_add_file take ev_off_t, not off_t
This change has no effect on non-windows platforms, since those
either define off_t to 64-bits, or allow you to decide whether
it should be 64-bits yourself via some LARGEFILE-like macro.

On Windows, however, off_t is always 32-bit, so it's a bad choice
for "file size" or "file offset" values.  Instead, I'm adding
an ev_off_t type, and using it in the one place where we used
off_t to mean "the size of a file" or "an offset into a file" in the
API.

This breaks ABI compatibility on Windows.
2010-10-25 14:29:30 -04:00
Nick Mathewson
006efa7dbb Functions to actually use evhttp_bound_socket with/as evconnlistener. 2010-10-25 11:50:51 -04:00
Nick Mathewson
46ee061ca0 Add a function to change a listener's callback.
You can also now initialize listeners with no callbacks set; if so,
they won't get enabled until the callback is set to non-NULL.
2010-10-25 11:47:05 -04:00
Nick Mathewson
bf11e7ddf7 Merge branch 'http_uri_parse' 2010-10-21 15:33:13 -04:00
Nick Mathewson
45f6869c75 Make evhttp_uri non-public, and give it accessor functions. 2010-10-21 14:52:52 -04:00
Nick Mathewson
70e1b607d6 Document that two bufferevent functions only work on socket bufferevents 2010-10-21 14:05:04 -04:00
Nick Mathewson
aab49b6069 Add a bufferevent_get_base function 2010-10-21 14:04:24 -04:00
Nick Mathewson
cd00079b22 Add evhttp_connection_get_base() to get the event_base from an http connection
Based on a patch by Mark Ellzey from 27 July 2010.

Closes ticket 3052406
2010-10-21 12:19:28 -04:00
Nick Mathewson
2075fbcff0 Add evhttp_parse_query_str to be used with evhttp_uri_parse.
The old evhttp_parse_query() doesn't work well with struct
evhttp_uri.query, since it expects to get whole URIs, rather than
just the query portion.
2010-10-19 13:15:48 -04:00
Nick Mathewson
3a33462827 Document behavior of URI parsing more thoroughly.
Also, move evhttp_uri struct into http.h, since it is part of the API.
2010-10-19 13:02:18 -04:00
Nick Mathewson
eaa5f1d9ed Revise evhttp_uri_parse implementation to handle more of RFC3986 2010-10-19 11:26:59 -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
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
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
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
Simon Perreault
c4be8d82b3 Add error callback to evconnlistener 2010-09-22 15:54:18 -04:00
Christopher Davis
2447fe8886 Add event_config_set_num_cpus_hint for tuning thread pools, etc. 2010-09-08 01:22:22 -07:00
Nick Mathewson
42090072c1 Move the "function to getsockname() on a listener" to regress_testutils
This reverts commit fab50488fcb741884ccdfa7b83643eac3e5c9cbf.

The function was, on reflection, not important enough to break the feature
freeze, since it's trivial to build on your own.
2010-09-06 15:52:48 -04:00
Nick Mathewson
c51826ff50 Merge remote branch 'github/sysqueue_include_order' 2010-09-06 15:40:13 -04:00
Nick Mathewson
195214360c Expose a function to add a nameserver by sockaddr 2010-09-03 16:42:16 -04:00
Nick Mathewson
fab50488fc Expose a function to getsockname() on a listener's fd. 2010-09-03 16:41:16 -04:00
Nick Mathewson
ca9048f12c Move evkeyvalq into a separate header for evhttp_parse_query users
The evhttp_parse_query API is a bit misdesigned; all the other
evkeyvalq stuff is abstract and lets you get away with having a header
stub, but evhttp_parse_query seems to require that you instantiate an
empty evkeyvalq of your own.
2010-09-02 11:36:44 -04:00
Nick Mathewson
d3ceca800e Declare evkeyvalq and event_list even if event_struct.h comes before sys/queue.h
Fixes bug 3036645 reported by Mihai Draghicioiu
2010-09-02 11:27:57 -04:00
Nick Mathewson
d4977b52f0 Add a condition variable backend, with implementations for pthreads and win32
The interface from the user's POV is similar to the locking
implementation: either provide a structure full of function
pointers, or just call evthread_use_*_threads() and everything will
be okay.

The internal interface is meant to vaguely resemble pthread_cond_*,
which Windows people will better recognize as *ConditionVariable*.
2010-08-17 13:15:34 -04:00
Gilad Benjamini
60433a0a1a Clean up syntax on TAILQ_ENTRY() usage
Though the C standards allow it, it's apparently possible to get MSVC
upset by saying "struct { int field; } (declarator);" instead of
"struct {int field; } declarator;", so let's just not do that.

Bugfix for 3044492

(commit msg by nickm)
2010-08-13 17:08:59 -04:00
Nick Mathewson
a4af9be10a Make include/event2/event-config.h not included in source dist
As a generated file, it shouldn't get included in our source
distribution.  Apparently there is an automake incant for this:
nobase_ even stacks with nodist_ .
2010-08-13 11:41:37 -04:00
Nick Mathewson
33200e72de Document that DNS_NO_SEARCH is an obsolete alias for DNS_QUERY_NO_SEARCH 2010-08-10 15:03:14 -04:00
Nick Mathewson
3808168d21 Completely remove the (mostly-removed) obsolete thread functions. 2010-08-10 15:02:50 -04:00
Nick Mathewson
ec347b9225 Move event-config.h to include/event2
This change means that all required include files are in event2, and
all files not in event2/* are optional.
2010-08-06 20:21:27 -04:00
Nick Mathewson
6ae53d6762 Add an interface to expose min_share in ratelimiting groups 2010-08-04 15:44:08 -04:00
Nick Mathewson
cc2379d264 Constify a couple of arguments to evdns_server_request_add_*_reply 2010-07-26 14:48:32 -04:00
Nick Mathewson
e1c1167cbe Replace (unused,always 0) is_tcp argument to evdns_add_server_port*() with flags
Since we weren't using it for anything, and we always failed if it was
set, we're allowed to change the future semantics of setting it.
2010-07-22 14:44:24 +02:00