4494 Commits

Author SHA1 Message Date
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
Azat Khuzhin
62c152d9a7 Remove reduntant variables in workflows with deploy
Fixes: bfbbc882 ("Change user.name/user.email to robot for deploy via github actions")
2020-07-28 11:04:16 +03:00
Azat Khuzhin
bfbbc88296 Change user.name/user.email to robot for deploy via github actions 2020-07-28 11:02:59 +03:00
Azat Khuzhin
eeeed1e1bb test/dns: fix initialize_nameservers when there is ipv6 in /etc/resolv.conf
Fixes: #1060
2020-07-28 01:19:55 +03:00
Pierce Lopez
65199178c6 windows socketpair tmpfile: use random prefix
fixes #1058

GetTempFileNameA() takes an optional prefix, and a "unique" long value
which can optionally be zero, which causes it to automatically
increment until a not-yet-existing filename is found.

When libevent creates many AF_UNIX socketpairs on windows,
it slows down dramatically, due to always using the same blank prefix,
and GetTempFileNameA() needing to iterate through all the existing
socketpair filenames. With a present and varying prefix, it will have
much less need to iterate.

It was also possible for a race with other processes also using
blank-prefix tmpfile names to result in both trying to start using
the same name at the same time (because libevent deletes the file
and then re-creates it as a unix socket), which should now be
much less likely.

Unfortuantely, "much" is just a factor of 32k, because the prefix
is only 3 characters, and windows filesystems are case-insensitive,
so doing better would require more sophisticated windows API usage
and charset trickyness.
2020-07-26 18:01:35 -04:00
okhowang(王沛文)
85c6759926 fix: compat mbedtls < 2.4 2020-07-24 17:19:14 +08:00
Azat Khuzhin
948ad30435 Fix bufferevent_get_{openssl,mbedtls}_error()
The bufferevent_get_openssl_error() returns unsigned long, so returning
-1 on error in unclear. Let's use 0.

Fixes: #1028
2020-07-23 23:41:31 +03:00
Azat Khuzhin
50dac7aded ci/doxygen: install missing libmbedtls-dev 2020-07-23 02:01:18 +03:00
Azat Khuzhin
8ec4682623 ci/coverage: add missing libmbedtls-dev 2020-07-23 01:09:11 +03:00
Azat Khuzhin
e458696c1e le-proxy: ignore SIGPIPE
Fixes: #1057
2020-07-23 00:28:09 +03:00
Azat Khuzhin
53e53b018b test/regress_buffer.c: fix -Wbad-function-cast (in some specific env)
Fixes: #1054
2020-07-23 00:22:45 +03:00
Azat Khuzhin
0e339b04b5 Merge branch 'mbedtls'
This patch set provides mbed TLS support.

The interface part (include/event2/bufferevent_ssl.h) LGTM, so this can
be safely merged (although there are some bits left).

Includes:
- bufferevent_mbedtls_*
- regress_mbedtls tests

Left:
- regress_http https_mbedtls support
- ChangeLog entry

* mbedtls:
  test: rename ssl/* -> openssl/*
  Join le_ssl_ops.post_init with le_ssl_ops.init
  Update LICENSE for ssl-client-mbedtls.c
  Merge ssl implementations (openssl and mbedtls)
  add mbedtls to CI
  fix build system and add test and cleanup code
  mbed TLS cmake support
  simple https client example using mbedtls
  mbedtls based SSL implementation
2020-07-23 00:16:24 +03:00
Azat Khuzhin
1bfbbdf2b4 test: rename ssl/* -> openssl/* 2020-07-22 23:10:26 +03:00
Azat Khuzhin
5671575a1c Join le_ssl_ops.post_init with le_ssl_ops.init 2020-07-22 23:08:50 +03:00
Azat Khuzhin
e1cdf1a182 Update LICENSE for ssl-client-mbedtls.c 2020-07-22 23:04:02 +03:00
okhowang(王沛文)
d095b834a9 Merge ssl implementations (openssl and mbedtls)
This patch splits common part out to avoid copy-paste from the
- bufferevent_openssl.c
- bufferevent_mbedtls.c

It uses VFS/bufferevent-like approach, i.e. structure of callbacks.
2020-07-22 23:03:17 +03:00
okhowang(王沛文)
dad699cc04 add mbedtls to CI 2020-07-22 22:53:23 +03:00
okhowang(王沛文)
028385f685 fix build system and add test and cleanup code 2020-07-22 22:53:23 +03:00