4511 Commits

Author SHA1 Message Date
Azat Khuzhin
f17eb6f509 test/regress_http: cover reading of chunked payload by server
This is an example with transfer-encoding by client via bufferevent for
the #1131
2021-01-19 01:23:42 +03:00
chux0519
617ba83874 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.
2021-01-12 10:56:13 +03:00
Emil Engler
c5e4391b86
doc: remove dead link
The link is dead and an archived page cannot be found in the
web.archive.org.
2020-12-26 09:07:19 +01:00
Loïc Yhuel
657e180694 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.
2020-11-23 17:24:36 +01:00
Azat Khuzhin
59e31c9667 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
2020-11-05 00:57:39 +03:00
Azat Khuzhin
4f8a6320ca 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)
2020-11-02 10:01:41 +03:00
Azat Khuzhin
29b1404ba2 Add autodetection of openssl via brew into build matrix 2020-11-02 01:14:58 +03:00
Azat Khuzhin
1a242e1c96 cmake: find openssl prefix via brew 2020-11-02 01:14:58 +03:00
fanquake
72d877a2c2 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.
2020-11-01 23:34:10 +03:00
Azat Khuzhin
8d21ddcf4b Fix bufferevent_ssl_*flags() w/ disabled OpenSSL but enabled mbedTLS 2020-11-01 00:59:16 +03:00
Azat Khuzhin
8daa1aba3d 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
2020-10-31 23:04:55 +03:00
Azat Khuzhin
a490172d69 Introduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL 2020-10-31 23:04:46 +03:00
Azat Khuzhin
7e0fc878c5 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()
2020-10-31 22:51:40 +03:00
Azat Khuzhin
587f6c83a3 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
2020-10-31 22:50:11 +03:00
Azat Khuzhin
2484500ac2 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).
2020-10-31 22:50:04 +03:00
Azat Khuzhin
db6e22c7db Fix preprocessor condition for BEV_IS_SSL() 2020-10-31 22:50:04 +03:00
Azat Khuzhin
39ca97ef4d Remove reduntant BEV_IS_MBEDTLS 2020-10-31 22:27:28 +03:00
Azat Khuzhin
afa66ea420 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
2020-10-31 21:34:02 +03:00
Azat Khuzhin
67180f8c37 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
2020-10-27 02:15:38 +03:00
Azat Khuzhin
e91c436388 http: add EVHTTP_URI_HOST_STRIP_BRACKETS
Refs: #1115
2020-10-27 02:13:21 +03:00
Azat Khuzhin
eb822ac751 http-server: add -H option to change listen address 2020-10-27 01:23:33 +03:00
Azat Khuzhin
6135248a0c https-client: add newline into error messages 2020-10-27 01:19:40 +03:00
Azat Khuzhin
f51ec25306 https-client: add -4/-6 switches 2020-10-27 01:18:52 +03:00
Azat Khuzhin
22872176a4 becat: add timeout (client/server) and verbosity (event_enable_debug_logging()) 2020-10-15 23:23:15 +03:00
guoxiang1996
6c644949d5
Change log message in evutil_make_socket_nonblocking in win32
Co-authored-by: guoxiang2 <guoxiang2@yy.com>
2020-10-10 22:23:14 +03:00
Azat Khuzhin
19d0bdfe0c 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
2020-10-04 22:59:12 +03:00
Azat Khuzhin
21b91692da 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
2020-10-04 21:33:00 +03:00
Azat Khuzhin
3012c43808 Drop DOXYGEN_MAN_LINKS unsupported cmake flag
MAN_LINKS is not a variable in Doxyfile anyway.
2020-10-04 19:48:34 +03:00
Azat Khuzhin
852af060af http-server: add cli argument for max body size 2020-10-04 17:44:34 +03:00
Nikita Gorskikh
56e1213109 Remove dead code from bufferevent_socket_connect 2020-09-19 19:14:22 +03:00
Azat Khuzhin
9b270c5e02 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
2020-09-16 08:27:10 +03:00
Azat Khuzhin
31a5cfd3b1 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
2020-09-16 08:27:03 +03:00
okhowang(王沛文)
b45a02efab sample: add https-client-mbedtls 2020-09-16 11:57:52 +08:00
okhowang(王沛文)
53c6867520 test: fix windows error when mbedtls https 2020-09-16 10:04:36 +08:00
Azat Khuzhin
6752070909 Merge #1087 - tests for https with mbedtls
* upstream/pr/1087:
  test: add https with mbedtls
  bufferevent_openssl: fix -Wcast-function-type for SSL_pending
2020-09-14 21:37:50 +03:00
Azat Khuzhin
a7d3cd403f 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
2020-09-14 21:30:02 +03:00
okhowang(王沛文)
2403ae578f test: add https with mbedtls 2020-09-14 19:49:08 +08:00
okhowang(王沛文)
f07898e3bc bufferevent_openssl: fix -Wcast-function-type for SSL_pending
Introduced-in: #1028
2020-09-09 00:48:03 +03:00
Leon M. George
a18301a2bb http: const out address param to evcon_get_peer 2020-09-09 00:37:17 +03:00
Azat Khuzhin
02428d9a2d build: fix building under windows with thread support
Fixes: 972289f3 ("Detect existence of pthread_mutexattr_setprotocol()")
2020-09-01 01:08:50 +03:00
Berbe
c2a9ecffef
Fix: long -> enum evhttp_cmd_type type 2020-08-29 20:05:52 +02:00
Azat Khuzhin
2338f27e69 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.
2020-08-29 01:15:20 +03:00
Azat Khuzhin
972289f356 Detect existence of pthread_mutexattr_setprotocol()
Fixes: #1084
2020-08-29 01:15:20 +03:00
Azat Khuzhin
e3e7bb212e build: add doxygen to all
Fixes: 7e6c5fb4 ("build: do not try install doxygen man pages if they were not requested")
Fixes: #1075
Fixes: #886
2020-08-11 02:38:22 +03:00
Azat Khuzhin
7e6c5fb46a build: do not try install doxygen man pages if they were not requested
Fixes: #1075
2020-08-06 10:32:22 +03:00
Azat Khuzhin
4cf0d712e3 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
2020-08-06 10:12:07 +03:00
yuangongji
cf2ac1af08 fix CI:Update cache version and replace setup-msys2 2020-08-05 15:47:03 +08:00
yuangongji
92b9109ef8 fix CI: Install vcpkg through the source code to temporarily solve the windows CI problem 2020-08-05 12:00:05 +08:00
Gerry Garvey
eb7bed03c4 Convert from WinCrypt to Windows BCrypt
Fixes: #1069
2020-08-02 18:27:10 +03:00
Gerry Garvey
efa57159dd Handle return value from getrandom() 2020-08-02 10:02:34 -04:00