]> granicus.if.org Git - libevent/log
libevent
3 years agoProperly initialize sockaddr length on systems with sin_len.
Tobias Heider [Tue, 6 Jul 2021 15:40:58 +0000 (17:40 +0200)]
Properly initialize sockaddr length on systems with sin_len.

3 years agoMerge remote-tracking branch 'upstream/pr/1171'
Azat Khuzhin [Fri, 9 Jul 2021 21:12:21 +0000 (00:12 +0300)]
Merge remote-tracking branch 'upstream/pr/1171'

* upstream/pr/1171:
  ci: install pkg-config in mingw-w64 CI
  build: test ac_cv_header_sys_time_h once, reformat timer* macro checks
  build: remove call to AC_C_CONST()
  build: replace ntp_pkg_config macro with a call to PKG_PROG_PKG_CONFIG()
  build: remove NTP_PKG_CONFIG call from libevent_mbedtls.m4
  build: stop using the deprecated form of AC_OUTPUT()
  build: quote args in AC_ARG_ENABLE & AS_HELP_STRING
  build: remove call to AC_HEADER_TIME
  build: call AC_PREREQ() first & quote argument
  build: remove call to AC_PREFIX_DEFAULT
  build: remove call to AC_PROG_GCC_TRADITIONAL

3 years agoci: install pkg-config in mingw-w64 CI
fanquake [Fri, 9 Jul 2021 04:34:37 +0000 (12:34 +0800)]
ci: install pkg-config in mingw-w64 CI

3 years agobuild: test ac_cv_header_sys_time_h once, reformat timer* macro checks
fanquake [Wed, 16 Jun 2021 07:29:30 +0000 (15:29 +0800)]
build: test ac_cv_header_sys_time_h once, reformat timer* macro checks

3 years agobuild: remove call to AC_C_CONST()
fanquake [Tue, 15 Jun 2021 08:00:48 +0000 (16:00 +0800)]
build: remove call to AC_C_CONST()

> This macro is obsolescent, as current C compilers support const.
> New programs need not use this macro.

See: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.67/autoconf.html#index-AC_005fC_005fCONST-877.

3 years agobuild: replace ntp_pkg_config macro with a call to PKG_PROG_PKG_CONFIG()
fanquake [Tue, 15 Jun 2021 07:49:38 +0000 (15:49 +0800)]
build: replace ntp_pkg_config macro with a call to PKG_PROG_PKG_CONFIG()

Note that 0.15.0 is quite an old version to be testing for, however I've left
this as-is for now.

3 years agobuild: remove NTP_PKG_CONFIG call from libevent_mbedtls.m4
fanquake [Tue, 15 Jun 2021 07:37:30 +0000 (15:37 +0800)]
build: remove NTP_PKG_CONFIG call from libevent_mbedtls.m4

I'm guessing this was just copied from libevent_openssl.m4, however there aren't
actually any pkg-config calls / macros used here.

3 years agobuild: stop using the deprecated form of AC_OUTPUT()
fanquake [Tue, 15 Jun 2021 07:22:20 +0000 (15:22 +0800)]
build: stop using the deprecated form of AC_OUTPUT()

> The use of AC_OUTPUT with arguments is deprecated.

See: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.67/autoconf.html#AC_005fOUTPUT.

3 years agobuild: quote args in AC_ARG_ENABLE & AS_HELP_STRING
fanquake [Tue, 15 Jun 2021 06:34:46 +0000 (14:34 +0800)]
build: quote args in AC_ARG_ENABLE & AS_HELP_STRING

Previously, some were, some weren't. Consolidate on quoting.

3 years agobuild: remove call to AC_HEADER_TIME
fanquake [Tue, 15 Jun 2021 06:10:29 +0000 (14:10 +0800)]
build: remove call to AC_HEADER_TIME

Besides the fact that the *_TIME_WITH_SYS_TIME define doesn't seem to be
used anywhere in the libevent source, this macro is also obselescent.

> This macro is obsolescent, as current systems can include both files when they exist.
> New programs need not use this macro.

See:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.67/autoconf.html#index-AC_005fHEADER_005fTIME-640.

3 years agobuild: call AC_PREREQ() first & quote argument
fanquake [Tue, 15 Jun 2021 05:41:05 +0000 (13:41 +0800)]
build: call AC_PREREQ() first & quote argument

> This macro may be used before AC_INIT.

Calling this first means establishing that the required version of
autoconf is actually available, before bothering with AC_INIT().

See:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.67/autoconf.html#Versioning.

3 years agobuild: remove call to AC_PREFIX_DEFAULT
fanquake [Tue, 15 Jun 2021 05:35:58 +0000 (13:35 +0800)]
build: remove call to AC_PREFIX_DEFAULT

> By default, configure sets the prefix for files it installs to /usr/local.

A call to AC_PREFIX_DEFAULT, just to set the value the same as the
default, would seem unnecessary. Note that the "initialize prefix"
comment dates back to aa6567fe6475d3230c7c745a7ca208735af0c331, prior to
when an autoconf macro was actually being used.

See:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.67/autoconf.html#Default-Prefix.

3 years agobuild: remove call to AC_PROG_GCC_TRADITIONAL
fanquake [Tue, 15 Jun 2021 05:31:44 +0000 (13:31 +0800)]
build: remove call to AC_PROG_GCC_TRADITIONAL

libevent requires Autoconf 2.67+, and from atleast this version
onwards, if not earlier, this macro is obsolescent.

> This macro is obsolescent, since current versions of the GNU
> C compiler fix the header files automatically when installed.

See:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.67/autoconf.html#AC_005fPROG_005fGCC_005fTRADITIONAL.

3 years agoMerge #1176 - make evthread_use_pthreads() a MT-Safe function
Azat Khuzhin [Sun, 27 Jun 2021 15:37:20 +0000 (18:37 +0300)]
Merge #1176 - make evthread_use_pthreads() a MT-Safe function

* upstream/pr/1176:
  remove emty line for code formating
  make evthread_use_pthreads a MT-Safe function

3 years agoremove emty line for code formating
moonlightsh [Fri, 25 Jun 2021 00:33:30 +0000 (08:33 +0800)]
remove emty line for code formating

3 years agomake evthread_use_pthreads a MT-Safe function
moonlightsh [Fri, 25 Jun 2021 00:27:27 +0000 (08:27 +0800)]
make evthread_use_pthreads a MT-Safe function

3 years agoRTEMS has no SA_RESTART
Michael Davidsaver [Mon, 21 Oct 2019 18:41:19 +0000 (11:41 -0700)]
RTEMS has no SA_RESTART

as RTEMS has no syscalls to restart.

3 years agoSwitch to lukka/run-vcpkg@v7 and update vcpkgGitCommitId
Azat Khuzhin [Tue, 23 Mar 2021 06:50:03 +0000 (09:50 +0300)]
Switch to lukka/run-vcpkg@v7 and update vcpkgGitCommitId

Let's see if it uses set-env or not [1]:

    Run lukka/run-vcpkg@v2
    Restore vcpkg and its artifacts from cache
    Set output env vars
      Error: Unable to process command '::set-env name=RUNVCPKG_VCPKG_ROOT::D:\a\libevent\vcpkg' successfully.
      Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

  [1]: https://github.com/libevent/libevent/runs/2172680596?check_suite_focus=true#step:4:24

And this one [2]:

    error: could not open file /var/cache/pacman/pkg/libzstd-1.5.0-1-x86_64.pkg.tar.zst: Child process exited with status 127
    error: could not open file /var/cache/pacman/pkg/zstd-1.5.0-1-x86_64.pkg.tar.zst: Child process exited with status 127
    error: could not open file /var/cache/pacman/pkg/pacman-5.2.2-23-x86_64.pkg.tar.zst: Child process exited with status 127
    error: failed to commit transaction (cannot open package file)

  [2]: https://github.com/libevent/libevent/pull/1168/checks?check_run_id=2706159518#step:4:367

3 years agoReplace gettimeofday with the portable wrapper
Alex Budovski [Sun, 30 May 2021 18:05:25 +0000 (13:05 -0500)]
Replace gettimeofday with the portable wrapper

Otherwise the Win32 build fails.

3 years agoFix -Warray-parameter for evutil_ersatz_socketpair_()
Azat Khuzhin [Mon, 24 May 2021 18:03:58 +0000 (21:03 +0300)]
Fix -Warray-parameter for evutil_ersatz_socketpair_()

3 years agodns-example: add CNAME support
Azat Khuzhin [Mon, 24 May 2021 18:03:58 +0000 (21:03 +0300)]
dns-example: add CNAME support

3 years agoevdns: add ability to get CNAME
Sergey Matveychuk [Wed, 7 Apr 2021 17:39:18 +0000 (20:39 +0300)]
evdns: add ability to get CNAME

Add new flag (DNS_CNAME_CALLBACK) for
evdns_base_resolve_ipv4()/evdns_base_resolve_ipv6().

If set, you will get one more callback with type == DNS_CNAME and CNAME
in addrs argument.

3 years agocmake: don't override CMAKE_CONFIGURATION_TYPES.
Paweł Wegner [Thu, 13 May 2021 15:32:11 +0000 (17:32 +0200)]
cmake: don't override CMAKE_CONFIGURATION_TYPES.

Surprisingly this overrides configuration types for projects which embed libevent using cmake's add_subdirectory.

3 years agocmake: Fix generted pkgconfig files.
Biswapriyo Nath [Tue, 4 May 2021 19:56:17 +0000 (01:26 +0530)]
cmake: Fix generted pkgconfig files.

Use lowercase 'L' option for library names because uppercase 'L' is used with library search directory.

3 years agoSupport disabled renegotiation in mbedTLS
Azat Khuzhin [Fri, 30 Apr 2021 07:15:45 +0000 (10:15 +0300)]
Support disabled renegotiation in mbedTLS

Patch from: @Kurruk007
Fixes: #1161
3 years agoDo not wrap lines in AC_CHECK_HEADERS/AC_CHECK_FUNCS (fixes detection in mingw)
Azat Khuzhin [Tue, 27 Apr 2021 18:15:03 +0000 (21:15 +0300)]
Do not wrap lines in AC_CHECK_HEADERS/AC_CHECK_FUNCS (fixes detection in mingw)

Fixes: d433f847 ("Revert "build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS"")
Fixes: 28f0fe6f ("build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS")
Fixes: ce028cef ("build: fix autotools build under mingw")
3 years agoFix O_RDONLY (_O_RDONLY) under mingw
Azat Khuzhin [Tue, 27 Apr 2021 06:03:42 +0000 (09:03 +0300)]
Fix O_RDONLY (_O_RDONLY) under mingw

O_RDONLY is defined only if [1]:

    !defined(NO_OLDNAMES) || defined(_POSIX)

  [1]: https://github.com/Alexpux/mingw-w64/blob/d0d7f784833bbb0b2d279310ddc6afb52fe47a46/mingw-w64-headers/crt/fcntl.h#L35

3 years agoRetry write on EINTR in signal handler
Mike Sharov [Sun, 25 Apr 2021 13:12:29 +0000 (09:12 -0400)]
Retry write on EINTR in signal handler

The signal handler writes the received signal number as a byte value
into the notification pipe. If two signals are received in quick
succession, one of the writes may fail with EINTR without writing the
byte. This commit will check for EINTR and retry the write. If the error
is other than EINTR, a warning will be logged.

Note, that:
- on systems with sigaction libevent uses sigaction with SA_RESTART
- on linux writing to pipe is restartable and firstly it will try to
  write that byte so linux should not be affected in any form [1].

  [1]: https://elixir.bootlin.com/linux/latest/source/fs/pipe.c#L545

3 years agotest/regress.h: Increase default timeval tolerance 50 ms -> 100 ms
Yi Fan Yu [Fri, 23 Apr 2021 02:35:59 +0000 (22:35 -0400)]
test/regress.h: Increase default timeval tolerance 50 ms -> 100 ms

The default timeout tolerance is 50 ms,
which causes intermittent failure in many the
related tests in arm64 QEMU.

See: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14163
(The root cause seems to be a heavy load)

Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
3 years agoMerge #1152 -- remove no op evdns functions
Azat Khuzhin [Sat, 3 Apr 2021 09:50:53 +0000 (12:50 +0300)]
Merge #1152 -- remove no op evdns functions

* upstream/pr/1152:
  dns: remove evdns_set_transaction_id_fn
  dns: remove evdns_set_random_bytes_fn

3 years agosample: use unsigned short instead of int for port
Emil Engler [Fri, 2 Apr 2021 19:02:12 +0000 (21:02 +0200)]
sample: use unsigned short instead of int for port

The C standard gurantees that an unsigned short is at least up to 65535
huge. Enough to store every TCP port. Also the parameter PORT is
overgiven to the `htons()` function which assumes that the parameter is
of type `uint16_t` which unsigned short is on most platforms.

3 years agodns: remove evdns_set_transaction_id_fn
fanquake [Sat, 3 Apr 2021 04:55:32 +0000 (12:55 +0800)]
dns: remove evdns_set_transaction_id_fn

3 years agodns: remove evdns_set_random_bytes_fn
fanquake [Sat, 3 Apr 2021 04:55:11 +0000 (12:55 +0800)]
dns: remove evdns_set_random_bytes_fn

3 years agodoc: adjust edge-trigger notice on event_new()
Emil Engler [Fri, 2 Apr 2021 18:59:55 +0000 (20:59 +0200)]
doc: adjust edge-trigger notice on event_new()

This makes it easier to read and to understand it in my opinon. It also
fixes a missing "-" character.

3 years agoRevert "build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS"
Azat Khuzhin [Fri, 2 Apr 2021 06:19:55 +0000 (09:19 +0300)]
Revert "build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS"

That commit was wrong, it breaks syntax for autoconf <2.71, since
AC_CHECK_*S() requires sh-like list.

This reverts commit 28f0fe6fd1e2b1e9fb24a5c7a5b078790890e44f.

Fixes: #1149
3 years agobuild: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS
Azat Khuzhin [Sun, 28 Mar 2021 14:16:54 +0000 (17:16 +0300)]
build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS

autoconf 2.72 reports:

    configure.ac:188: warning: AC_CHECK_HEADERS(\
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/headers.m4:217: AC_CHECK_HEADERS is expanded from...
    configure.ac:188: the top level
    configure.ac:188: warning: AC_CHECK_HEADERS(afunix.h
    ): you should use literals

And also it fails to find fcntl.h and other headers because of this:

    configure:14725: checking for  fcntl.h
    configure:14725: gcc -c -I/mingw64/include  conftest.c >&5
    conftest.c:77:10: fatal error:  fcntl.h: No such file or directory
       77 | #include < fcntl.h>

Refs: https://github.com/libevent/libevent/pull/1146/checks?check_run_id=2211752215

3 years agobuild: fix autotools build under mingw
Azat Khuzhin [Sun, 28 Mar 2021 06:01:58 +0000 (09:01 +0300)]
build: fix autotools build under mingw

autotools that is shipped with mingw (autoconf 2.71-1, automake
1.6-1.16, automake wrapper 11-1), does not allow trailing backslashes
for AC_CHECK_HEADERS() and AC_CHECK_FUNCS(), otherwise it generates
incorrect for loop, and reports:

    ../configure: line 14724: syntax error near unexpected token `as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh`'
    ../configure: line 14724: `  as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh`'
    Error: Process completed with exit code 1.

Here is a simple analog:

    for VAR in <CR> foo \ <CR> bar \
    do :
        echo $VAR
    done

Trailing slash is not allowed.

Refs:
- https://github.com/libevent/libevent/runs/2171607687
- https://github.com/libevent/libevent/runs/2211365885?check_suite_focus=true

3 years agobuild: remove no-longer used checks for vasprintf
fanquake [Sun, 28 Mar 2021 02:35:22 +0000 (10:35 +0800)]
build: remove no-longer used checks for vasprintf

From what I can tell the last usage was removed in
8d1317d71c46e27c5073d3429a64af69de0351a6.

3 years agobuild: remove splice implementation fragments
fanquake [Sun, 28 Mar 2021 02:57:11 +0000 (10:57 +0800)]
build: remove splice implementation fragments

Looks like a `splice` implementation was planned, but has clearly never
eventuated (the TODO comment is from ~12 years ago, in
8b5bd77415fb6634fadf08357676926fecf5f032). For now, it's probably better
to remove the unused code/correct the docs.

3 years agoci: fix upload-artifacts for linux dist build
Azat Khuzhin [Tue, 23 Mar 2021 06:40:30 +0000 (09:40 +0300)]
ci: fix upload-artifacts for linux dist build

Fixes [1]:

    Run actions/upload-artifact@v1
    Error: Path does not exist /home/runner/work/libevent/libevent/build
    Error: Exit code 1 returned from process: file name '/home/runner/runners/2.277.1/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Artifact.PublishArtifact, Runner.Plugins"'.

  [1]: https://github.com/libevent/libevent/runs/2172680722?check_suite_focus=true

3 years agoMerge branch 'http-fix-fd-leak'
Azat Khuzhin [Tue, 23 Mar 2021 06:10:00 +0000 (09:10 +0300)]
Merge branch 'http-fix-fd-leak'

* http-fix-fd-leak:
  http: fix fd leak on fd reset (by using bufferevent_replacefd())
  bufferevent: introduce bufferevent_replacefd() (like setfd() but also close fd)

Fixes: #1143
3 years agohttp: fix fd leak on fd reset (by using bufferevent_replacefd())
Azat Khuzhin [Tue, 23 Mar 2021 06:02:39 +0000 (09:02 +0300)]
http: fix fd leak on fd reset (by using bufferevent_replacefd())

Fixes: afa66ea4 ("http: eliminate redundant bev fd manipulating and caching [WIP]")
3 years agobufferevent: introduce bufferevent_replacefd() (like setfd() but also close fd)
Azat Khuzhin [Tue, 23 Mar 2021 06:00:24 +0000 (09:00 +0300)]
bufferevent: introduce bufferevent_replacefd() (like setfd() but also close fd)

3 years agobuild: use AC_CHECK_LIB over AC_HAVE_LIBRARY
fanquake [Tue, 23 Mar 2021 01:52:14 +0000 (09:52 +0800)]
build: use AC_CHECK_LIB over AC_HAVE_LIBRARY

AC_HAVE_LIBRARY is deprecated, see
https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Obsolete-Macros.html,
and has been prior to Autoconf 2.67, which is the minimum required by
the project. It's usage also causes warnings with newer versions of autoconf:
```bash
configure.ac:319: warning: The macro `AC_HAVE_LIBRARY' is obsolete.
configure.ac:319: You should run autoupdate.
```

`AC_HAVE_LIBRARY` was introduced in #969, although it's not clear why it
was decided to revert to using an obselete macro.

3 years agofix compile error in VS2012 in evutil_gettimeofday()
MKCKR [Tue, 16 Feb 2021 05:26:44 +0000 (13:26 +0800)]
fix compile error in VS2012 in evutil_gettimeofday()

Move static variable definition before other statement, to prevent
compile error in VS2012.

Fixes: #1135
3 years agohttp: fix invalid unsigned arithmetic
ihsinme [Fri, 5 Feb 2021 15:54:30 +0000 (18:54 +0300)]
http: fix invalid unsigned arithmetic

3 years agoCheck return value of evbuffer_remove() in bufferevent_read()
lilei [Wed, 3 Feb 2021 06:19:57 +0000 (14:19 +0800)]
Check return value of evbuffer_remove() in bufferevent_read()

The conflict cast convertion between the return value of
bufferevent_read() and evbuffer_remove(), int(-1)->size_t(An undefined
maximum)

Add test case of bufferevent_read() should return 0 in case of
evbuffer_remove() returns -1

Fixes: #1132
3 years agotest/regress_http: cover reading of chunked payload by server
Azat Khuzhin [Mon, 18 Jan 2021 20:23:42 +0000 (23:23 +0300)]
test/regress_http: cover reading of chunked payload by server

This is an example with transfer-encoding by client via bufferevent for
the #1131

3 years agoevdns: add max-probe-timeout/probe-backoff-factor settings
chux0519 [Sat, 9 Jan 2021 09:19:27 +0000 (17:19 +0800)]
evdns: add max-probe-timeout/probe-backoff-factor settings

I recently found that when the network status changed when calling
bufferevent_socket_connect_hostname (e.g. switching between several
WIFIs), all DNS servers would fail, and the timeout of probe would be
very long if there were many DNS requests. I want libevent to support
manual setting of MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR

So move hardcoded MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR into
struct, and allow changing them.

3 years agodoc: remove dead link
Emil Engler [Sat, 26 Dec 2020 08:07:07 +0000 (09:07 +0100)]
doc: remove dead link

The link is dead and an archived page cannot be found in the
web.archive.org.

3 years agocmake: do not link libevent with libevent_core
Loïc Yhuel [Mon, 23 Nov 2020 16:24:36 +0000 (17:24 +0100)]
cmake: do not link libevent with libevent_core

When add_event_library macro was called without the INNER_LIBRARIES parameter, it reused the
value set by a previous call, since the INNER_LIBRARIES variable was not reset.

3 years agoDo not try to do SSL handshake if the connect() fails
Azat Khuzhin [Wed, 4 Nov 2020 21:57:39 +0000 (00:57 +0300)]
Do not try to do SSL handshake if the connect() fails

This will avoid this icky error:

    $ https-client -4 -url https://127.1
    some request failed - no idea which one though!
    error:00000005:lib(0):func(0):DH lib

And instead will report only:

    $ https-client -4 -url https://127.1
    some request failed - no idea which one though!
    socket error = Connection refused (111)

Refs: #1115

3 years agoMerge branch 'macos-brew-openssl-v2'
Azat Khuzhin [Mon, 2 Nov 2020 07:01:41 +0000 (10:01 +0300)]
Merge branch 'macos-brew-openssl-v2'

By Azat Khuzhin (2) and fanquake (1)
* macos-brew-openssl-v2:
  Add autodetection of openssl via brew into build matrix
  cmake: find openssl prefix via brew
  autotools: attempt to find OpenSSL via homebrew on macOS

Closes: #1050 (cherry picked one patch from it)
3 years agoAdd autodetection of openssl via brew into build matrix
Azat Khuzhin [Sun, 1 Nov 2020 21:39:26 +0000 (00:39 +0300)]
Add autodetection of openssl via brew into build matrix

3 years agocmake: find openssl prefix via brew
Azat Khuzhin [Sat, 31 Oct 2020 22:39:02 +0000 (01:39 +0300)]
cmake: find openssl prefix via brew

3 years agoautotools: attempt to find OpenSSL via homebrew on macOS
fanquake [Tue, 7 Jul 2020 06:58:29 +0000 (14:58 +0800)]
autotools: attempt to find OpenSSL via homebrew on macOS

When compiling for macOS, where users will likely have OpenSSL installed
via brew, rather than available on the system, use brew  --prefix to
figure out where OpenSSL is, and then augment the pkg-config path so
that libs are found.

3 years agoFix bufferevent_ssl_*flags() w/ disabled OpenSSL but enabled mbedTLS
Azat Khuzhin [Sat, 31 Oct 2020 21:59:16 +0000 (00:59 +0300)]
Fix bufferevent_ssl_*flags() w/ disabled OpenSSL but enabled mbedTLS

3 years agoMerge branch 'ssl-nagle'
Azat Khuzhin [Sat, 31 Oct 2020 20:04:55 +0000 (23:04 +0300)]
Merge branch 'ssl-nagle'

* ssl-nagle:
  Introduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL
  Introduce new API for flags of the SSL bufferevent

3 years agoIntroduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL
Azat Khuzhin [Sat, 31 Oct 2020 19:53:31 +0000 (22:53 +0300)]
Introduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL

3 years agoIntroduce new API for flags of the SSL bufferevent
Azat Khuzhin [Sat, 31 Oct 2020 18:45:22 +0000 (21:45 +0300)]
Introduce new API for flags of the SSL bufferevent

Introduce more generic API (like for evbuffer):
- bufferevent_ssl_set_flags()
- bufferevent_ssl_clear_flags()
- bufferevent_ssl_get_flags()

And deprecate existing:
- bufferevent_openssl_get_allow_dirty_shutdown()
- bufferevent_openssl_set_allow_dirty_shutdown()
- bufferevent_mbedtls_get_allow_dirty_shutdown()
- bufferevent_mbedtls_set_allow_dirty_shutdown()

3 years agoMerge branch 'ssl-fixes-after-mbedtls'
Azat Khuzhin [Sat, 31 Oct 2020 19:50:11 +0000 (22:50 +0300)]
Merge branch 'ssl-fixes-after-mbedtls'

* ssl-fixes-after-mbedtls:
  Fix BEV_IS_SSL() macro
  Fix preprocessor condition for BEV_IS_SSL()
  Remove reduntant BEV_IS_MBEDTLS

Refs: #1028

3 years agoFix BEV_IS_SSL() macro
Azat Khuzhin [Sat, 31 Oct 2020 19:48:37 +0000 (22:48 +0300)]
Fix BEV_IS_SSL() macro

We cannot use the same trick with external declaration,
since there are copy of bufferevent_ops_ssl in each library:
- openssl
- mbedlts

However we can just compare the name of the bufferevent type for now.
(It is totally fine to use memcmp() here since it will be optimized by the compiler).

3 years agoFix preprocessor condition for BEV_IS_SSL()
Azat Khuzhin [Sat, 31 Oct 2020 19:41:16 +0000 (22:41 +0300)]
Fix preprocessor condition for BEV_IS_SSL()

3 years agoRemove reduntant BEV_IS_MBEDTLS
Azat Khuzhin [Sat, 31 Oct 2020 19:27:18 +0000 (22:27 +0300)]
Remove reduntant BEV_IS_MBEDTLS

3 years agohttp: eliminate redundant bev fd manipulating and caching [WIP]
Azat Khuzhin [Tue, 3 Sep 2019 21:56:20 +0000 (00:56 +0300)]
http: eliminate redundant bev fd manipulating and caching [WIP]

At the very beginning we reset the bufferevent fd (if bev has it), which
is not a good idea, since if user passes bufferevent with existing fd he
has some intention.

So we need to:
- use BEV_OPT_CLOSE_ON_FREE for default bufferevent_socket_new() (to
  avoid manual shutdown/closee)
- drop getsockopt(SOL_SOCKET, SO_ERROR), since bufferevent already has
  evutil_socket_finished_connecting_()
- drop supperior bufferevent_setfd(bev, -1) in
  evhttp_connection_connect_()

Closes: #795
Refs: #875

3 years agoMerge branch 'ipv6-tiny-improvements'
Azat Khuzhin [Mon, 26 Oct 2020 23:15:38 +0000 (02:15 +0300)]
Merge branch 'ipv6-tiny-improvements'

* ipv6-tiny-improvements:
  http: add EVHTTP_URI_HOST_STRIP_BRACKETS
  http-server: add -H option to change listen address
  https-client: add newline into error messages
  https-client: add -4/-6 switches

3 years agohttp: add EVHTTP_URI_HOST_STRIP_BRACKETS
Azat Khuzhin [Mon, 26 Oct 2020 22:40:34 +0000 (01:40 +0300)]
http: add EVHTTP_URI_HOST_STRIP_BRACKETS

Refs: #1115

3 years agohttp-server: add -H option to change listen address
Azat Khuzhin [Mon, 26 Oct 2020 22:22:59 +0000 (01:22 +0300)]
http-server: add -H option to change listen address

3 years agohttps-client: add newline into error messages
Azat Khuzhin [Mon, 26 Oct 2020 22:19:40 +0000 (01:19 +0300)]
https-client: add newline into error messages

3 years agohttps-client: add -4/-6 switches
Azat Khuzhin [Mon, 26 Oct 2020 22:17:44 +0000 (01:17 +0300)]
https-client: add -4/-6 switches

3 years agobecat: add timeout (client/server) and verbosity (event_enable_debug_logging())
Azat Khuzhin [Thu, 15 Oct 2020 20:23:15 +0000 (23:23 +0300)]
becat: add timeout (client/server) and verbosity (event_enable_debug_logging())

3 years agoChange log message in evutil_make_socket_nonblocking in win32
guoxiang1996 [Sat, 10 Oct 2020 19:23:14 +0000 (03:23 +0800)]
Change log message in evutil_make_socket_nonblocking in win32

Co-authored-by: guoxiang2 <guoxiang2@yy.com>
3 years agoChange prefix for man pages from "le_" to "libevent_"
Azat Khuzhin [Sun, 4 Oct 2020 19:56:30 +0000 (22:56 +0300)]
Change prefix for man pages from "le_" to "libevent_"

As pointed by @kloczek:
  "With only two characters it would be harder to guess under what kind of name are libevent lvl 3 man pages.
   Longer name with bash/fix/zsh tab competition should not be a problem :)"

Refs: #1099

3 years agoAdd prefix (le_) for man pages
Azat Khuzhin [Sun, 4 Oct 2020 16:55:52 +0000 (19:55 +0300)]
Add prefix (le_) for man pages

This will:
- avoid overlapping (since there is util.h.3 page)
- group everything under some prefix (man le_<TAB><TAB> will show everything)

Fixes: #1099
3 years agoDrop DOXYGEN_MAN_LINKS unsupported cmake flag
Azat Khuzhin [Sun, 4 Oct 2020 16:48:34 +0000 (19:48 +0300)]
Drop DOXYGEN_MAN_LINKS unsupported cmake flag

MAN_LINKS is not a variable in Doxyfile anyway.

3 years agohttp-server: add cli argument for max body size
Azat Khuzhin [Sun, 4 Oct 2020 14:44:34 +0000 (17:44 +0300)]
http-server: add cli argument for max body size

4 years agoRemove dead code from bufferevent_socket_connect
Nikita Gorskikh [Fri, 18 Sep 2020 13:34:34 +0000 (16:34 +0300)]
Remove dead code from bufferevent_socket_connect

4 years agoGenerate only real man pages with doxygen (MAN_LINKS=NO)
Azat Khuzhin [Wed, 16 Sep 2020 05:10:11 +0000 (08:10 +0300)]
Generate only real man pages with doxygen (MAN_LINKS=NO)

WIth MAN_LINKS=YES doxygen will generate ton's of man pages for each
field, function and so on, but it will not contain anything useful
except for link to another man page (header).

So to avoid man pages clashing, disable MAN_LINKS, and this will
generate man pages only for explicitly documented parts.

But even after this we have pretty non-unique man pages names:

    $ find install/ -name '*.3'
    install/share/man/man3/util.h.3
    ...

Looks like we should add prefix for each of them...
But let's see if there will be a problem.

Fixes: #1097
4 years agoRemove man pages from repo (they can be generated via doxygen)
Azat Khuzhin [Wed, 16 Sep 2020 05:25:20 +0000 (08:25 +0300)]
Remove man pages from repo (they can be generated via doxygen)

The problem with this man pages are:
- they are likely outdated
- they don't have install target
- and besides quality of man pages generated by doxygen not worse

4 years agosample: add https-client-mbedtls
okhowang(王沛文) [Wed, 16 Sep 2020 03:31:33 +0000 (11:31 +0800)]
sample: add https-client-mbedtls

4 years agotest: fix windows error when mbedtls https
okhowang(王沛文) [Tue, 15 Sep 2020 10:15:24 +0000 (18:15 +0800)]
test: fix windows error when mbedtls https

4 years agoMerge #1087 - tests for https with mbedtls
Azat Khuzhin [Mon, 14 Sep 2020 18:37:50 +0000 (21:37 +0300)]
Merge #1087 - tests for https with mbedtls

* upstream/pr/1087:
  test: add https with mbedtls
  bufferevent_openssl: fix -Wcast-function-type for SSL_pending

4 years agoAdd build w/o any SSL support (i.e. w/o openssl and mbedtls)
Azat Khuzhin [Mon, 14 Sep 2020 18:30:02 +0000 (21:30 +0300)]
Add build w/o any SSL support (i.e. w/o openssl and mbedtls)

This pure build w/o SSL has been removed in mbedtls PR - #1028

4 years agotest: add https with mbedtls
okhowang(王沛文) [Sun, 6 Sep 2020 07:33:32 +0000 (15:33 +0800)]
test: add https with mbedtls

4 years agobufferevent_openssl: fix -Wcast-function-type for SSL_pending
okhowang(王沛文) [Sat, 25 Jul 2020 09:17:46 +0000 (17:17 +0800)]
bufferevent_openssl: fix -Wcast-function-type for SSL_pending

Introduced-in: #1028

4 years agohttp: const out address param to evcon_get_peer
Leon M. George [Tue, 8 Sep 2020 13:38:16 +0000 (15:38 +0200)]
http: const out address param to evcon_get_peer

4 years agobuild: fix building under windows with thread support
Azat Khuzhin [Mon, 31 Aug 2020 22:08:16 +0000 (01:08 +0300)]
build: fix building under windows with thread support

Fixes: 972289f3 ("Detect existence of pthread_mutexattr_setprotocol()")
4 years agoFix: long -> enum evhttp_cmd_type type
Berbe [Sat, 29 Aug 2020 16:41:39 +0000 (18:41 +0200)]
Fix: long -> enum evhttp_cmd_type type

4 years agotest/regress_dns: fix -Wmaybe-uninitialized
Azat Khuzhin [Fri, 28 Aug 2020 22:15:20 +0000 (01:15 +0300)]
test/regress_dns: fix -Wmaybe-uninitialized

Was not noticed since it is reported only with optimization enabled, as
stated in gcc(1):

   The effectiveness of some warnings depends on optimizations also
   being enabled. For example -Wsuggest-final-types is more effective with
   link-time optimization and -Wmaybe-uninitialized does not warn at all
   unless optimization is enabled.

And interesting thing is that it is reported only for -O2, not for -O3,
that's why I did not catched it in both cmake env that I had:
- debug (it has -O0)
- release (it has -O3)

While autoconf has -O2.

4 years agoDetect existence of pthread_mutexattr_setprotocol()
Azat Khuzhin [Fri, 28 Aug 2020 22:15:20 +0000 (01:15 +0300)]
Detect existence of pthread_mutexattr_setprotocol()

Fixes: #1084
4 years agobuild: add doxygen to all
Azat Khuzhin [Mon, 10 Aug 2020 23:12:23 +0000 (02:12 +0300)]
build: add doxygen to all

Fixes: 7e6c5fb4 ("build: do not try install doxygen man pages if they were not requested")
Fixes: #1075
Fixes: #886
4 years agobuild: do not try install doxygen man pages if they were not requested
Azat Khuzhin [Thu, 6 Aug 2020 07:24:55 +0000 (10:24 +0300)]
build: do not try install doxygen man pages if they were not requested

Fixes: #1075
4 years agoMerge #1074
Azat Khuzhin [Thu, 6 Aug 2020 07:12:07 +0000 (10:12 +0300)]
Merge #1074

yuangongji:
  "Fix CI failures #1071
  - Install vcpkg through the source code to temporarily solve the windows CI problem.
  - Update cache version and replace setup-msys2."

* upstream/pr/1074:
  fix CI:Update cache version and replace setup-msys2
  fix CI: Install vcpkg through the source code to temporarily solve the windows CI problem

4 years agofix CI:Update cache version and replace setup-msys2
yuangongji [Wed, 5 Aug 2020 04:12:08 +0000 (12:12 +0800)]
fix CI:Update cache version and replace setup-msys2

4 years agofix CI: Install vcpkg through the source code to temporarily solve the windows CI...
yuangongji [Wed, 5 Aug 2020 02:14:53 +0000 (10:14 +0800)]
fix CI: Install vcpkg through the source code to temporarily solve the windows CI problem

4 years agoConvert from WinCrypt to Windows BCrypt
Gerry Garvey [Sat, 1 Aug 2020 15:10:48 +0000 (16:10 +0100)]
Convert from WinCrypt to Windows BCrypt

Fixes: #1069
4 years agoHandle return value from getrandom()
Gerry Garvey [Sat, 1 Aug 2020 13:05:39 +0000 (14:05 +0100)]
Handle return value from getrandom()

4 years agoRemove reduntant variables in workflows with deploy
Azat Khuzhin [Tue, 28 Jul 2020 08:03:46 +0000 (11:03 +0300)]
Remove reduntant variables in workflows with deploy

Fixes: bfbbc882 ("Change user.name/user.email to robot for deploy via github actions")
4 years agoChange user.name/user.email to robot for deploy via github actions
Azat Khuzhin [Tue, 28 Jul 2020 08:02:15 +0000 (11:02 +0300)]
Change user.name/user.email to robot for deploy via github actions

4 years agotest/dns: fix initialize_nameservers when there is ipv6 in /etc/resolv.conf
Azat Khuzhin [Mon, 27 Jul 2020 22:19:28 +0000 (01:19 +0300)]
test/dns: fix initialize_nameservers when there is ipv6 in /etc/resolv.conf

Fixes: #1060