Commit graph

30 commits

Author SHA1 Message Date
poet
b0bd0942bf Port to MinGW 2013-03-16 13:34:01 +08:00
Mark Ellzey
f471298dbc Fix for issues/69 for evthr memset() 2012-12-11 09:56:40 -05:00
Mark Ellzey
31e3973a65 Added __cplusplus into evthr 2012-10-17 18:34:01 -04:00
Marcus Sundberg
5c2adcc0f2 Use TAILQ_FOREACH_SAFE() in evhthr_pool_free() as well. 2012-10-02 10:42:09 +02:00
Marcus Sundberg
f7cc5f2948 (evthr_pool_stop): Do not read queue entry after freeing. 2012-10-02 10:42:08 +02:00
Mark Ellzey
36ee722b6f Fixed potential deadlock - reported by zhangpeihao 2012-09-26 09:24:59 -04:00
Mark Ellzey
770a344a39 Cleanup compiler warnings. 2012-08-10 12:41:18 -04:00
Mark Ellzey
caddf104f4 Optimizations. 2012-06-14 15:57:05 -04:00
Mark Ellzey
a44d1c0c0c Added evthr max backlog options. 2012-05-23 16:11:43 -04:00
Mark Ellzey
4e99de9b3a Decrement pending count when defer fails. 2012-04-04 19:32:55 -04:00
Mark Ellzey
a342903b58 Added evhtp_set_bev_flags()
By default, when a bufferevent_socket_new type function is called, the only
flags that are set is BEV_OPT_CLOSE_ON_FREE. This function allows a user to
set their own flags.
2012-04-04 13:26:52 -04:00
Mark Ellzey
e6155d8872 Bugfixes, additions, cleanup, see full commit msg.
* evhtp_send_reply_end bugfix: evhtp_send_reply_end() would set the request as
  finished and then call bufferevent_flush(). The assumption here was bufferevent_flush()
  actually does something, which in reality isn't the case:

  bufferevent_sock    = be_socket_flush(...) { return 0; }
  bufferevent_openssl = be_openssl_flush(...) { return 0; }

  My dumb expectation was the writecb would get called on a flush, so instead
  send_reply_end() will now call the writecb directly (this function makes sure
  all data has been sent and the request is finished, etc).

* _evhtp_accept_cb() will now check the return status of evthr_pool_defer, which
  may return a RETRY. In this case it is assumed that the evthr is way too busy
  and will drop the connection. In the future we may want to create a retry
  mechanism to avoid dropped connections. Reasoning for this is if a evthr_defer
  fails, a connection will be in limbo, and never accepted().

* Fixed minor bug in the http parser for reply status code errors.

* Made evhtp_unset_hook() public.

* Made evhtp_unset_all_hooks() public.
2012-04-04 13:18:39 -04:00
Mark Ellzey
10ad15a438 Fixed memleak with evthr_free() 2012-02-23 17:18:27 -05:00
Mark Ellzey
f8a23081b2 Added #ifndef _GNU_SOURCE before setting it again. 2011-12-27 14:15:36 -05:00
Andy Hochhaus
af2a0dd180 Fix C++/clang++ build. 2011-12-27 12:50:56 -06:00
Nick Mathewson
c60715d17c Stop using the deprecated event.h; use event2/event.h instead 2011-12-14 19:42:48 -05:00
Mark Ellzey
feb8a43cd3 Merge branch 'develop'
Conflicts:
	evthr/evthr.c
2011-08-26 11:10:45 -04:00
Mark Ellzey
362f902bae thread initialization functionality 2011-08-24 15:24:17 -04:00
Mark Ellzey
33bfade57a send_reply start/body/end 2011-08-22 18:54:54 -04:00
Mark Ellzey
7c6f5aba53 fixes 2011-08-18 18:08:36 -04:00
Mark Ellzey
d4a63d84b3 fix with evthr 2011-08-15 17:22:25 -04:00
Mark Ellzey
e844f9af34 OSX Compat / fixes 2011-08-15 11:43:00 -04:00
Mark Ellzey
6a747c6921 some optimizations 2011-08-12 00:05:17 -04:00
Mark Ellzey
0b050cc20f More updates - perf updates - bug fixes 2011-08-08 15:34:42 -04:00
Mark Ellzey
f2d6c9e78b More -Wextra mods 2011-07-20 13:33:00 -04:00
Mark Ellzey
1e0ec98c51 No more submodules 2011-07-08 13:32:08 -04:00
Mark Ellzey
354e71d223 Prepping the removal of submodules 2011-07-08 13:30:30 -04:00
Mark Ellzey
76dc58db18 SSL and other various changes (see commit log)
- Added optional OpenSSL support (with optional threading abstractions).
  * In order to properly enable SSL for your server two things must happen:
    evhtp_ssl_cfg structure must be filled with your settings:

        evhtp_ssl_cfg scfg = {
            .pemfile        = ssl_pem,
            .privfile       = ssl_pem,
            .cafile         = ssl_ca,
            .ciphers        = "RC4+RSA:HIGH:+MEDIUM:+LOW",
            .ssl_opts       = <SSL SPECIFIC FLAGS>,
            .enable_scache  = 1,
            .scache_timeout = 1024,
            .scache_init    = evhtp_ssl_scache_builtin_init,
            .scache_add     = evhtp_ssl_scache_builtin_add,
            .scache_get     = evhtp_ssl_scache_builtin_get,
            .scache_del     = NULL,
        };
  * please note that .scache_init, .scache_add, .scache_get, and .scace_del
    are function points to allow for a user to define their own session cache
    mechanism. Libevhtp has a few default built-in cache functions:
     evhtp_ssl_scache_builtin_init,
     evhtp_ssl_scache_builtin_add,
     evhtp_ssl_scache_builtin_get,
     evhtp_ssl_scache_builtin_del

    Another side note here is that currently the builtin functions do not expire,
    this will be fixed in the next beta-release.

  * The second step is to enable the use of the SSL backend by calling:
    evhtp_use_ssl(evhtp_t *, evhtp_ssl_cfg *);

- Regular expression based path callback functions added:
    evhtp_set_regex_cb(evhtp_t *, "^(/path_w_regex/).*", callback, args);

    Using the case above, any path/uri in the request with /path_w_regex/*, the API
    will execute your defined callback function. The output of which is the same as
    any other defined callback.

- Added _htp_callbacks_find_callback_woffsets(), which (if regex) will set 2 integer
  variables in the evhtp_rquest_t structure defining the beginning and end of a matched
  URI/path.

- _htp_callback_new() has been modified to create regex based evhtp_callback_t's

- Made the evhtp_request_t structure private, various get/set functions have been added
  to deal with the internals.

- Modified compile to support libonigurmura, a BSD licensed cross-platform regular expression
  library. Currently this is only used to support posix regex functionality.
2011-06-30 12:10:44 -04:00
Mark Ellzey
5392bc92f3 Optional evthr support 2011-06-13 15:24:02 -04:00
Mark Ellzey
cb6df310ac Adding libevthr dependency 2011-05-17 18:02:09 -04:00