5094 Commits

Author SHA1 Message Date
Kirill Rodriguez
23839cb096
mm_strdup instead of strdup
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2024-11-01 00:25:02 +00:00
Kirill Rodriguez
6f35d4dfe8
probably platform caching at work too, let's make different nodenames
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2024-10-31 14:52:44 +00:00
Kirill Rodriguez
d2facdae42
hitting cache makes cancel stress test unreliable
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2024-10-31 10:18:22 +00:00
Kirill Rodriguez
e219dd4a6e
return EAI_ADDRFAMILY instead of NULL (propagate to caller)
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2024-11-02 00:53:31 +00:00
Greg Hazel
7d0836c2b8
handle empty answers as EAI_ADDRFAMILY
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2022-08-14 14:02:48 -07:00
Greg Hazel
822502d72d
evdns fix NULL res clearing the cache entry
Signed-off-by: Kirill Rodriguez <theoden8@tutamail.com>
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2022-03-31 15:29:32 -07:00
Greg Hazel
8572c273e9
use mm_ allocators
Signed-off-by: Kirill Rodriguez <theoden8@tutamail.com>
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2018-06-24 13:33:44 -07:00
Greg Hazel
b6a3dc5ccc
handle errors on incoming requests
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2017-05-19 20:11:52 -07:00
Greg Hazel
9652fe0f79
add const qualifier to evhttp_uri_join declaration
Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
2017-05-15 00:36:47 -07:00
Azat Khuzhin
6313a61d50
Ignore Proxy-Connection in request header (#1736)
* don't strip Proxy-Connection
* remove Proxy-Connection
* remove proxy-connection from http-connect
* moved EVHTTP_ flags to http.c
* fix flags definition placements in http.c
* fix unused variable

Co-authored-by: Greg Hazel <ghazel@gmail.com>
2024-11-01 01:37:19 +03:00
Azat Khuzhin
3c8d89b9b2
Merge pull request #1737 from libevent/signal-tests
Retry tests with SIGALRM on OSX (and fix some related stuff)
2024-11-01 01:30:58 +03:00
Kirill Rodriguez
e9559cd173
fix unused variable 2024-10-29 15:20:08 +00:00
Kirill Rodriguez
c35d406d10
fix flags definition placements in http.c 2024-10-29 11:43:02 +00:00
Kirill Rodriguez
a92ce7e111
moved EVHTTP_ flags to http.c 2024-10-29 11:26:35 +00:00
Kirill Rodriguez
a8cd11f90f
remove proxy-connection from http-connect 2024-10-29 11:18:48 +00:00
Azat Khuzhin
f01879d5a6 Align ELF sections to 16K boundaries (-Wl,-z,max-page-size=16384)
Even though the initial request was about Android, it is not only about
it, but it could be the case for Linux as well (so as Apple M1/...
chips)

And this should not affect anything, since this is just ELFs

Fixes: https://github.com/libevent/libevent/issues/1708
2024-10-29 11:41:26 +03:00
Azat Khuzhin
25fa9c7732 test: retry signal tests with SIGALRM no OSX
By some reason even after first ALRM signal received and event loop
returned it is possible to recieve an ALRM one more time (at least one):

    % yes signal/simple_signal.. | head -n 1000 | xargs -I{} -P10 sh -c 'EVENT_DEBUG_LOGGING_ALL= bin/regress --timeout 0 --verbose {} >& /tmp/test.$SECONDS.$RANDOM.log'
    % cat /tmp/test.0.18384.log
    signal/simple_signal: [forking] [debug] event_add: event: 0x16d70f368 (fd 14),     call 0x102704ae8
    [debug] evsig_ensure_saved_: evsignal (14) >= sh_old_max (0), resizing

             OK /Users/ec2-user/libevent/test/regress.c:1086: assert(setitimer(ITIMER_REAL, &itv, NULL) == 0): 0 vs 0[debug] kq_dispatch: kevent reports 1
    [debug] event_active: 0x16d70f368 (fd 14), res 8, callback 0x102704ae8
    [debug] event_process_active: event: 0x16d70f368,    call 0x102704ae8
    [debug] event_del: 0x16d70f368 (fd 14), callback 0x102704ae8
    [debug] event_base_loop: no events registered.

      FAIL /Users/ec2-user/libevent/test/regress.c:1062: ALRM received not from event loop![debug] event_del: 0x16d70f368 (fd 14), callback 0x102704ae8
    [debug] event_base_free_: 0 events freed
    signal/simple_signal: exited with 0 (0)

      [FAILED signal/simple_signal (0 retries)]
    signal/simple_signal_re_order: [forking] [debug] event_add: event: 0x16d70f368 (fd 14),     call 0x102704ae8
    [debug] evsig_ensure_saved_: evsignal (14) >= sh_old_max (0), resizing
    [debug] event_del: 0x16d70f368 (fd 14), callback 0x102704ae8
    [debug] event_add: event: 0x16d70f368 (fd 14),     call 0x102704ae8

             OK /Users/ec2-user/libevent/test/regress.c:1086: assert(setitimer(ITIMER_REAL, &itv, NULL) == 0): 0 vs 0[debug] kq_dispatch: kevent reports 1
    [debug] event_active: 0x16d70f368 (fd 14), res 8, callback 0x102704ae8
    [debug] event_process_active: event: 0x16d70f368,    call 0x102704ae8
    [debug] event_del: 0x16d70f368 (fd 14), callback 0x102704ae8
    [debug] event_base_loop: no events registered.
    [debug] event_del: 0x16d70f368 (fd 14), callback 0x102704ae8
    [debug] event_base_free_: 0 events freed
    signal/simple_signal_re_order: exited with 0 (0)

    1/2 TESTS FAILED. (0 skipped)

Also note, that the problem not only when I run two tests, but only one
as well:

    % bin/regress --timeout 0 --repeat 1000 --verbose --no-fork signal/simple_signal >/tmp/test2.log 2>&1
    signal/simple_signal:
             OK /Users/ec2-user/libevent/test/regress.c:1086: assert(setitimer(ITIMER_REAL, &itv, NULL) == 0): 0 vs 0
    signal/simple_signal:
             OK /Users/ec2-user/libevent/test/regress.c:1086: assert(setitimer(ITIMER_REAL, &itv, NULL) == 0): 0 vs 0
      FAIL /Users/ec2-user/libevent/test/regress.c:1062: ALRM received not from event loop!

I've tried to run under "ktrace trace -Ss -f C4,S0x010c -c" but of
course it does not fails under it (dtruss by some reason did not work
for me).

P.S. Also remove one TT_RETRIABLE for one test, since only setitimer()
causes this.
2024-10-29 09:28:53 +01:00
Azat Khuzhin
29a3eee5ca test: add --repeat option into tinytest 2024-10-29 09:28:53 +01:00
Azat Khuzhin
7b14bc16f2 test: add fallback for SIGALRM 2024-10-29 09:28:53 +01:00
Azat Khuzhin
c94b382577 test: do not ignore setitimer() failures 2024-10-29 09:28:53 +01:00
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