| 
              
1c204d55
               | 
              
2022-06-13T04:58:50
               | 
              
               | 
              
Fix some typos (#1284)
Signed-off-by: cuishuang <imcusg@gmail.com>
               | 
            
            
              
   
               | 
              
5cc2ff88
               | 
              
2022-05-09T16:33:36
               | 
              
               | 
              
fix grammar in comment
               | 
            
            
              
   
               | 
              
e339880f
               | 
              
2022-04-29T19:40:29
               | 
              
               | 
              
include/event.h: include <event2/util.h> over deprecatd <evutil.h>
Fixes: #1263
               | 
            
            
              
   
               | 
              
3da71856
               | 
              
2022-02-12T22:53:11
               | 
              
               | 
              
Fix build w/o OpenSSL by w/ MbedTLS
In 78fa3971be892194aa168c04fc34bf5f2cd99b99 from
https://github.com/libevent/libevent/pull/1241#commitcomment-63865496 a
new "if MBEDTLS" block was added to include/include.am. This is not
parsed by automake as it isn't on the first column, resulting in a
subsequent error in the build.
From [1]:
> The if, else, and endif statements should not be indented, i.e., start on column one.
  [1]: https://www.gnu.org/software/automake/manual/html_node/Usage-of-Conditionals.html
Fixes: #1251
Fixes: google/oss-fuzz#7149
               | 
            
            
              
   
               | 
              
78fa3971
               | 
              
2022-01-15T08:30:26
               | 
              
               | 
              
Fix make install failed when Automake used and both OpenSSL and MbedTLS are activated
Issue:
https://github.com/libevent/libevent/pull/1241#commitcomment-63865496
               | 
            
            
              
   
               | 
              
2db55e43
               | 
              
2021-12-15T21:27:21
               | 
              
               | 
              
Install bufferevent_ssl.h with MbedTLS support also
               | 
            
            
              
   
               | 
              
cd6a41ec
               | 
              
2021-12-10T11:05:13
               | 
              
               | 
              
feat: add `evdns_base_get_nameserver_fd` method
To get underlying udp socket fd.
               | 
            
            
              
   
               | 
              
0c217f4f
               | 
              
2021-11-22T00:05:27
               | 
              
               | 
              
Fix comment for evdns_base_new()
               | 
            
            
              
   
               | 
              
68675d5f
               | 
              
2021-09-12T18:03:03
               | 
              
               | 
              
doc: adjust flags notice on event_base_loop()
               | 
            
            
              
   
               | 
              
f446229b
               | 
              
2016-01-31T11:31:00
               | 
              
               | 
              
http: support unix domain sockets
There are no standard for encoding a unix socket in an url. nginx uses:
    http://unix:/path/to/unix/socket:/httppath
The second colon is needed to delimit where the unix path ends and where
the rest of the url continues.
Signed-off-by: Sean Young <sean@mess.org>
               | 
            
            
              
   
               | 
              
19b3fd0b
               | 
              
2021-04-07T20:39:18
               | 
              
               | 
              
evdns: add ability to get CNAME
Add new flag (DNS_CNAME_CALLBACK) for
evdns_base_resolve_ipv4()/evdns_base_resolve_ipv6().
If set, you will get one more callback with type == DNS_CNAME and CNAME
in addrs argument.
               | 
            
            
              
   
               | 
              
8e03f495
               | 
              
2021-04-03T12:50:53
               | 
              
               | 
              
Merge #1152 -- remove no op evdns functions
* upstream/pr/1152:
  dns: remove evdns_set_transaction_id_fn
  dns: remove evdns_set_random_bytes_fn
               | 
            
            
              
   
               | 
              
01beec2f
               | 
              
2021-04-03T12:55:32
               | 
              
               | 
              
dns: remove evdns_set_transaction_id_fn
               | 
            
            
              
   
               | 
              
39d68053
               | 
              
2021-04-03T12:55:11
               | 
              
               | 
              
dns: remove evdns_set_random_bytes_fn
               | 
            
            
              
   
               | 
              
0ef0d947
               | 
              
2021-04-02T20:59:55
               | 
              
               | 
              
doc: adjust edge-trigger notice on event_new()
This makes it easier to read and to understand it in my opinon. It also
fixes a missing "-" character.
               | 
            
            
              
   
               | 
              
4c29b01c
               | 
              
2021-03-28T10:57:11
               | 
              
               | 
              
build: remove splice implementation fragments
Looks like a `splice` implementation was planned, but has clearly never
eventuated (the TODO comment is from ~12 years ago, in
8b5bd77415fb6634fadf08357676926fecf5f032). For now, it's probably better
to remove the unused code/correct the docs.
               | 
            
            
              
   
               | 
              
aea752b6
               | 
              
2021-03-23T09:00:24
               | 
              
               | 
              
bufferevent: introduce bufferevent_replacefd() (like setfd() but also close fd)
               | 
            
            
              
   
               | 
              
bc25889f
               | 
              
2021-02-03T14:19:57
               | 
              
               | 
              
Check return value of evbuffer_remove() in bufferevent_read()
The conflict cast convertion between the return value of
bufferevent_read() and evbuffer_remove(), int(-1)->size_t(An undefined
maximum)
Add test case of bufferevent_read() should return 0 in case of
evbuffer_remove() returns -1
Fixes: #1132
               | 
            
            
              
   
               | 
              
617ba838
               | 
              
2021-01-09T17:19:27
               | 
              
               | 
              
evdns: add max-probe-timeout/probe-backoff-factor settings
I recently found that when the network status changed when calling
bufferevent_socket_connect_hostname (e.g. switching between several
WIFIs), all DNS servers would fail, and the timeout of probe would be
very long if there were many DNS requests. I want libevent to support
manual setting of MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR
So move hardcoded MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR into
struct, and allow changing them.
               | 
            
            
              
   
               | 
              
8d21ddcf
               | 
              
2020-11-01T00:59:16
               | 
              
               | 
              
Fix bufferevent_ssl_*flags() w/ disabled OpenSSL but enabled mbedTLS
               | 
            
            
              
   
               | 
              
a490172d
               | 
              
2020-10-31T22:53:31
               | 
              
               | 
              
Introduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL
               | 
            
            
              
   
               | 
              
7e0fc878
               | 
              
2020-10-31T21:45:22
               | 
              
               | 
              
Introduce new API for flags of the SSL bufferevent
Introduce more generic API (like for evbuffer):
- bufferevent_ssl_set_flags()
- bufferevent_ssl_clear_flags()
- bufferevent_ssl_get_flags()
And deprecate existing:
- bufferevent_openssl_get_allow_dirty_shutdown()
- bufferevent_openssl_set_allow_dirty_shutdown()
- bufferevent_mbedtls_get_allow_dirty_shutdown()
- bufferevent_mbedtls_set_allow_dirty_shutdown()
               | 
            
            
              
   
               | 
              
afa66ea4
               | 
              
2019-09-04T00:56:20
               | 
              
               | 
              
http: eliminate redundant bev fd manipulating and caching [WIP]
At the very beginning we reset the bufferevent fd (if bev has it), which
is not a good idea, since if user passes bufferevent with existing fd he
has some intention.
So we need to:
- use BEV_OPT_CLOSE_ON_FREE for default bufferevent_socket_new() (to
  avoid manual shutdown/closee)
- drop getsockopt(SOL_SOCKET, SO_ERROR), since bufferevent already has
  evutil_socket_finished_connecting_()
- drop supperior bufferevent_setfd(bev, -1) in
  evhttp_connection_connect_()
Closes: #795
Refs: #875
               | 
            
            
              
   
               | 
              
e91c4363
               | 
              
2020-10-27T01:40:34
               | 
              
               | 
              
http: add EVHTTP_URI_HOST_STRIP_BRACKETS
Refs: #1115
               | 
            
            
              
   
               | 
              
a18301a2
               | 
              
2020-09-08T15:38:16
               | 
              
               | 
              
http: const out address param to evcon_get_peer
               | 
            
            
              
   
               | 
              
972289f3
               | 
              
2020-08-29T01:15:20
               | 
              
               | 
              
Detect existence of pthread_mutexattr_setprotocol()
Fixes: #1084
               | 
            
            
              
   
               | 
              
eb7bed03
               | 
              
2020-08-01T16:10:48
               | 
              
               | 
              
Convert from WinCrypt to Windows BCrypt
Fixes: #1069
               | 
            
            
              
   
               | 
              
028385f6
               | 
              
2020-05-28T17:14:46
               | 
              
               | 
              
fix build system and add test and cleanup code
               | 
            
            
              
   
               | 
              
b28effa9
               | 
              
2020-01-13T23:04:29
               | 
              
               | 
              
mbedtls based SSL implementation
prototype is libevent-2.1.11-stable libevent_openssl.c
               | 
            
            
              
   
               | 
              
79dc8789
               | 
              
2020-07-20T21:59:10
               | 
              
               | 
              
doc: fix typo in thread.h
s/evthred_use_pthreads_with_flags/evthread_use_pthreads_with_flags/
               | 
            
            
              
   
               | 
              
83c58d49
               | 
              
2020-05-31T19:59:49
               | 
              
               | 
              
evdns: Add support for setting maximum UDP DNS message size.
Added new option `edns-udp-size` for evdns_base which allows
to control maximum allowed size of UDP DNS messages. This
maximum size is passed to the DNS server via edns mechanism.
               | 
            
            
              
   
               | 
              
7426a568
               | 
              
2020-05-25T11:25:18
               | 
              
               | 
              
http: Merge branch 'http-max_connections-pr-592'
@jcoffland:
  "When the max connection limit is enabled and the limit is reached, the
   server will respond immediately with 503 Service Unavailable. This can
   be used to prevent servers from running out of file descriptors. This is
   better than request limiting because clients may make more than one
   request over a single connection. Blocking a request does not
   necessarily close the connection and free up a socket."
* http-max_connections-pr-592:
  test: cover evhttp max connections
  Added evhttp max simultaneous connection limiting
               | 
            
            
              
   
               | 
              
0f6ee89a
               | 
              
2020-05-21T12:46:20
               | 
              
               | 
              
evdns: Implement dns requests via tcp
               | 
            
            
              
   
               | 
              
9a9b92ed
               | 
              
2020-03-01T16:01:12
               | 
              
               | 
              
Add EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD flag (fixes: #958)
By default we are using CLOCK_MONOTONIC_COARSE, but if
EVENT_BASE_FLAG_PRECISE_TIMER isset, then CLOCK_MONOTONIC will be used,
however this will also enable timerfd, while this is not always what
someone wants, hence add a flag to control this (by default the old
behavior is preserved, set new flag to change it).
               | 
            
            
              
   
               | 
              
5a5fe67e
               | 
              
2020-03-01T13:52:32
               | 
              
               | 
              
Fix typo in thread.h (s/event/evthread)
               | 
            
            
              
   
               | 
              
08e7d513
               | 
              
2020-01-28T14:31:39
               | 
              
               | 
              
misspelling of output in bufferevent_struct.h
               | 
            
            
              
   
               | 
              
02905413
               | 
              
2016-02-09T18:01:00
               | 
              
               | 
              
Add callback support for error pages
The existing error pages are very basic and don't allow for
multi-lingual support or for conformity with other pages in a web site.
The aim of the callback functionality is to allow custom error pages to
be supported for calls to evhttp_send_error() by both calling
applications and Libevent itself.
A backward-incompatible change has been made to the title of error pages
sent by evhttp_send_error(). The original version of the function used
the reason argument as part of the title. That might have unforeseen
side-effects if it contains HTML tags. Therefore the title has been
changed to always use the standard status text.
An example of the error callback can be found in this
[version](https://github.com/libevent/libevent/files/123607/http-server.zip)
of the 'http-server' sample. It will output error pages with very bright
backgrounds, the error code using a very large font size and the reason.
Closes: #323 (cherr-picked from PR)
               | 
            
            
              
   
               | 
              
f76456b0
               | 
              
2019-12-04T17:56:54
               | 
              
               | 
              
Add support for priority inheritance
Add support for posix mutex priority inheritance. This is important to
avoid priority inversion in systems running with threads with different
priorities.
Signed-off-by: Andre Azevedo <andre.azevedo@gmail.com>
               | 
            
            
              
   
               | 
              
9fecb59a
               | 
              
2019-10-29T15:48:53
               | 
              
               | 
              
Parse IPv6 scope IDs.
               | 
            
            
              
   
               | 
              
5aae74d7
               | 
              
2019-09-21T23:37:38
               | 
              
               | 
              
improve the description of parameter to evbuffer_read()
               | 
            
            
              
   
               | 
              
620a3fa1
               | 
              
2019-08-29T19:40:10
               | 
              
               | 
              
Doxygen documentation improvements
- Documentation for `bufferevent_compat.h` and `rpc.h` is not generated
  since the `@file` command is missing. It can be fixed by adding
  `@file` in file comment block.
- The briefs of buffer.h,bufferevent.h and some other files are missing.
  Adding `@brief` command can fix it.
- The parameters in the function declaration are different from the
  parameters following the `@param` command.We should change them to the
  same.
- Documentation of `watch.h` is not generated since `watch.h` has not
  been added to the Doxyfile `INPUT` tag.
- Add link to the watch.h in event.h
               | 
            
            
              
   
               | 
              
bdcade47
               | 
              
2019-07-31T10:34:38
               | 
              
               | 
              
buffer: fix possible NULL dereference in evbuffer_setcb() on ENOMEM
[ @azat:
  - add return heredoc for evbuffer_setcb()
  - add unit test with event_set_mem_functions()
  - look through the report from abi-compliance-checker/abi-dumper
]
Closes: #855
               | 
            
            
              
   
               | 
              
5388a002
               | 
              
2019-06-26T09:36:49
               | 
              
               | 
              
autotools: do not install bufferevent_ssl.h under --disable-openssl
Refs: https://github.com/libevent/libevent/issues/760#issuecomment-502345788
               | 
            
            
              
   
               | 
              
538141eb
               | 
              
2019-06-15T23:18:05
               | 
              
               | 
              
evdns: add new options -- so-rcvbuf/so-sndbuf
This will allow to customize SO_RCVBUF/SO_SNDBUF for nameservers in this
evdns_base, you may want to adjust them if the kernel starts dropping
udp packages.
               | 
            
            
              
   
               | 
              
c03dabd7
               | 
              
2019-05-31T02:12:55
               | 
              
               | 
              
typo error in header file
               | 
            
            
              
   
               | 
              
5e137f37
               | 
              
2014-12-08T17:32:07
               | 
              
               | 
              
Implement bufferevent_socket_connect_hostname_hints()
So that ai_flags (such as AI_ADDRCONFIG) can be specified.
Closes: #193 (cherry-picked with conflicts resolved)
               | 
            
            
              
   
               | 
              
176fd566
               | 
              
2019-04-16T21:12:21
               | 
              
               | 
              
Protect min_heap_push_ against integer overflow.
Converting unsigned to size_t for size of memory objects allows
proper handling of very large heaps on 64 bit systems.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #799 (cherry-picked)
               | 
            
            
              
   
               | 
              
8dcb94a4
               | 
              
2016-01-08T13:36:20
               | 
              
               | 
              
Added http method extending
User can define his own response method by calling
evhttp_set_ext_method_cmp() on the struct http, or
evhttp_connection_set_ext_method_cmp() on the connection.
We expose a new stucture `evhttp_ext_method` which is passed to the
callback if it's set. So any field can be modified, with some exceptions
(in evhttp_method_):
If the cmp function is set, it has the ability to modify method, and
flags. Other fields will be ignored. Flags returned are OR'd with the
current flags.
Based on changes to the #282 from: Mark Ellzey <socket@gmail.com>
               | 
            
            
              
   
               | 
              
96e56beb
               | 
              
2019-04-02T15:43:35
               | 
              
               | 
              
http: Update allowed_methods field from 16 to 32bits.
               | 
            
            
              
   
               | 
              
55f9863b
               | 
              
2019-04-04T09:09:09
               | 
              
               | 
              
Remove experimental note for finalizers API
               | 
            
            
              
   
               | 
              
2f184f8b
               | 
              
2019-03-26T13:33:57
               | 
              
               | 
              
evwatch: Add "prepare" and "check" watchers.
Adds two new callbacks: "prepare" watchers, which fire immediately
before we poll for I/O, and "check" watchers, which fire immediately
after we finish polling and before we process events. This allows other
event loops to be embedded into libevent's, and enables certain
performance monitoring.
Closes: #710
               | 
            
            
              
   
               | 
              
e5b8f4c1
               | 
              
2019-04-01T01:47:00
               | 
              
               | 
              
evdns: add DNS_OPTION_NAMESERVERS_NO_DEFAULT/EVDNS_BASE_NAMESERVERS_NO_DEFAULT
- DNS_OPTION_NAMESERVERS_NO_DEFAULT
  Do not "default" nameserver (i.e. "127.0.0.1:53") if there is no nameservers
  in resolv.conf, (iff DNS_OPTION_NAMESERVERS is set)
- EVDNS_BASE_NAMESERVERS_NO_DEFAULT
  If EVDNS_BASE_INITIALIZE_NAMESERVERS isset, do not add default
  nameserver if there are no nameservers in resolv.conf (just set
  DNS_OPTION_NAMESERVERS_NO_DEFAULT internally)
Fixes: #569
               | 
            
            
              
   
               | 
              
3e0dc1a6
               | 
              
2019-04-01T01:40:18
               | 
              
               | 
              
evdns: add descriptions for DNS_OPTION_*/DNS_OPTIONS_ALL
               | 
            
            
              
   
               | 
              
5357c3d6
               | 
              
2019-03-16T17:32:17
               | 
              
               | 
              
Adjust evbuffer max read for bufferevents
               | 
            
            
              
   
               | 
              
8c2001e9
               | 
              
2019-03-16T17:09:51
               | 
              
               | 
              
Maximum evbuffer read configuration
Before this patch evbuffer always reads 4K at a time, while this is fine
most of time you can find an example when this will decrease throughput.
So add an API to change default limit:
- evbuffer_set_max_read()
- evbuffer_get_max_read()
And a notice that most of time default is sane.
               | 
            
            
              
   
               | 
              
68eb526d
               | 
              
2019-03-13T10:51:55
               | 
              
               | 
              
http: add WebDAV methods support
WebDAV introduced new HTTP methods (RFC4918):
PROPFIND, PROPPATCH, MKCOL, LOCK, UNLOCK, COPY, MOVE.
Add support of the methods.
               | 
            
            
              
   
               | 
              
5ee507c8
               | 
              
2019-03-04T06:53:42
               | 
              
               | 
              
http: implement separate timeouts for read/write/connect phase
This patch allows to change timeout for next events read/write/connect
separatelly, using new API:
- client:
  evhttp_connection_set_connect_timeout_tv() -- for connect
  evhttp_connection_set_read_timeout_tv()    -- for read
  evhttp_connection_set_write_timeout_tv()   -- for write
- server:
  evhttp_set_read_timeout_tv()  -- for read
  evhttp_set_write_timeout_tv() -- for write
It also changes a logic a little, before there was next fallbacks which
does not handled in new API:
- HTTP_CONNECT_TIMEOUT
- HTTP_WRITE_TIMEOUT
- HTTP_READ_TIMEOUT
And introduce another internal flag (EVHTTP_CON_TIMEOUT_ADJUSTED) that
will be used in evrpc, which adjust evhttp_connection timeout only if it
is not default.
Fixes: #692
Fixes: #715
               | 
            
            
              
   
               | 
              
62df1301
               | 
              
2014-12-09T21:43:18
               | 
              
               | 
              
Add support for EV_TIMEOUT to event_base_active_by_fd
Closes: #194 (cherry-pick)
               | 
            
            
              
   
               | 
              
5f87be42
               | 
              
2019-02-25T11:59:15
               | 
              
               | 
              
Define `_GNU_SOURCE` properly/consistently per autoconf
Although `_GNU_SOURCE` can be defined as an arbitrary #define per the
glibc docs [1], it's best to define it in a manner consistent with the way
that autoconf defines it, i.e., `1`.
While this shouldn't matter in most cases, it does when the headers from
other projects follow the poorly defined GNU convention implemented by
autoconf and are included after the libevent's util.h header. An example
failure with clang, similar to the failure I encountered, is as follows:
```
$ printf "#define _GNU_SOURCE\n#define _GNU_SOURCE 1" | clang -c -x c -
<stdin>:2:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
        ^
<stdin>:1:9: note: previous definition is here
        ^
1 warning generated.
```
This happened when compiling python [2] with a stale homebrew util.h file from
libevent (which admittedly would not happen in a correct libevent install, as the
header should be installed under /usr/local/include/event2/util.h). However, if
both headers had been combined (which is more likely), it would have failed as
shown above.
Removing the ad hoc definition unbreaks compiling python's pyconfig.h.in header
when included after util.h from libevent.
1. http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
2. https://github.com/python/cpython/blob/master/configure.ac#L126
Closes: #773 (cherry-picked)
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
               | 
            
            
              
   
               | 
              
b29207dc
               | 
              
2019-01-29T21:12:33
               | 
              
               | 
              
Eliminate fd conversion warnings and introduce EVUTIL_INVALID_SOCKET (windows)
windows has intptr_t instead of regular int.
Also tt_fd_op() had been introduced, since we cannot use tt_int_op() for
comparing fd, since it is not always int.
               | 
            
            
              
   
               | 
              
99b231b0
               | 
              
2019-01-11T21:52:11
               | 
              
               | 
              
rpc: use *_new_with_arg() to match function prototype
In 755fbf16c ("Add void* arguments to request_new and reply_new
evrpc hooks") this new functions had been introduced, but newer used,
what for? So let's use them.
               | 
            
            
              
   
               | 
              
9cba915e
               | 
              
2018-10-28T19:30:34
               | 
              
               | 
              
Introduce EVENT_VISIBILITY_WANT_DLLIMPORT
And use it in places where event_debug() should be called (since it
requires access to "event_debug_logging_mask_" and in win32 it is
tricky).
One of this places that is covered by this patch is the test for
event_debug().
               | 
            
            
              
   
               | 
              
23e79fd7
               | 
              
2018-10-28T18:11:22
               | 
              
               | 
              
Check existence of IPV6_V6ONLY in evutil_make_listen_socket_ipv6only() (mingw32)
MinGW 32-bit 5.3.0 does not defines it and our appveyour [1] build
reports this instantly:
    evutil.c: In function 'evutil_make_listen_socket_ipv6only':
    evutil.c:392:40: error: 'IPV6_V6ONLY' undeclared (first use in this function)
      return setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*) &one,
  [1]: https://www.appveyor.com/docs/windows-images-software/#mingw-msys-cygwin
Another solution will be to use mingw64 which has it, but I guess we do
want that #ifdef anyway.
               | 
            
            
              
   
               | 
              
26ef859a
               | 
              
2018-10-27T17:21:35
               | 
              
               | 
              
Add evhttp_parse_query_str_flags()
And a set of flags:
- EVHTTP_URI_QUERY_LAST
- EVHTTP_URI_QUERY_NONCONFORMANT
Fixes: #15
               | 
            
            
              
   
               | 
              
387d91f9
               | 
              
2018-06-04T16:43:34
               | 
              
               | 
              
listener: ipv6only socket bind support
According to RFC3493 and most Linux distributions, default value is to
work in IPv4-mapped mode. If there is a requirement to bind same port
on same ip addresses but different handlers for both IPv4 and IPv6,
it is required to set IPV6_V6ONLY socket option to be sure that the
code works as expected without affected by bindv6only sysctl setting
in system.
See an example working with this patch:
https://gist.github.com/demirten/023008a63cd966e48b0ebcf9af7fc113
Closes: #640 (cherry-pick)
               | 
            
            
              
   
               | 
              
5a455acd
               | 
              
2018-10-17T23:21:17
               | 
              
               | 
              
Fix hangs due to watermarks overruns in bufferevents implementations
Some implementations of bufferevents (for example openssl) can overrun
read high watermark.
And after this if user callback will not drain enough data it will be
suspended (i.e. it will not be runned again anymore).
This is not the expecting behaviour as one may guess, since in this case
the data will never be read. Hence once we detected that the watermark
exceeded (even after calling user callback) we will schedule the
callback again.
This also can be fixed in bufferevent openssl implementation (by
strictly limiting how much data is added to the read buffer according to
read high watermark), but since this data is already available (and in
memory) there is no point in doing so.
               | 
            
            
              
   
               | 
              
30d77f1b
               | 
              
2018-07-05T11:25:24
               | 
              
               | 
              
Fix typo
Closes: #658
               | 
            
            
              
   
               | 
              
d2acf67e
               | 
              
2018-06-16T17:39:34
               | 
              
               | 
              
Add convenience macros for user-triggered events
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Closes: #647 (picked)
               | 
            
            
              
   
               | 
              
c57f5c34
               | 
              
2018-05-07T02:39:44
               | 
              
               | 
              
Make rpc headers self-compilable
Fixes: #633
               | 
            
            
              
   
               | 
              
1af80176
               | 
              
2018-04-30T18:13:45
               | 
              
               | 
              
[core] re-order fields in struct event for memory efficiency
The sizeof `struct event` can reduced on both 32 bit and 64 bit systems
by moving the 4 bytes that make up `ev_events` and `ev_res` below `ev_fd`,
before `struct event_base * ev_base;` since our compiler wouldn't dare do
such a thing (it instead will pad twice, whereas it only needs to be padded
once)
```C
struct event {
                                                         /*  OFFS |  SZ   Bytes  | Total Bytes | START - END  */
    struct event_callback ev_evcallback;                 /*   0x0 |  40          | 40          | 0x0   - 0x28 */
    union {                                              /*  0x28 |  ----------- | ----------- | ------------ */
        TAILQ_ENTRY(event) ev_next_with_common_timeout;  /*       |       ((16)) |             |              */
        int min_heap_idx;                                /*       |       ((04)) |             |              */
    }   ev_timeout_pos;                                  /*       |  16          | 56          | 0x28  - 0x38 */
    int ev_fd;                                           /*  0x38 |  04          | 60          | 0x38  - 0x3c */
```
Since the next field is 8 bytes in length, and we are up to 60 bytes, `ev_fd` ends up being padded (4 more bytes on 64b).
```C
                              /* --- 1 byte gap HERE --->            1           | <61>                      */
                              /* --- 1 byte gap HERE --->            1           | <62>                      */
                              /* --- 1 byte gap HERE --->            1           | <63>                      */
                              /* --- 1 byte gap HERE --->            1           | <64>                      */
    struct event_base * ev_base;                         /*  0x3c |  8           | 68         | 0x3c - 0x40  */
    union {                                              /*  0x40 | ------------ | ---------- | ------------ */
        struct {                                         /*       | ------------ |            |              */
            LIST_ENTRY (event) ev_io_next;               /*       |       ((16+  |            |              */
            struct timeval ev_timeout;                   /*       |         16)) |            |              */
        } ev_io;                                         /*       | ((32))       |            |              */
        struct {                                         /*       | ------------ |            |              */
            LIST_ENTRY (event) ev_signal_next;           /*       |      ((16+   |            |              */
            short   ev_ncalls;                           /*       |        02+   |            |              */
            short * ev_pncalls;                          /*       |        08))  |            |              */
        } ev_signal;                                     /*       | ((26))       |            |              */
    } ev_;                                               /*  0x60 | 32           | 100        | 0x40 - 0x60  */
    short ev_events;                                     /*  0x60 | 2            | 102        | 0x60 - 0x62  */
    short ev_res;                                        /*  0x62 | 2            | 104        | 0x62 - 0x64  */
```
We now hit another line, `struct timeval` is 16 bytes on 64b arch, so we have 4 more bytes
of padding on `ev_res`.
```C
    /* --- 1 byte gap HERE --- */
    /* --- 1 byte gap HERE --- */
    /* --- 1 byte gap HERE --- */
    /* --- 1 byte gap HERE --- */
    struct timeval ev_timeout;                           /*  0x64 | 16           | 120        | 0x64 - 0x74  */
};
```
After moving `ev_events` and `ev_res` below `ev_fd` we have something
a bit more optimal:
```C
struct event2 {
                                                         /*  OFFS |  SZ / Bytes  | RSUM Bytes | START - END  */
    struct event_callback ev_evcallback;                 /*   0x0 | 40           | 40         | 0x0   - 0x28 */
    union {                                              /*  0x28 | ------------ | ---------- | ------------ */
        TAILQ_ENTRY(event) ev_next_with_common_timeout;  /*       |       ((16)) |            |              */
        int min_heap_idx;                                /*       |       ((04)) |            |              */
    } ev_timeout_pos;                                    /*       | 16           | 56         | 0x28  - 0x38 */
    int ev_fd;                                           /*  0x38 | 4            | 60         | 0x38  - 0x3c */
    short ev_events;                                     /*  0x3c | 2            | 62         | 0x3c  - 0x3e */
    short ev_res;                                        /*  0x3e | 2            | 64         | 0x3e  - 0x40 */
    struct event_base * ev_base;                         /*  0x40 | 8            | 74         | 0x40  - 0x48 */
    union {                                              /*  0x48 | ------------ | ---------- | ------------ */
        struct {                                         /*       | ------------ |            |              */
            LIST_ENTRY (event) ev_io_next;               /*       |        ((16+ |            |              */
            struct timeval ev_timeout;                   /*       |         16)) |            |              */
        } ev_io;                                         /*       | ((32))       |            |              */
        struct {                                         /*       | ------------ |            |              */
            LIST_ENTRY (event) ev_signal_next;           /*       |       ((16+  |            |              */
            short   ev_ncalls;                           /*       |         02+  |            |              */
            short * ev_pncalls;                          /*       |         08)) |            |              */
        } ev_signal;                                     /*       | ((26))       |            |              */
    } ev_;                                               /*       | 32           | 106        | 0x48 - 0x68  */
    struct timeval ev_timeout;                           /* 0x68  | 16           | 120        | 0x68 - 0x78  */
};
```
We still have a gap here, but the first was removed.
Again, we can save 8 bytes on both 32 and 64 word sizes (32/64 byte cacheline).
Below are the results for testing v2.1.6 -> master -> master + this patch (Release/-O3)
Code:
```C
  #include <event2/event.h>
  int
  main(int argc, char ** argv) {
      printf("%zu\n", event_get_struct_event_size());
      return 0;
  }
```
Branch: `master` (2.2.x)
```
  $ gcc -O3 -Wall -Wl,-R/usr/local/lib bleh.c -L/usr/local/lib -o bleh  -levent
  $ ldd bleh
      linux-vdso.so.1 =>  (0x00007ffc3df50000)
      libevent.so.2.2.0 => /usr/local/lib/libevent.so.2.2.0 (0x00007f91fd781000)
      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f91fd3a1000)
      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f91fd182000)
      /lib64/ld-linux-x86-64.so.2 (0x00007f91fdbcc000)
  $ ./bleh
  128
```
Release: `2.1.6`
```
  $ gcc -O3 bleh.c -o bleh  -levent
  $ ldd bleh
      linux-vdso.so.1 =>  (0x00007ffd43773000)
      libevent-2.1.so.6 => /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6 (0x00007feb3add6000)
      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feb3a9f6000)
      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007feb3a7d7000)
      /lib64/ld-linux-x86-64.so.2 (0x00007feb3b22a000)
  $ ./bleh
  128
```
Branch: `this one`
```
  $ gcc -O3 -Wl,-R./lib bleh.c -o bleh -L./lib -levent
  $ ldd bleh
      linux-vdso.so.1 =>  (0x00007ffff55f7000)
      libevent.so.2.2.0 => ./lib/libevent.so.2.2.0 (0x00007ff8e5c82000)
      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff8e58a2000)
      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff8e5683000)
      /lib64/ld-linux-x86-64.so.2 (0x00007ff8e60cd000)
  $ ./bleh
  120
```
               | 
            
            
              
   
               | 
              
791e3de0
               | 
              
2018-04-03T15:43:22
               | 
              
               | 
              
Generating evdns_base_config_windows_nameservers docs on all platforms
               | 
            
            
              
   
               | 
              
2c156294
               | 
              
2018-04-03T15:17:51
               | 
              
               | 
              
Fixing doxygen docs for evdns_base_search_clear when generated on non-windows machines
               | 
            
            
              
   
               | 
              
c62f73f5
               | 
              
2018-01-30T15:39:41
               | 
              
               | 
              
Added evhttp max simultaneous connection limiting
               | 
            
            
              
   
               | 
              
f24b28e4
               | 
              
2018-01-15T17:30:08
               | 
              
               | 
              
Fix typos in comments
               | 
            
            
              
   
               | 
              
727bcea1
               | 
              
2017-12-01T01:29:32
               | 
              
               | 
              
http: add callback to allow server to decline (and thereby close) incoming connections.
This is important, as otherwise clients can easily exhaust the file
descriptors available on a libevent HTTP server, which can cause
problems in other code which does not handle EMFILE well: for example,
see https://github.com/bitcoin/bitcoin/issues/11368
Closes: #578 (patch cherry picked)
               | 
            
            
              
   
               | 
              
b49c70cc
               | 
              
2017-11-05T12:18:49
               | 
              
               | 
              
Fix incorrect ref to evhttp_get_decoded_uri in http.h
Replaces reference in the http.h include header file to evhttp_get_decoded_uri
with evhttp_uridecode. There is no function called evhttp_get_decoded_uri.
               | 
            
            
              
   
               | 
              
5698cff7
               | 
              
2017-08-17T01:37:01
               | 
              
               | 
              
always define EV_INT16_MIN
somehow missing from 043ae7481f4a73b0f48055a0260afa454f02d136
               | 
            
            
              
   
               | 
              
e83443ec
               | 
              
2017-07-16T21:40:18
               | 
              
               | 
              
Merge remote-tracking branch 'official/pr/527' -- documentation fixes
* official/pr/527:
  Fix a few trivial documentation typos
  Clarify event_free() documentation regarding pending/active events
               | 
            
            
              
   
               | 
              
c3a61a13
               | 
              
2017-07-07T01:24:26
               | 
              
               | 
              
Fix a few trivial documentation typos
               | 
            
            
              
   
               | 
              
2137886d
               | 
              
2017-07-07T01:22:43
               | 
              
               | 
              
Clarify event_free() documentation regarding pending/active events
Currently it's not clear as to whether "first make it non-pending and
non-active" sentence requires user to take some action (e.g. call event_del(),
which event_free() already does internally) or just describes what this
function does from the developer point of view.
               | 
            
            
              
   
               | 
              
80852425
               | 
              
2017-06-30T02:27:08
               | 
              
               | 
              
Document some obvious cases where a function might also return NULL
Closes: #525
               | 
            
            
              
   
               | 
              
cd285e42
               | 
              
2017-05-29T22:11:48
               | 
              
               | 
              
Fix event_debug_logging_mask_ exporting on win32
               | 
            
            
              
   
               | 
              
ce3af533
               | 
              
2017-05-29T15:04:50
               | 
              
               | 
              
Fix visibility issues under (mostly on win32)
Refs: #511
Fixes: 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED and
STATIC libraries (like autoconf does)")
               | 
            
            
              
   
               | 
              
266f43af
               | 
              
2017-03-27T15:50:23
               | 
              
               | 
              
Fix arc4random_addrandom() detecting and fallback (regression)
But this is kind of hot-fix, we definitelly need more sane arc4random
compat layer.
Fixes: #488
Introduced-in: 6541168 ("Detect arch4random_addrandom() existence")
               | 
            
            
              
   
               | 
              
92cf234b
               | 
              
2017-03-14T00:33:26
               | 
              
               | 
              
log/win32: fix exporting extern variable
  ==> win:   C:\vagrant\log.c(73): error C2370: 'event_debug_logging_mask_' : redefinition; different storage class [C:\vagrant\.cmake-vagrant\event_core_shared.vcxproj]
               | 
            
            
              
   
               | 
              
30f2a969
               | 
              
2017-03-14T00:07:17
               | 
              
               | 
              
cmake: eliminate EVENT_BUILDING_REGRESS_TEST, since we link with shared libs
Before 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED
and STATIC libraries (like autoconf does)") it links with *.c.
               | 
            
            
              
   
               | 
              
7182c2f5
               | 
              
2017-03-12T23:31:59
               | 
              
               | 
              
cmake: build SHARED and STATIC libraries (like autoconf does)
Since they are useful for debugging, and if autotools build them then
cmamke has to do this too, to make migration more simple.
And now:
- tests: uses shared libraries (since this is upstreams one)
- other binaries: uses static libraries
This removes next private config:
- EVENT__NEED_DLLIMPORT
               | 
            
            
              
   
               | 
              
72ef9d16
               | 
              
2016-11-07T00:46:45
               | 
              
               | 
              
cmake: add missing event_openssl/event_pthreads libraries
This will remove openssl requirement if you don't use it (i.e. if you
not link with openssl_pthreads).
Plus it fixes some linking dependencies:
- libm required only for test-ratelim
And fix some coding style alignment issues.
Refs: #246
               | 
            
            
              
   
               | 
              
9081b66c
               | 
              
2017-03-12T20:50:35
               | 
              
               | 
              
Export symbols for -fvisibility=hidden (under cmake)
Fixes: #442
               | 
            
            
              
   
               | 
              
6541168d
               | 
              
2017-03-06T00:55:16
               | 
              
               | 
              
Detect arch4random_addrandom() existence
Refs: #370
Refs: #475
               | 
            
            
              
   
               | 
              
4545807d
               | 
              
2016-12-19T10:22:51
               | 
              
               | 
              
Fix UB in evutil_date_rfc1123()
As pointed in https://github.com/libevent/libevent/pull/417#issuecomment-267860738
  "code is unsafe because in evutil_date_rfc1123() the pointer to the
  automatic variable struct tm cur is used outside the scope it defined."
Checked with `clang -fsanitize=address -fsanitize-address-use-after-scope`
and test that call evutil_date_rfc1123() with tm==NULL
               | 
            
            
              
   
               | 
              
db60ade8
               | 
              
2016-11-10T21:58:15
               | 
              
               | 
              
http: do not use local settings for Date header
               | 
            
            
              
   
               | 
              
e9837124
               | 
              
2014-12-13T19:42:42
               | 
              
               | 
              
use ev_uint16_t instead of unsigned short for port
Like in `sockaddr_in` structure in /usr/include/netinet/in.h
@azat: convert all other users (bench, compat, ..) and tweak message
Fixes: #178
Fixes: #196
Refs: 6bf1ca78
Link: https://codereview.appspot.com/156040043/#msg4
               | 
            
            
              
   
               | 
              
30316177
               | 
              
2016-06-28T10:37:24
               | 
              
               | 
              
[#372] check for errno.h
               | 
            
            
              
   
               | 
              
9fde5189
               | 
              
2016-02-15T00:12:54
               | 
              
               | 
              
http: lingering close (like nginx have) for entity-too-large
By lingering close I mean something what nginx have for this name, by this term
I mean that we need to read all the body even if it's size greater then
`max_body_size`, otherwise browsers on win32 (including chrome) failed read the
http status - entity-too-large (while on linux chrome for instance are good),
and also this includes badly written http clients.
Refs: #321
v2: do this only under EVHTTP_SERVER_LINGERING_CLOSE
               | 
            
            
              
   
               | 
              
680742e1
               | 
              
2016-02-10T14:43:18
               | 
              
               | 
              
http: read server response even after server closed the connection
Otherwise if we will try to write more data than server can accept
(see `evhttp_set_max_body_size()` for libevent server) we will get `EPIPE` and
will not try to read server's response which must contain 400 error for now
(which is not strictly correct though, it must 413).
```
  $ strace regress --no-fork http/data_length_constraints
  ...
  connect(10, {sa_family=AF_INET, sin_port=htons(43988), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
  ...
  writev(10, [{"POST / HTTP/1.1\r\nHost: somehost\r"..., 60}, {"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 16324}], 2) = 16384
  epoll_wait(5, [{EPOLLOUT, {u32=10, u64=10}}, {EPOLLIN, {u32=11, u64=11}}], 32, 50000) = 2
  writev(10, [{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 16384}], 1) = 16384
  ioctl(11, FIONREAD, [32768])            = 0
  readv(11, [{"POST / HTTP/1.1\r\nHost: somehost\r"..., 4096}], 1) = 4096
  epoll_ctl(5, EPOLL_CTL_DEL, 11, 0x7fff09d41e50) = 0
  epoll_ctl(5, EPOLL_CTL_ADD, 11, {EPOLLOUT, {u32=11, u64=11}}) = 0
  epoll_wait(5, [{EPOLLOUT, {u32=10, u64=10}}, {EPOLLOUT, {u32=11, u64=11}}], 32, 50000) = 2
  writev(10, [{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 16384}], 1) = 16384
  writev(11, [{"HTTP/1.1 400 Bad Request\r\nConten"..., 129}, {"<HTML><HEAD>\n<TITLE>400 Bad Requ"..., 94}], 2) = 223
  epoll_ctl(5, EPOLL_CTL_DEL, 11, 0x7fff09d42080) = 0
  shutdown(11, SHUT_WR)                   = 0
  close(11)                               = 0
  epoll_wait(5, [{EPOLLOUT|EPOLLERR|EPOLLHUP, {u32=10, u64=10}}], 32, 50000) = 1
  writev(10, [{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 16384}], 1) = -1 EPIPE (Broken pipe)
  --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=13954, si_uid=1000} ---
  epoll_ctl(5, EPOLL_CTL_DEL, 10, 0x7fff09d42010) = 0
  shutdown(10, SHUT_WR)                   = -1 ENOTCONN (Transport endpoint is not connected)
  close(10)                               = 0
  write(1, "\n  FAIL ../test/regress_http.c:3"..., 37
```
Careful reader can ask why it send error even when it didn't read
`evcon->max_body_size`, and the answer will be checks for `evcon->max_body_size
against `Content-Length` header, which contains ~8MB (-2 bytes).
And also if we will not drain the output buffer than we will send buffer that
we didn't send in previous request and instead of sending method via
`evhttp_make_header()`.
Fixes: http/data_length_constraints
Refs: #321
v2: do this only under EVHTTP_CON_READ_ON_WRITE_ERROR flag
               | 
            
            
              
   
               | 
              
4dc09795
               | 
              
2016-02-15T02:59:40
               | 
              
               | 
              
http: fix conflicts EVHTTP_CON_AUTOFREE and EVHTTP_CON_REUSE_CONNECTED_ADDR
And we can't make them continuous, since the latest is a public API, and
otherwise we will break binary compatibility.
Also extra check for EVHTTP_CON_PUBLIC_FLAGS_END, in case somebody forgot about
this (implementer I mean).
Refs: #182
               | 
            
            
              
   
               | 
              
bb6b53d0
               | 
              
2016-01-12T01:35:46
               | 
              
               | 
              
visibility: align it to make it more readable
               | 
            
            
              
   
               | 
              
a264da86
               | 
              
2015-12-20T00:57:50
               | 
              
               | 
              
Revert "The Windows socket type is defined as SOCKET."
               | 
            
            
              
   
               | 
              
c9e6c3d7
               | 
              
2015-12-16T11:17:36
               | 
              
               | 
              
The Windows socket type is defined as SOCKET.
Under the hood it's an unsigned rather than a signed type and whilst C
compilers are largely happy with this C++ compilers tend to be fussy
about class function signatures which makes C++ usage of libevent
problematic.
               |