4689 Commits

Author SHA1 Message Date
Azat Khuzhin
bb57cea387 test: fix util/getaddrinfo for netbsd (v2)
Fixes: c198b0ce ("test: fix util/getaddrinfo for netbsd")
Fixes: #1316
2022-08-14 09:56:50 +02:00
Azat Khuzhin
77a9b60e47
Merge pull request #1315 from yogo1212/http_per_socket_bebcb
In it's current form, libevent requires multiple struct evhttp objects to be created in order to enable listening on sockets with more than one type of encryption.

This change allows specifying per-socket how the associated bufferevents should be created.
Thus, it becomes possible to have multiple listening sockets with different encryption parameters using only one evttp.
2022-08-14 00:46:48 +02:00
Azat Khuzhin
c198b0ceb3 test: fix util/getaddrinfo for netbsd
Fixes: #1316
2022-08-13 20:48:49 +02:00
Borys Smejda
86b5d2e951 Fixed CMake configuration failure (libevent#1321)
Deleted usage of CMake feature 'file(REAL_PATH'
which is available from version 3.19
with an old 'get_filename_component' so that
older version of CMake can still be used
to configure the project.
2022-08-13 20:15:06 +02:00
Leon M. George
1bdc91350e http: allow setting bevcb per socket
Co-authored-by: Azat Khuzhin <azat@libevent.org>
v2: remove handling of HTTP_BIND_IPV6
2022-08-13 20:12:18 +02:00
Azat Khuzhin
a4cdc3c5e8 test: allow to run init_ssl() multiple times 2022-08-13 20:12:18 +02:00
Azat Khuzhin
4ca417afa4 test: add a comment for init_ssl() about suppressions for LSan 2022-08-13 20:12:08 +02:00
Dmitry Ilyin
99fd68abde Add check of mmap64 function and use it when available rather that mmap
There can be issues on 32-bit architectures to mmap 2+GiB file, and to
make this portable between different version of glibc, mmap64 was
prefered over _FILE_OFFSET_BITS
2022-08-09 00:18:10 +02:00
neil
b2aca3bc31 fix freebsd checks 2022-08-09 00:14:43 +02:00
neil
c08ee39969 fix freebsd checks 2022-08-09 00:14:43 +02:00
neil
4f662d662e Add freebsd CI checks
ci/linux skip
ci/macos skip
ci/windows skip
ci/mingw skip
2022-08-09 00:14:43 +02:00
Haowei Hsu
80c1e0b745 Search library name of Debug for find_event_lib. 2022-08-07 11:14:40 +02:00
Haowei Hsu
dd610b7781 Add postfix for Debug configuration. 2022-08-07 11:14:40 +02:00
Dmitry Ilyin
05a03d4a15 Add more HTTP_ response codes 2022-08-07 11:13:48 +02:00
Azat Khuzhin
3e7a73809e ci: increase number of attempts to 5 2022-07-12 21:57:41 +03:00
Azat Khuzhin
bfa526cefa ci: add retries
Right now it is possible for some tests to fail, because of lack of CPU
time.
And it is better to have green CI even if this will take longer.
2022-07-12 21:08:00 +03:00
Azat Khuzhin
d32649493a ci: use ubuntu 22.04 with clang 11 for sanitizers build (#1306)
* ci-tsan-recent:
  test: fix unused variable in rand test (catched by newer clang)
  ci: use ubuntu 22.04 with clang 11 for sanitizers build
2022-07-12 10:07:20 +03:00
Azat Khuzhin
33fb0e358a test: fix unused variable in rand test (catched by newer clang) 2022-07-12 09:54:36 +03:00
Azat Khuzhin
87c016a09e ci: use ubuntu 22.04 with clang 11 for sanitizers build
There are periodically some heap-use-after-free reported in ratelim
tests by TSan, which I cannot reproduce locally and even on CI it is
flaky.

Let's try to use recent clang, maybe it fixes some issues in sanitizers.

Refs: #1206
2022-07-12 08:08:25 +03:00
Azat Khuzhin
213a822aa7 test: increase timeout significantly in dns/getaddrinfo_cancel_stress (for TSan)
Fixes: #1304
2022-07-11 22:53:57 +03:00
Azat Khuzhin
15780dd240 ci: disable broken mingw cmake builds (#1207) 2022-07-11 03:53:27 +03:00
Azat Khuzhin
c90acbb6fc Slightly adjust badges markdown in README 2022-07-11 03:51:31 +03:00
Azat Khuzhin
a3572af704 ci: fix master/upstream workflow (syntax error) 2022-07-11 03:50:16 +03:00
Azat Khuzhin
9b7b549ba0 Update CI status badge 2022-07-11 03:47:45 +03:00
Azat Khuzhin
587f26fb0c Rework CI to keep everything in one workflow (by using reusable workflow)
Right now because we have separate workflows there is no one page with
all the jobs, instead we have separate page for each workflow (linux,
windows, ...)

This is pretty inconvenient, so let's make it cleaner, and now we will
have only two:

- for pull requests
- for upstream/master
2022-07-11 03:42:50 +03:00
Azat Khuzhin
5ff98dc1f3 evdns: accept domains up to 254 long (previosly only 63 long was accepted)
Previously evdns was using HOST_NAME_MAX, and define it to 255 *only* if
it not set, however it does set on linux:

    $ egrep -r define.*HOST_NAME_MAX /usr/include/bits
    /usr/include/bits/local_lim.h:#define HOST_NAME_MAX             64
    /usr/include/bits/posix1_lim.h:#define _POSIX_HOST_NAME_MAX     255
    /usr/include/bits/confname.h:#define _SC_HOST_NAME_MAX          _SC_HOST_NAME_MAX

But 64 should be the limit of the host component, not for the whole
hostname, as also noted by @ploxiln

So use our own EVDNS_NAME_MAX const, which is set to 255.

Fixes: #1280
2022-07-10 18:10:35 +03:00
Azat Khuzhin
1933f6aadd test: make dns/getaddrinfo_cancel_stress more deterministic
Fixes: #1271
Follow-up for: 90bcf2d660b9b43cb8e747421d4938f08f935bd7
2022-07-10 16:32:36 +03:00
Azat Khuzhin
4872734277 Add a note that IOCP is experimental feature
Refs: #1228
2022-07-10 16:18:40 +03:00
Azat Khuzhin
63ef005a26 ci: drop processing "ci skip" message in commit in favor of official skip
Since [1] github actions official support skipping workflows based on
the message.

  [1]: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
2022-07-10 15:47:00 +03:00
Azat Khuzhin
fc24a2990d ci: add ability skip specific workflow
Public CI workers has pretty high load, and sometimes you need to test
only specific workflow, i.e. windows.

So let's add ability to limit which workflow should be run.
2022-07-10 15:13:46 +03:00
Azat Khuzhin
69e9f7ee5d Initial OpenSSL 3.0 support (#1288)
* openssl-3:
  ci: use ubuntu 22.04 with OpenSSl 3.0 instead of building OpenSSL from sources
  ci: set LD_LIBRARY_PATH for openssl 3.0 build
  test: suppress warning for already defined SSL_get_peer_certificate
  autotools: print $OPENSSL_LIBS/$OPENSSL_INCS
  Suppress -Wunused-value for BIO_set_close()
  Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)
  Attempt to add OpenSSL 3 to the Linux build matrix
  Initial OpenSSL 3.0 support
2022-07-10 13:55:32 +03:00
Azat Khuzhin
54078b30cb ci: use ubuntu 22.04 with OpenSSl 3.0 instead of building OpenSSL from sources 2022-07-10 13:11:51 +03:00
Azat Khuzhin
fb5490066d ci: set LD_LIBRARY_PATH for openssl 3.0 build
Fixes:

    /home/runner/work/libevent/libevent/build/test/.libs/regress: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
2022-07-10 12:48:04 +03:00
Azat Khuzhin
d84c88519d test: suppress warning for already defined SSL_get_peer_certificate
build report:

    [1/2] Building C object CMakeFiles/regress.dir/test/regress_mbedtls.c.o
    /src/le/libevent/test/regress_mbedtls.c:50: warning: "SSL_get_peer_certificate" redefined
       50 | #define SSL_get_peer_certificate mbedtls_ssl_get_peer_cert
          |
    In file included from /src/le/libevent/test/regress.h:139,
                     from /src/le/libevent/test/regress_mbedtls.c:35:
    /src/oss/openssl/include/openssl/ssl.h:1799: note: this is the location of the previous definition
     1799 | #   define SSL_get_peer_certificate SSL_get1_peer_certificate
          |
    [2/2] Linking C executable bin/regress

But this should be cleaned up.
2022-07-10 10:07:39 +03:00
Azat Khuzhin
a0087e2c7a autotools: print $OPENSSL_LIBS/$OPENSSL_INCS 2022-07-10 10:07:39 +03:00
Azat Khuzhin
e67085e56e Suppress -Wunused-value for BIO_set_close() 2022-07-10 10:07:39 +03:00
Azat Khuzhin
c22f275744 Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)
Since OpenSSL 3.0 there is new OPENSSL_VERSION_MAJOR, but previous
releases does not have it.

So let's use plain old OPENSSL_VERSION_NUMBER to avoid more preprocessor
macros.
2022-07-10 10:07:39 +03:00
William Marlow
a29570a1e2 Attempt to add OpenSSL 3 to the Linux build matrix
v2: fix echo messages
v3: fix autotools build (wrong path to pkg config)
2022-07-10 10:07:25 +03:00
William Marlow
29c420c418 Initial OpenSSL 3.0 support
* Don't use deprecated functions when building against OpenSSL 3.0.
* Recognise that OpenSSL 3.0 can signal a dirty shutdown as a protocol.
  error in addition to the expected IO error produced by OpenSSL 1.1.1
* Update regress_mbedtls.c for compatibility with OpenSSL 3
2022-07-09 23:24:53 +03:00
Azat Khuzhin
20977eae0d Merge branch 'mbedtls-3'
* mbedtls-3:
  sample/ssl-client-mbedtls.c: fix for MbedTLS 3
  sample/ssl-client-mbedtls.c: break the loop on EOF
  sample/ssl-client-mbedtls.c: fix printing response in readcb
  Initial Mbed-TLS 3 support to get the GitHub Actions working again
  Support build dir of the MbedTLS
2022-07-09 23:22:00 +03:00
Azat Khuzhin
acb7ef9819 ci/macos: remove separate openssl 1.1 from build matrix
@ploxiln:

    On current homebrew, openssl@1.1 is the only openssl:

    [pierce@plo-mbp15 libevent]$ brew --prefix openssl
    /usr/local/opt/openssl@1.1
    [pierce@plo-mbp15 libevent]$ brew info openssl
    openssl@1.1: stable 1.1.1g (bottled) [keg-only]
    Cryptography and SSL/TLS Toolkit

@fanquake

    Indeed. OpenSSL 1.0 was removed from homebew in Homebrew/homebrew-core#46876. Related discussion also in Homebrew/homebrew-core#46454.
2022-07-09 21:17:06 +03:00
Azat Khuzhin
8bcbec77dd Merge branch 'fix-brew-autodetection'
* fix-brew-autodetection:
  ci: fix cmake build w/o OPENSSL_ROOT_DIR
  ci: remove separate build for BREW_AUTODETECT_OPENSSL (use it by default)
  autotools: fix autodetection of openssl location via brew
2022-07-09 21:14:16 +03:00
Azat Khuzhin
6e310e3c6c sample/ssl-client-mbedtls.c: fix for MbedTLS 3
- use build_info.h over version.h
- provide own certs

P.S. since it is simpler then adding detection of the library version
into autotools.
2022-07-09 21:11:29 +03:00
Azat Khuzhin
ce20356a32 sample/ssl-client-mbedtls.c: break the loop on EOF 2022-07-09 21:07:49 +03:00
Azat Khuzhin
fcf85e4822 sample/ssl-client-mbedtls.c: fix printing response in readcb 2022-07-09 21:07:49 +03:00
William Marlow
384c52e6be Initial Mbed-TLS 3 support to get the GitHub Actions working again
mingw has upgraded to Mbed-TLS 3.1.0, so all the mingw tests that need
Mbed-TLS currently don't work.

v2: add missing mbedtls/version.h into test/regress_mbedtls.c
v3: suppress #warning "Including compat-2.x.h is deprecated" for mbedtls/compat-2.x.h
2022-07-09 20:47:04 +03:00
Azat Khuzhin
35e12a8175 Support build dir of the MbedTLS 2022-07-09 20:47:04 +03:00
Azat Khuzhin
d881d06260 configure: fix AC_CHECK_FUNCS should use literals
Error

    configure.ac:291: warning: AC_CHECK_FUNCS(getnameinfo
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(getprotobynumber
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(getservbyname
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(inet_ntop
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(inet_pton
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
2022-07-09 20:29:09 +03:00
kenping
d96457e132 listener: Preserve last error in evconnlistener_new_bind() before close
In function evconnlistener_new_bind() after go to "err:", The
evutil_closesocket() would clear the error code( I found this under
Windows ). User can not use EVUTIL_SOCKET_ERROR() to get the
evconnlistener_new_bind()'s failing error.

I add a err_code variable to store and restore the last error code.

v2: rebased by azat to make the patch simpler
2022-07-09 20:20:58 +03:00
Azat Khuzhin
a9441ed646 ci: fix cmake build w/o OPENSSL_ROOT_DIR
cmake build rules does not have detection of OPENSSL_ROOT_DIR via brew,
so we cannot run such builds on CI.

Always set OPENSSL_ROOT_DIR for cmake.
2022-07-09 20:15:17 +03:00