1906 Commits

Author SHA1 Message Date
Nick Mathewson
3ab578f848 Make sure the CLOEXEC flag is set on fds we open for base notification 2010-11-20 01:41:34 -05:00
Nick Mathewson
3a67d0bf42 Resolve an evport bug in the thread/forking test 2010-11-19 17:09:30 -05:00
Nick Mathewson
d51b2fc655 Make evdns_getaddrinfo_cancel threadsafe 2010-11-19 12:14:18 -05:00
Nick Mathewson
c7cfbcf466 Fix some more cancel-related bugs in getaddrinfo_async
Also imposed a new rule to make this much much simpler: no freeing
the getaddrinfo request until both dns callbacks have been invoked.
2010-11-19 12:08:35 -05:00
Nick Mathewson
abf01ed13a Avoid double-invocation of user callback with EVUTIL_EAI_CANCEL 2010-11-19 12:08:34 -05:00
Nick Mathewson
494186129f Use the US-English "canceled", not the UK "cancelled". 2010-11-19 12:08:29 -05:00
Nick Mathewson
8faf223ac5 Fix a memory leak in evhttp_uri_free. 2010-11-17 00:09:10 -05:00
Nick Mathewson
4f228a1fc1 Fix bug in bufferevent_connect on an openssl bufferevent that already had an fd
The problem was that we were using openssl's BIO code's shutdown flag
whenever BEV_OPT_CLOSE_ON_FREE was set.  This made the BIO close the
socket when it was freed... but it would be freed whenever we did a
setfd on the bufferevent_openssl, even the no-op setfd in
bufferevent_connect.

So instead, we just set the shutdown flag to 0, and handle closing the
fd ourselves.

Spotted by Linus Nordberg
2010-11-14 19:54:52 -05:00
Nick Mathewson
057a51468e Clarify EVLOOP_* documentation to be more precise. 2010-11-14 19:34:49 -05:00
Nick Mathewson
2d5e1bd0be Do not let EVLOOP_ONCE exit the loop until all deferred callbacks have run 2010-11-14 19:32:13 -05:00
Nick Mathewson
0617a81820 Make EVLOOP_ONCE ignore internal events
Merely getting an internal notification event from having an event
added or deleted from another thread should not cause
event_base_loop(base, EVLOOP_ONCE) to exit; previously, it did.
2010-11-14 19:25:54 -05:00
Nick Mathewson
1ac5b2303a Only clear underlying callbacks when the user hasn't reset them. 2010-11-09 15:18:59 -05:00
Nick Mathewson
fc7b1b005c When closing a filtering bufferevent, clear callbacks on the underlying bufferevent
Previously, if BEV_OPT_CLOSE_ON_FREE wasn't set on a
bufferevent_filter or a filtering bufferevent_openssl, when we went
to free the filtering bufferevent, we'd leave the underlying
bufferevent unchanged.  That's not so good, since the callbacks are
set to activate stuff in the filtering bufferevent that we're about
to free.  Instead, set all the callbacks to NULL.
2010-11-09 11:43:47 -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
a38140be18 Refactor http version parsing into a single function
Based on a suggestion by Chris Davis to make
evhttp_parse_response_line tolerate odd versions too.
2010-11-09 10:14:32 -05:00
Nick Mathewson
3db6bc0079 Remove some debugging puts() calls from allow_methods test 2010-11-09 10:03:00 -05:00
Nick Mathewson
52aa419bf6 Set SO_UPDATE_ACCEPT_CONTEXT on sockets from AcceptEx so that shutdown() can work
Based on patch (and lots of debugging work) by Kelly Brock.
2010-11-05 10:12:06 -04:00
Nick Mathewson
229714d123 Fix a mistake in http documentation found by Julien Blache 2010-11-04 16:04:28 -04:00
Nick Mathewson
05124879d3 Never call evhttp_readcb while writing. 2010-11-04 14:05:08 -04:00
Felix Nawothnig
c76640b5c2 Don't disable reading from the HTTP connection after sending the request to be notified of connection-close in time 2010-11-04 14:01:26 -04:00
Nick Mathewson
75e3320efd Units test for unexpected evhttp methods. 2010-11-04 12:41:13 -04:00
Nick Mathewson
536311a46b evhttp: Return 501 when we get an unrecognized method, not 400. 2010-11-04 12:39:41 -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
9ed30de7ff Don't free evdns_request handles until after the callback is invoked
Previously, once the callback was scheduled, it was unsafe to cancel
a request, but there was no way to tell that.  Now it is safe to
cancel a request until the callback is invoked, at which point it
isn't.

Found and diagnosed by Denis Bilenko.
2010-11-04 11:05:29 -04:00
Christopher Davis
34b84b9727 Fix more wn64 warnings. 2010-11-03 23:30:29 -04:00
Nick Mathewson
78762383b7 Merge branch 'http_nolegacy_v2' 2010-11-03 15:18:34 -04:00
Nick Mathewson
985430aed1 Remove need for http_compat.h in http tests 2010-11-03 15:17:57 -04:00
Nick Mathewson
0b137f452e Stop accessing http request struct directly from in the unit tests. 2010-11-03 15:14:29 -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
c91622d18c Stop using event_compat.h in regress_http 2010-11-03 15:04:44 -04:00
Nick Mathewson
9bb8239375 Convert the rest of the http tests to be non-legacy unit tests. 2010-11-03 15:00:08 -04:00
Nick Mathewson
353402a87a Rename the confusing "base" static variable in regress_http.c 2010-11-03 14:13:20 -04:00
Nick Mathewson
8505a7449c Start porting http tests to not use legacy interfaces 2010-11-03 14:11:45 -04:00
Nick Mathewson
647e094ca2 Replace exact-version checks for HTTP/1.1 with >= or < checks 2010-11-02 15:19:12 -04:00
Joachim Bauch
aa5f55face reset "chunked" flag when sending non-chunked reply 2010-11-02 13:50:57 -04:00
Nick Mathewson
ba01456999 Use the label_len local variable in evdns instead of recalculating it over and over 2010-11-02 12:42:35 -04:00
Nick Mathewson
a3245afec2 Fix win32 build in response to fixes from win64 build. 2010-11-01 14:23:33 -04:00
Nick Mathewson
74a91e5aaf fix signed/unsigned warnings in http.c 2010-11-01 14:16:39 -04:00
Nick Mathewson
f8095d64e2 Fix a typo in 7484df61c981fc33db2~ 2010-11-01 14:15:34 -04:00
Nick Mathewson
545a61145c Fix even more win64 warnings: buffer, event_tagging, http, evdns, evrpc 2010-11-01 14:13:33 -04:00
Nick Mathewson
7484df61c9 Fix even more win64 warnings 2010-11-01 13:43:43 -04:00
Nick Mathewson
b6a158ca22 Rename "size" variables in win32select that were really fd counts. 2010-11-01 11:48:57 -04:00
Christopher Davis
f8064762ae Increase the skew tolerance to 2 seconds in thread/deferred_cb_skew
This is to make the test not fail on Sebastian Hahn's Win7 box.
2010-10-28 14:11:33 -04:00
Christopher Davis
7b40a00050 Make sure IOCP evconnlistener uses virtual events. 2010-10-28 14:11:33 -04:00
Nick Mathewson
598d133609 Try to clear up more size_t vs int/long issues. 2010-10-27 22:57:53 -04:00
Nick Mathewson
b81217f78d Fix signal handler types for win64. 2010-10-27 17:37:32 -04:00
Dimitre Piskyulev
1ae82cd8c6 Set _EVENT_SIZEOF_VOID_P correctly on win32 and win64 2010-10-27 17:32:41 -04:00
Dimitre Piskyulev
f817bfa4d3 Fix some ints to evutil_socket_t; make tests pass on win64. 2010-10-27 17:32:06 -04:00
Nick Mathewson
19c71e7454 Fix som event_warns that should have been event_warnx 2010-10-27 10:36:08 -04:00