summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'ssl-read-pull' - #1454HEADmasterAzat Khuzhin2023-05-164-31/+36
|\ | | | | | | | | | | | | | | * 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
| * ssl: add some comments for lack of notify_closeAzat Khuzhin2023-05-161-0/+11
| |
| * Drop unused le_ssl_ops::err_is_okAzat Khuzhin2023-05-163-15/+0
| | | | | | | | | | It is not used anymore since errors are ignored if some progress had been done.
| * More SSL_read() to fill big bufferThuan Tran2023-05-161-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once SSL_read() only get max 16K bytes (one TLS record). In case of big buffer, should more SSL_read() to fill the buffer. Using sample https-client to measure max income MBit/s via nload tool. Note: set bufferevent_set_max_single_read() by 32K and add the chunk callback to read out each piece of data. The client sample do https request a data 900KB (the server don't use Transfer-Encoding: chunked) - With origin/master: max income is 2.26 MBit/s The chunk callback never get a piece of data > 16K. - With this PR: max income is 2.44 MBit/s The chunk callback can get some piece of data 32K or more.
| * Make bufferevent_set_max_single_read() effectThuan Tran2023-05-161-6/+2
|/
* Make dependency paths relocatableIngo Bauersachs2023-05-1611-76/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The generated configurations for both CMake and pkg-config included absolute paths to dependencies (OpenSSL, MbedTLS). This is contrary to the general CMake advise to create relocatable packages [1]. Additionally, when building both mbedtls and libevent via CMake's FetchContent in the same project, loading the project would fail with INTERFACE_INCLUDE_DIRECTORIES property contains path: "/home/user/project/cmake-build/_deps/mbedtls-build/include" which is prefixed in the source directory. The required changes include: - Adding the outer includes only to the BUILD_INTERFACE solves the makes the CMake paths relocatable and thus solves the FetchContent problem. - Updates to libevent_*.pc.in fixes the relocatable issues for pkg-config and properly declares currently missing dependencies. - Using components for linking to OpenSSL (requiring CMake 3.4) and MbedTLS. The new MbedTLS target names now match the component names of the MbedTLS' CMake project. - Use the Threads CMake library reference instead of a direct reference to support both built-in pthread and -lpthread. v2 (azat): get back CMAKE_REQUIRED_LIBRARIES [1] https://cmake.org/cmake/help/v3.25/manual/cmake-packages.7.html#creating-relocatable-packages
* cmake: Only use relative paths for install DESTINATION option (#1405)Jeremy W. Murphy2023-05-152-4/+3
| | | | | | | | | | | | | | | | | As described in #1404, the explicit use of CMAKE_INSTALL_PREFIX conflicts with using command-line --prefix. This simply removes all explicit use of CMAKE_INSTALL_PREFIX. Otherwise this path will be duplicated: $ cmake -DCMAKE_BUILD_TYPE=debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=inst .. $ DESTDIR=inst ninja install ... -- Installing: inst/src/le/libevent/.cmake-debug/inst/include/event2/util.h -- Installing: inst/src/le/libevent/.cmake-debug/inst/include/event2/ws.h ... Fixes: #1404 Co-authored-by: Jeremy Murphy <jeremymu@blackmagicdesign.com>
* Merge remote-tracking branch 'upstream/pr/1397' - #1397Azat Khuzhin2023-05-145-118/+28
|\ | | | | | | | | | | | | | | * upstream/pr/1397: Make sure exported include dirs are correct Fix Configure_RPATH() Install LibeventConfig.cmake similar to other cmake files Use GNUInstallDirs for mapping installation directories
| * Make sure exported include dirs are correctTobias Mayer2023-05-141-70/+11
| | | | | | | | | | | | | | | | CMake config files don't need any logic to detect the location of installed headers or DSOs, because these locations are already determined at project configuration time. They also don't need to distinguish between build and install trees, because that is already handled by the generated `LibeventTargets-*.cmake` files.
| * Fix Configure_RPATH()Azat Khuzhin2023-05-141-7/+6
| |
| * Install LibeventConfig.cmake similar to other cmake filesJonathan Ringer2023-05-142-34/+4
| | | | | | | | - Don't destroy cmake file between test case invocations
| * Use GNUInstallDirs for mapping installation directoriesJonathan Ringer2023-05-144-12/+12
|/
* Fix util/mm_calloc_enomem under FreeBSDAzat Khuzhin2023-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It looks like the compiler optimizes this call out with tt_assert(): (gdb) disas /m test_event_calloc_enomem Dump of assembler code for function test_event_calloc_enomem: 0x0000000000293bb0 <+0>: push %rbp 0x0000000000293bb1 <+1>: mov %rsp,%rbp 0x0000000000293bb4 <+4>: call 0x29f510 <__error@plt> 0x0000000000293bb9 <+9>: movl $0x0,(%rax) 0x0000000000293bbf <+15>: call 0x2990e0 <tinytest_set_test_failed_> 0x0000000000293bc4 <+20>: mov $0x2168e4,%edi 0x0000000000293bc9 <+25>: mov $0x220582,%esi 0x0000000000293bce <+30>: mov $0x20d893,%edx 0x0000000000293bd3 <+35>: mov $0x53a,%ecx 0x0000000000293bd8 <+40>: xor %eax,%eax 0x0000000000293bda <+42>: call 0x29f3b0 <printf@plt> 0x0000000000293bdf <+47>: mov $0x20da72,%edi 0x0000000000293be4 <+52>: mov $0x20f731,%esi 0x0000000000293be9 <+57>: xor %eax,%eax 0x0000000000293beb <+59>: pop %rbp 0x0000000000293bec <+60>: jmp 0x29f3b0 <printf@plt> While with tt_ptr_op() it does not: (gdb) disas /m test_event_calloc_enomem Dump of assembler code for function test_event_calloc_enomem: 0x0000000000293bd0 <+0>: push %rbp 0x0000000000293bd1 <+1>: mov %rsp,%rbp 0x0000000000293bd4 <+4>: push %rbx 0x0000000000293bd5 <+5>: push %rax 0x0000000000293bd6 <+6>: call 0x29f610 <__error@plt> 0x0000000000293bdb <+11>: movl $0x0,(%rax) 0x0000000000293be1 <+17>: mov $0xffffffffffffffff,%rdi 0x0000000000293be8 <+24>: mov $0xffffffffffffffff,%rsi 0x0000000000293bef <+31>: call 0x2a01c0 <calloc@plt> 0x0000000000293bf4 <+36>: test %rax,%rax 0x0000000000293bf7 <+39>: je 0x293c2b <test_event_calloc_enomem+91>
* test: add missing include of arpa/inet.h for ntohs in regress_ws.cAzat Khuzhin2023-05-141-0/+3
| | | | This will fix one warning in FreeBSD
* Merge branch 'build/osx-fixes'Azat Khuzhin2023-05-142-1/+4
|\ | | | | | | | | | | * build/osx-fixes: Suppress -Wmacro-redefined for htonll/ntohll in OSX Fix -Wtautological-constant-out-of-range-compare in regress_http under OSX
| * Suppress -Wmacro-redefined for htonll/ntohll in OSXAzat Khuzhin2023-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OSX: test/regress_ws.c:61:9: warning: 'htonll' macro redefined [-Wmacro-redefined] #define htonll(x) \ ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_endian.h:141:9: note: previous definition is here #define htonll(x) __DARWIN_OSSwapInt64(x) ^ test/regress_ws.c:65:9: warning: 'ntohll' macro redefined [-Wmacro-redefined] #define ntohll(x) htonll(x) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_endian.h:140:9: note: previous definition is here #define ntohll(x) __DARWIN_OSSwapInt64(x) ^
| * Fix -Wtautological-constant-out-of-range-compare in regress_http under OSXAzat Khuzhin2023-05-141-1/+2
|/ | | | | | | | compiler warning: test/regress_http.c:968:38: warning: result of comparison of constant 65536 with expression of type 'enum evhttp_cmd_type' is always true [-Wtautological-constant-out-of-range-compare] if (evhttp_request_get_command(req) != EVHTTP_REQ_CUSTOM) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
* Silence weird GCC warning about an uninitialized variableDmitry Antipov2023-05-141-0/+4
| | | | | | | | | | | | | | | | | | | | For the CMake release build with -DEVENT__ENABLE_GCC_WARNINGS=ON and -DEVENT__DISABLE_MM_REPLACEMENT=ON, GCC version 11 and 12 may complain about possibly uninitialized variable: In function ‘event_debug_assert_not_added_’, inlined from ‘event_assign’ at event.c:2184:2, inlined from ‘event_new’ at event.c:2276:6: cc1: error: ‘ev’ may be used uninitialized [-Werror=maybe-uninitialized] event.c: In function ‘event_new’: event.c:361:13: note: by argument 1 of type ‘const struct event *’ to event_debug_assert_not_added_.part.0’ declared here 361 | static void event_debug_assert_not_added_(const struct event *ev) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This warning is most likely a false positive and can be silenced by explicitly disabling inlining for 'event_assign()'. Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
* Ignore any archives (since you may use separate build dir for 'make dist')Azat Khuzhin2023-05-141-1/+1
|
* Merge branch 'ssl/fix-partial-read' - #1451Azat Khuzhin2023-05-144-7/+27
|\ | | | | | | | | | | * ssl/fix-partial-read: ssl: do not triger EOF if some data had been successfully read ssl: rename err_is_ok to handshake_is_ok (internal API)
| * ssl: do not triger EOF if some data had been successfully readAzat Khuzhin2023-05-144-1/+19
| | | | | | | | | | | | | | | | Previously in case when evbuffer_reserve_space() returns > 1, but it was able to read only 1 IO vector, it will try to read the next one, got 0 (EOF for mbedTLS or SSL_ERROR_ZERO_RETURN for OpenSSL) and will trigger EOF, while instead, it should trigger EV_READ w/o EOF and only after EOF.
| * ssl: rename err_is_ok to handshake_is_ok (internal API)Azat Khuzhin2023-05-144-6/+8
|/
* style fix: use tab for indentliaotonglang2023-05-051-16/+16
|
* ci: use newer actions/x versions for master jobsfanquake2023-05-041-5/+5
| | | | | | | | | | | | | | | | | Now that the jobs are running again, a number of deprecation warnings have surfaced https://github.com/libevent/libevent/actions/runs/4876367881: ```bash Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: actions/checkout@v2.0.0. ``` Looks like the most straightforward thing todo here is just use the newer version of the checkout action. Also move to the v1 tag for the coveralls job, rather than a pinned, much older version (the latest release is 1.2.5, https://github.com/coverallsapp/github-action/releases). Same again for actions/cache.
* ci: use OpenBSD 7.2 over 7.1fanquake2023-05-041-3/+3
| | | | | | | | | | | | | | | | In the most recent CI run, all the OpenBSD CI jobs failed, i.e https://github.com/libevent/libevent/actions/runs/4876367885/jobs/8699759831, this seems to be due to the fact that packages for 7.1 have been removed from https://cdn.openbsd.org/pub/OpenBSD/ (only has 7.2 & 7.3): ```bash Config file: openbsd-7.1.conf https://cdn.openbsd.org/pub/OpenBSD/7.1/packages/amd64/: no such dir Can't find rsync-3.2.3p0 Couldn't install rsync-3.2.3p0 exec shell: bash run.sh showDebugInfo ``` Switch to using 7.2, which is available, so that the CI will run.
* actions: use supported version of Ubuntufanquake2023-05-031-3/+3
| | | | | | | | It looks like these jobs are failing to run, because support for ubuntu-18.04 has been removed entirely, see: https://github.com/actions/runner-images/issues/6002. Migrate to ubuntu-20.04.
* doc: minor cleanups following #1441 (#1442)fanquake2023-04-202-20/+20
| | | Also fixes 1 broken link (apologies).
* Merge pull request #1441 from fanquake/autoconf_doc_updatesAzat Khuzhin2023-04-172-51/+55
|\ | | | | doc: minor autoconf/formatting improvements
| * doc: mark Autotools as deprecated in building.mdfanquake2023-04-172-48/+52
| | | | | | | | | | Re-arrange so CMake is mentioned first. Formatting improvements.
| * doc: move autoconf link in readme to autoconf section.fanquake2023-04-171-4/+4
|/
* Fix typo in changelog (#1438)lilinjie2023-04-111-1/+1
|
* Prohibit VLA in autotools tooAzat Khuzhin2023-04-041-0/+3
|
* Fix building with -Wstack-protector due to VLA and fobid themAzat Khuzhin2023-04-042-11/+8
| | | | | | | | It is not a thankless task to fix such issues on and on, let's just prohibit this cases, and our build with -Werror on CI will show new issues from now on. Fixes: #1434
* build: split kqueue warning message into cross-compile and applefanquake2023-04-041-2/+7
| | | | | | | This is output when compiling (natively) on macOS systems, which is confusing, because no cross-compilation is involved. Split the message into separate cases.
* Deal with partial writes on SSL writezhenhaonong2023-03-291-2/+8
| | | | | | | | | | | | SSL write may do partial writes in some cases. For example, document of mbedtls_ssl_write says: If the return value is non-negative but less than length, the function must be called again with updated arguments: buf + ret, len - ret (if ret is the return value) until it returns a value equal to the last 'len' argument. In case of partial writes, we should continue writing the same chain of buffer, not the next chain.
* http: style fix: use space between arguments list (#1435)Liao Tonglang2023-03-261-1/+1
|
* ci: fix typo in yaml for cifuzzAzat Khuzhin2023-03-081-1/+1
| | | | Follow-up for: #1431
* ci: switch to ubuntu 20.04Azat Khuzhin2023-03-071-2/+2
| | | | | | | | | | github action reports "internal error" for builds on ubuntu 18.04: linux-cmake-job (ubuntu-18.04, COMPILER_CLANG) This is a scheduled Ubuntu-18.04 brownout. The Ubuntu-18.04 environment is deprecated and will be removed on April 1st, 2023. For more details, see https://github.com/actions/runner-images/issues/6002 linux-cmake-job (ubuntu-18.04, COMPILER_CLANG) GitHub Actions has encountered an internal error when running your job.
* ci: set minimal permissions on GitHub ActionsDiogo Teles Sant'Anna2023-03-063-0/+12
| | | | | | | | | Change made by setting top-level read-only permisisons, and any other necessary permissions set as job-level. Closes #1421 Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>
* http: Reduce times of checking if response has body (#1395)Liao Tonglang2023-03-051-3/+4
| | | | Use a variable 'need_body' to store the result of evhttp_response_needs_body(), then use the variable instead of call the function again.
* build: improve mbedtls searching on macOS with brew for cmake (#1419)Michael Ford2023-03-051-0/+14
| | | This just copies the same logic used to find OpenSSL on macOS using homebrew, for finding mbedtls via brew. Without it, the build will fail out the box with a brew installed mbedtls.
* Always have evutil_secure_rng_add_bytes available (#1427)Kurt Roeckx2023-03-052-4/+5
| | | | | When libevent doesn't provide random the arc4 function, but they come from libc, there is no need to call this function, so make it do nothing. Fixes: #1393
* ws-chat-server: fix potential resource leakZhipeng Xue2023-03-051-0/+2
|
* Fix potential null dereference in http-server (#1430)Zhipeng Xue2023-03-041-0/+2
| | | Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
* test: fix potential null dereference in https_bind_ssl_bevcb (#1428)Zhipeng Xue2023-03-041-0/+4
| | | Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
* Optimize arc4random_uniform() (by syncing with OpenBSD implementation)Cœur2023-03-021-11/+2
| | | | | | | | | | | | | 1. In d4de062, in Feb 2010, libevent adopted OpenBSD implementation of arc4random_uniform. 2. In https://github.com/openbsd/src/commit/728918cba93e0418bea2a73c9784f6b80c2a9dbd, in Jun 2012, OpenBSD improved their implementation to be faster, by changing arc4random_uniform() to calculate ``2**32 % upper_bound'' as ``-upper_bound % upper_bound''. Alternatively we can simply remove arc4random_uniform() since it is not used by libevent anyway, but let's just sync the header for now.
* evdns: fix "Branch condition evaluates to a garbage value" in reply_parseCœur2023-03-021-2/+2
|
* Fix the value is never actually read from 'argument' in ↵Cœur2023-03-021-4/+2
| | | | | | | evhttp_parse_query_impl() Although the value stored to 'argument' is used in the enclosing expression, the value is never actually read from 'argument'
* Fix "Value stored to 'a' is never read" in SHA1Transform()Cœur2023-03-021-2/+0
| | | | | | Using same fix as used in android [1]. [1]: android.googlesource.com/platform/dalvik/+/android-4.4.2_r2/libdex/sha1.cpp#193
* Merge pull request #1418 from fanquake/use_fortify_source_3Azat Khuzhin2023-02-142-2/+2
|\ | | | | build: use FORTIFY_SOURCE=3 in hardening option