5072 Commits

Author SHA1 Message Date
Azat Khuzhin
ca163ff1e1 test: fix retries of signal tests on apple 2024-10-29 09:28:53 +01:00
Azat Khuzhin
5e427ad98b test: rename signal tests (simple_signal and simple_signal_re_order) 2024-10-29 09:28:53 +01:00
David Goulet
f84896d37f
dns: Return DNS query type on error (#1220)
When calling the user callback after a DNS resolution on error, make
sure to send back the query type (A, AAAA, PTR).

Closes #1219

Signed-off-by: David Goulet <dgoulet@torproject.org>
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Co-authored-by: Azat Khuzhin <azat@libevent.org>
2024-10-28 21:50:29 +01:00
Azat Khuzhin
342a0faa50 Avoid loosing previously active events in case of EV_TIMEOUT
Previously all the existing events was lost if the timeout had been
triggered on that event.

Fixes: #1530
2024-10-28 23:46:18 +03:00
Andy Pan
528fbed184 kqueue: make changelist and eventlist of kevent share the same array
The array used by the changelist of the kevent() can be reused by the eventlist,
We should make use of this feature to eliminate the extra overhead of array allocation.

https://man.freebsd.org/cgi/man.cgi?kqueue
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kqueue.2.html
https://leaf.dragonflybsd.org/cgi/web-man?command=kqueue&section=2
https://man.netbsd.org/kqueue.2
https://man.openbsd.org/kqueue.2

---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-10-28 09:15:57 +03:00
Loganaden Velvindron
afb7f48344
arc4: drop 4096 bytes of the early keystream (#1586)
It might be safer to drop 4096 bytes to be on the safe side.

See: twitter.com/nugxperience/status/1773906926503591970
2024-10-27 17:30:44 +01:00
Cœur
ba0442bacc Improve hashsocket() (for win32) to avoid collisions
Fixes: 91e3ead
Refs: https://gist.github.com/azat/8a0a94e4de2d95af8f729b709589ce12
2024-10-27 15:55:12 +01:00
Cœur
b456e4bd82
Use arc4random_stir over deprecated arc4random_addrandom (#1631)
Co-authored-by: Azat Khuzhin <azat@libevent.org>
2024-10-26 20:46:41 +02:00
Kirill Rd
e30b215f34
Add caching for evdns (#1717)
No evdns will do caching by default (with respect to TTL), to disable this set EVDNS_BASE_NO_CACHE

There are also helpers for manually manage the cache:
- evdns_cache_write()
- evdns_cache_lookup()

Initial PR: #571
Fixes: #1715

Co-authored-by: Greg Hazel <ghazel@gmail.com>
Co-authored-by: Keith Moore <kmoore@clostra.com>
2024-10-24 08:28:53 +02:00
James
267e808eb7
Updated documentation for bufferevent_setcb() (#1733)
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
2024-10-23 22:54:31 +02:00
Azat Khuzhin
2a1ec766ed ci/openbsd: bump autoconf version to 2.72 2024-10-21 21:54:19 +02:00
Azat Khuzhin
b219226982 Fix notifying the base in a different thread after removing active timer event
The base should be notified in case of timer removal if that was the
minimal timer in the base.

Reported-by: @moihn (who is also provided the reproducer on which this
test is based on)
Fixes: https://github.com/libevent/libevent/issues/1727
2024-10-21 09:02:56 +02:00
Azat Khuzhin
970a258bc6
CI and tests fixes (#1719) 2024-10-21 10:02:33 +03:00
Azat Khuzhin
468be957cd
tests: add a test for event_free() from signal callback handler (#1729) 2024-10-21 09:58:38 +03:00
Kirill Rodriguez
ae635d4b5b
add explicit check for linux 2024-10-20 21:47:17 +01:00
Kirill Rodriguez
c923a184c6
getaddrinfo with localhost does not necessarily read files 2024-10-20 21:43:09 +01:00
Kirill Rodriguez
096c5fe584
update openbsd pkg names to 7.6 2024-10-20 21:43:09 +01:00
Kirill Rodriguez
5755befda6
fix a Werror error 2024-10-20 21:43:05 +01:00
Kirill Rodriguez
370d99244d
mbedtls3 does not support tls<1.3, and tls<1.3 does not support renegotiations. therefore, disable 2024-10-20 21:41:36 +01:00
Kirill Rodriguez
87c921f9fc
make sure cmake cache misses when configuration files change 2024-10-20 21:41:26 +01:00
Azat Khuzhin
dc37edc4ea Add a comment about handling event_free() for signals in event_signal_closure() 2024-10-20 21:59:13 +02:00
Azat Khuzhin
77fed76099 tests: add a test for event_free() from callback handler for signals
Refs: https://github.com/libevent/libevent/issues/1287
2024-10-20 21:57:02 +02:00
Kirill Rodriguez
2321506d41 replace mbedtls@2 with mbedtls 2024-10-04 07:42:45 +00:00
Azat Khuzhin
f6e426c299
Move find_dependency() directly to LibeventConfig.cmake (#1726) 2024-10-04 06:45:52 +03:00
Azat Khuzhin
e23924c293 Fix LibeventConfig.cmake in case of no OpenSSL
Previously it fails with, due to empty OPENSSL_FOUND:

    CMake Error at /home/runner/work/libevent/libevent/build/LibeventConfig.cmake:64 (if):
      if given arguments:

        "3.30.3" "VERSION_LESS" "3.15.0" "AND" "1" "AND" "AND" "TRUE"

      Unknown arguments specified
2024-10-03 21:31:59 +02:00
Azat Khuzhin
68e18761ae Move find_dependency() directly to LibeventConfig.cmake
Patch-by: @ahuj9
Fixes: https://github.com/libevent/libevent/issues/1711
Follow-up for: https://github.com/libevent/libevent/pull/1544 (cc @kurtlau)
2024-10-03 21:27:17 +02:00
Wu, Zhenyu
8f1e4bd937 fix typo: bufferevent_set_callbacks should be bufferevent_setcb 2024-10-03 10:15:06 +03:00
Kirill Rd
d681a0d4f9
CI fixes for openbsd/android/freebsd (#1721)
the following changes are introduced:

* openbsd CI fails with "too many open files", fixed with `ulimit -n` (now it fails for a more test-specific reasons)
* android CI fails with `pipe2` method not found, fixed by removing cache
* bumped freebsd to 13.4 (and 14.1) as they [reached EOL](https://www.freebsd.org/releases/)
2024-10-03 09:09:21 +02:00
Kirill Rd
cd68743eeb
add android CI cmake builds (#1716)
* trying android-ci workflow

* focus on android

* fix workflow file

* another fix attempt

* update java

* added host targets

* added clause for skipping CI

* revert focus on android

* set push CI back to master branch

* fix CI cache key for android
2024-09-23 10:12:10 +02:00
Kirill Rodriguez
ccb18f5b0c fix cmake build error for android: threads not found 2024-09-21 23:39:58 +03:00
dependabot[bot]
aa04ba9341 build(deps): bump github/codeql-action in the github-actions group
Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.25.15 to 3.26.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](afb54ba388...4dd16135b6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-15 00:09:58 +03:00
Orian
bb0d473bbb Add small note to event_active() documentation 2024-09-15 00:08:41 +03:00
icy17
628f39bb90 ws: fix potential NULL pointer dereference 2024-08-12 10:02:49 +02:00
icy17
d1a90d09dc tests: Fix potential NULL pointer dereference 2024-08-12 10:02:04 +02:00
dependabot[bot]
d3f6c78e3a build(deps): bump the github-actions group with 2 updates
Bumps the github-actions group with 2 updates: [ossf/scorecard-action](https://github.com/ossf/scorecard-action) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `ossf/scorecard-action` from 2.3.3 to 2.4.0
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](dc50aa9510...62b2cac7ed)

Updates `github/codeql-action` from 3.25.11 to 3.25.15
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b611370bb5...afb54ba388)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-05 00:27:05 +03:00
icy17
0499c51753
Document non-NULL parameters in public API (#1705) 2024-08-04 23:23:43 +02:00
Dmitry Ilyin
00c94beaf0 ws: allow Upgrade in Connection header anywhere
This will make it work for Firefox, which uses "Connection: keep-alive, Upgrade"
Reimplemented our own evutil_ascii_strcasestr function (same as
non-portable strcasestr)
2024-07-27 09:18:10 +03:00
Cœur
9848df54cc
http: disallow empty header names (#1690)
In theory, we could be more strict, since there is only a subset of allowed characters:
> ```
> tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
>                 / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
>                 / DIGIT / ALPHA
>                 ; any VCHAR, except delimiters
> ```

But I'd skip such verification, unless there is a legitimate interest (versus performances).

Fixes: #1686
2024-07-26 22:53:30 +02:00
Azat Khuzhin
7f23b5b5aa Add instruction for release tarballs validation with GPG keys
Fixes: https://github.com/libevent/libevent/issues/1691
2024-07-10 06:24:06 +02:00
Azat Khuzhin
9d735b4bea
Better error handling in event-read-fifo.c (#1673) 2024-07-09 23:34:00 +03:00
icy17
25f4439dbd sample/event-read-fifo: add proper exit path
Co-authored-by: Azat Khuzhin <azat@libevent.org>
2024-07-09 07:12:47 +02:00
icy17
09738283d9 Fix potential Null pointer dereference in event-read-fifo.c 2024-07-09 07:12:20 +02:00
Azat Khuzhin
30d169b133
Better error path in test-changelist.c and EVUTIL_INVALID_SOCKET (#1679) 2024-07-08 23:20:26 +03:00
Cœur
5485887c47 Check against EVUTIL_INVALID_SOCKET 2024-07-08 10:20:47 +02:00
icy17
3f799ab675 test/test-changelist: add proper exit path 2024-07-08 10:20:47 +02:00
icy17
6f9f2f3a09 test/test-changelist.c: fix potential NULL pointer dereference 2024-07-08 10:19:35 +02:00
Azat Khuzhin
66428fb969 test-closed: fix -Werror=maybe-uninitialized
Follow-up for: https://github.com/libevent/libevent/pull/1680
2024-07-08 10:15:29 +02:00
Cœur
272bd7ddf0
Fix potential Null pointer dereference in test-closed.c (#1680)
* Fix potential Null pointer dereference in test-closed.c

* add err path

* code review: goto err after evutil_socketpair failure

* code review: goto err for event_config_new failure

---------

Co-authored-by: icy17 <1061499390@qq.com>
2024-07-08 10:13:08 +02:00
Cœur
49d6b4b099
samples: use evutil_socket_t instead and handle 64 bit Windows (#1682)
* Use evutil_socket_t instead in http server sample and handle 64 bit Windows

* Update http-server.c

* consistently using EV_SOCK_FMT for Windows compatibility

* code review: fix missing symbol strsignal

* Add evutil_strsignal() helper instead of strsignal() macro

---------

Co-authored-by: Hernan Martinez <hernan.c.martinez@gmail.com>
Co-authored-by: Azat Khuzhin <azat@libevent.org>
2024-07-08 10:10:42 +02:00
Cœur
2bc831c889
Fix potential Null pointer dereference in test-time.c (#1681)
* Fix potential Null pointer dereference in test-time.c

* add err path

* code review: free events before base

---------

Co-authored-by: icy17 <1061499390@qq.com>
2024-07-08 10:08:58 +02:00