4869 Commits

Author SHA1 Message Date
Dmitry Ilyin
f39ad1c494
ws: replace evws_send with evws_send_text/evws_send_binary (ABI breakage) (#1500)
Replace evws_send with evws_send_text, and introduce new API -
evws_send_binary, that can be used to send binary frames.

But note, that this commit breaks the ABI compatibility, but it should be OK,
since there was only alpha release with evws_send, and nobody should rely on
this, and I hope nobody does (we decided to go this way to avoid supporting
deprecated API).
2023-08-31 21:38:41 +02:00
Michael Davidsaver
21d2f5a415 Fixes #include of winsock.h before winsock2.h 2023-08-27 09:12:27 +03:00
Michael Davidsaver
c9ec6aafb6 Update cmake policy wrt. RPATH on OSX
Previous settings caused install outside CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
to use install_name "lib/" in place of the expected (and useful) "@rpath/".
2023-08-02 21:05:54 +02:00
Michael Davidsaver
3c29a81b8b fixup RPATH computation
Handle cases where ${CMAKE_INSTALL_LIBDIR} is not ${CMAKE_INSTALL_PREFIX}/lib .
Also, preserve user provided ${CMAKE_INSTALL_RPATH} .

fixup for 41a7393f3ecd1e9f58331df4653dac2e6739304e
2023-07-31 10:51:20 +02:00
Azat Khuzhin
66b3904b30
Merge pull request #1498 from mdavidsaver/cleanup-_WIN32_WINNT 2023-07-29 22:27:31 +02:00
Michael Davidsaver
f76bd641f2 increment _WIN32_WINNT in evutil.c 2023-07-29 08:12:33 -07:00
Michael Davidsaver
126523f9ce fix prototype of evutil_check_working_afunix_()
mingw w/ gcc 12 defaults to -Wstrict-prototype which complains
about K&R style argument lists.
2023-07-25 11:01:41 -07:00
Michael Davidsaver
a14ff91254 move _WIN32_WINNT defintions before first #include
_WIN32_WINNT and WIN32_LEAN_AND_MEAN need to be defined
before the windows.h is included for the first time.
Avoid the confusion of indirect #include by defining
before any.
2023-07-25 10:52:10 -07:00
Azat Khuzhin
6db587dedb Merge branch 'scorecard-action' (#1494)
* scorecard-action:
  docs(readme): add scorecard badge
  Enable Scorecard GitHub Action
2023-07-16 15:23:17 +02:00
Diogo Teles Sant'Anna
e26e064762 docs(readme): add scorecard badge 2023-07-16 15:22:38 +02:00
Diogo Teles Sant'Anna
613581bbcf Enable Scorecard GitHub Action 2023-07-16 15:22:38 +02:00
Azat Khuzhin
7b302e7dbe Merge branch 'disable-signalfd'
* disable-signalfd:
  Increase timeout for tests
  Disable signalfd by default
2023-07-13 21:21:58 +02:00
Azat Khuzhin
3d1d7548cd Increase timeout for tests
Now, it 20min for sequential runs is not enough already, I've tested it
on t3.medium manually and got the same:

    Total Test time (real) = 1275.03 sec

And also if I run tests in parallel then I had few failures:

    bufferevent/bufferevent_connect_fail:
      FAIL /root/libevent/test/regress_bufferevent.c:865: didn't fail? what 128
      FAIL /root/libevent/test/regress_bufferevent.c:906: assert(test_ok == 1): 0 vs 1
      FAIL /root/libevent/test/regress_bufferevent.c:839: assert(n_events_invoked == 1): 2 vs 1bufferevent/bufferevent_connect_fail_eventcb_defer:
      FAIL /root/libevent/test/regress_bufferevent.c:839: assert(n_events_invoked == 1): 2 vs 1bufferevent/bufferevent_connect_fail_eventcb: 3/386 TESTS FAILED. (45 skipped)

v2: Increase timeout more (for netbsd)
2023-07-13 21:21:26 +02:00
Azat Khuzhin
57d9eec641 Disable signalfd by default
signalfd may behave differently to sigaction/signal, so to avoid
breaking libevent users (like [1], [2]) disable it by default.

  [1]: https://github.com/tmux/tmux/pull/3621
  [2]: https://github.com/tmux/tmux/pull/3626

Also signalfd is not that perfect:
- you need to SIG_BLOCK the signal before
  - blocked signals are not reset on exec
  - blocked signals are allowed to coalesce - so in case of multiple
    signals sent you may get the signal only once (ok for most of the
    signals, but may be a problem for SIGCHLD, though you may call
    waitpid() in a loop or use pidfd)
- and also one implementation problem -
  sigprocmask is unspecified in a multithreaded process

Refs:
- https://lwn.net/Articles/415684/
- https://ldpreload.com/blog/signalfd-is-useless

Refs: https://github.com/libevent/libevent/issues/1460
Refs: #1342 (cc @dmantipov)
2023-07-13 21:21:09 +02:00
Vladislav Gusev
227510d577
Fix EVDNS_BASE_DISABLE_WHEN_INACTIVE (#1493)
I faced with strange problem: event loop doesn't exit after dns resolving with
`EVDNS_BASE_DISABLE_WHEN_INACTIVE`.

Stand:
- Ubuntu 22;
- libevent release-2.1.12-stable
- `resolve.conf` contains 2 nameservers;
- I use `evdns_base_new` with `EVDNS_BASE_DISABLE_WHEN_INACTIVE | EVDNS_BASE_INITIALIZE_NAMESERVERS` to avoid OS specific code.

After small investigation, look like events related with dns sockets added to
event_base before `evdns->disable_when_inactive` was initialized. `libevent`
did epoll_ctl(DEL) after resolving completed on the first socket, but the
second socket remained in the `epoll` interest list.
2023-07-13 21:20:33 +02:00
mareksm
36ad1006c9 #1479: GCC12 error for EVUTIL_FALLTHROUGH 2023-07-07 20:26:58 +02:00
Azat Khuzhin
5ab24bddbe Merge branch 'becat-fixes'
* becat-fixes:
  becat: fix handling positional arguments
  becat: handle -T correctly
2023-06-28 21:33:47 +02:00
Azat Khuzhin
2b729238e5 becat: fix handling positional arguments 2023-06-28 21:33:41 +02:00
Azat Khuzhin
687124d018 becat: handle -T correctly 2023-06-28 21:33:41 +02:00
Azat Khuzhin
be4eb97dc2
Disable lazy gettimeofday/clock_gettime comparison (#1474) 2023-06-21 22:26:51 +03:00
Azat Khuzhin
2e31277207 Disable lazy gettimeofday/clock_gettime comparison
The benefit of this optimization is questionable for the following
reasons:
- libevent uses CLOCK_MONOTONIC_COARSE which is fast enough (on my
  desktop CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW works 40/50 millions of
  ops per second, and CLOCK_MONOTONIC_COARSE is faster)
- libevent has caching of time (EVENT_BASE_FLAG_NO_CACHE_TIME)

So I don't see any reason for using one more caching - lazy comparsion
(whatever you call it).
2023-06-21 09:47:07 +02:00
Krzysztof Dynowski
13366d2711 Test timer - synchronize clock before tv_timeout calculation. 2023-06-21 09:47:07 +02:00
Krzysztof Dynowski
4f993028be Synchronize clock before tv_timeout calculation. 2023-06-21 08:58:58 +02:00
FreeCipher
b30c0d0466
Use mm_* functions in evutil_inet_pton_scope (#1476) 2023-06-20 21:55:00 +02:00
Dave Hart
242f767684 Enable containing package CFLAGS etc.
Add AC_SUBST of LIBEVENT_FLAGS, LIBEVENT_CPPFLAGS, and LIBEVENT_LDFLAGS so they are relayed from the configure command line to the Makefile
2023-06-20 22:45:45 +03:00
Q_uan
57bb630ce3 Add __cplusplus in ws.h to fix compilation errors when using c++ compiler 2023-06-20 12:16:59 +03:00
Alex
b0194392fb
wepoll: replace default malloc/free with libevent mm_ variants (#1472)
This replaces malloc and free in wepoll.c with mm_malloc and mm_free. I'm using event-internal.h instead of mm-internal.h. Using only mm-internal.h in wepoll.c can cause errors regarding the export symbol macros.
2023-06-08 23:25:22 +02:00
Azat Khuzhin
45e24185f5
Merge pull request #1470 from mdavidsaver/auto-detect-ssl
Both cmake and autoconf are capable of automatically detecting the presence of OpenSSL and MbedTLS.  However, the present build time logic doesn't do this.

With cmake, my starting point is to preserve the reversed logic of `EVENT__DISABLE_OPENSSL` and `EVENT__DISABLE_MBEDTLS`, adding a third option `AUTO` as the new default.  I'm following the pattern of this [post on the cmake list](https://cmake.org/pipermail/cmake/2016-October/064342.html).  `OFF` and `ON` should continue with their present behaviors.

With autoconf, I've tried to implement what I understand to be conventional behavior.  eg. `--enable-openssl` and `--disable-openssl` should continue to have the same effect.  The default if neither is passed is equivalent to the new `--enable-openssl=auto`.

I've also added another commit removing what I think is an unnecessary `break` in `m4/libevent_mbedtls.m4`, which I suspect is leftover from some copy+paste from `m4/libevent_openssl.m4`.  Surprisingly to me, a `break` outside of any loop does not seem to be treated as an error.
2023-06-07 22:39:46 +02:00
Michael Davidsaver
7cd51ae1dd Add CI tests which require SSL libraries 2023-06-07 11:10:14 -07:00
Michael Davidsaver
9ce6ae78af Add option to auto-detect OpenSSL and MbedTLS 2023-06-07 11:10:14 -07:00
Michael Davidsaver
71848a237e libevent_mbedtls.m4 remove extraneous break
Maybe a leftover or copy+paste from a for loop
in libevent_openssl.m4 ?
2023-06-06 12:41:53 -07:00
Diogo Teles Sant'Anna
bca26524fc
Create Security Policy (#1462)
I've created the SECURITY.md file following a GitHub's template and considering the report vulnerability through security advisory, which is a handy new GitHub feature (but it's still in beta and has to be enabled).

Closes #1461
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
2023-05-25 07:05:28 +02:00
Leo Zhang
1418e793ad build: fix some new warnings
/opensource/libevent/sample/ws-chat-server.c:253:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
2023-05-25 07:00:35 +02:00
Azat Khuzhin
283a371f51 cmake: log when CMAKE_DEBUG_POSTFIX/CMAKE_BUILD_TYPE is changed 2023-05-23 21:46:14 +02:00
Azat Khuzhin
2112c3969a autotools: fix generating pkg-config files (by substituting CMAKE_DEBUG_POSTFIX)
Fixes: #1459
2023-05-22 08:48:06 +02:00
Daniel Engberg
4effaee523 cmake: Fix .pc files when building in Release mode
Don't define CMAKE_DEBUG_POSTFIX as this breaks Release builds, only apply when doing debug builds.
2023-05-22 08:14:42 +02:00
Azat Khuzhin
abc114e3c8 Bump default version when git tag is incorrect
Fixes: #1457
2023-05-21 12:49:34 +02:00
Azat Khuzhin
1c06b68fee Add a note about the last number in NUMERIC_VERSION 2023-05-21 10:10:18 +02:00
Azat Khuzhin
fe9dc8f614 Merge branch 'release-2.2-pull' - 2.2.1-alpha (#1380)
* release-2.2-pull:
  Bump version to 2.2.1
  Update ChangeLog and whatsnew for 2.2.1
  Update contributors (for 2.2 release)
release-2.2.1-alpha
2023-05-21 08:54:07 +02:00
Azat Khuzhin
8d1388a372 Bump version to 2.2.1 2023-05-21 08:47:42 +02:00
Azat Khuzhin
4e19e8b455 Update ChangeLog and whatsnew for 2.2.1 2023-05-21 08:47:39 +02:00
Azat Khuzhin
6ce568c38c Update contributors (for 2.2 release) 2023-05-20 18:19:31 +02:00
Azat Khuzhin
13ce3045c7 Merge branch 'changelog-improvements'
* changelog-improvements:
  Generate changelog in a reverse order
  Add PR number into the changelog
  Use authors of the real patches instead of merge commits
  Cleanup changelog.py
2023-05-20 18:19:04 +02:00
Azat Khuzhin
1fb3e6d79e Generate changelog in a reverse order 2023-05-20 18:18:57 +02:00
Azat Khuzhin
8b87ad48cb Add PR number into the changelog 2023-05-20 18:18:57 +02:00
Azat Khuzhin
fb2e1a6919 Use authors of the real patches instead of merge commits 2023-05-20 18:18:57 +02:00
Azat Khuzhin
c2e917d301 Cleanup changelog.py
- Use positional argument for revision range
- Remove unused import
- Add some todos
2023-05-20 18:18:57 +02:00
Azat Khuzhin
2c2ffb8d6e Revert "cmake: Only use relative paths for install DESTINATION option (#1405)"
After rebasing I broke the initial intention of this patch, so it simply
should be reverted.

This reverts commit 81c6b8823c1b58d7837e827bb1098aa5f9e5956b.
2023-05-20 16:00:44 +02:00
Azat Khuzhin
5324e482d0 Merge branch 'ssl-read-pull' - #1454
* ssl-read-pull:
  ssl: add some comments for lack of notify_close
  Drop unused le_ssl_ops::err_is_ok
  More SSL_read() to fill big buffer
  Make bufferevent_set_max_single_read() effect
2023-05-16 21:21:48 +02:00
Azat Khuzhin
49a7ae4c56 ssl: add some comments for lack of notify_close 2023-05-16 21:20:35 +02:00