4443 Commits

Author SHA1 Message Date
Azat Khuzhin
5388a002f5
autotools: do not install bufferevent_ssl.h under --disable-openssl
Refs: https://github.com/libevent/libevent/issues/760#issuecomment-502345788
2019-06-26 09:47:36 +03:00
Azat Khuzhin
69466cde03
cmake: link against shell32.lib/advapi32.lib
Fixes: #844
Refs: #760 (cmake-vs-autotools)
2019-06-26 01:27:20 +03:00
Azat Khuzhin
97488b2c28
Add README.md/Documentation into dist archive
Fixes: #841
2019-06-26 01:22:23 +03:00
Azat Khuzhin
bd2de4836b
Require cmake >= 3.1.2 (for correct openssl 1.0.2 detection)
@ygj6 reported:
  "My platform is MacOS 10.13.5, This problem only happens on Mac.

   As written in the file CMakeLists.txt, the minimum required version of cmake is 3.1:
     cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
   So I built this project with cmake-3.1.0, but I got the following errors:

       CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:293 (list):
         list GET given empty list
       Call Stack (most recent call first):
         CMakeLists.txt:824 (find_package)

       CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:294 (list):
         list GET given empty list
       Call Stack (most recent call first):
         CMakeLists.txt:824 (find_package)

       CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:296 (list):
         list GET given empty list
       Call Stack (most recent call first):
         CMakeLists.txt:824 (find_package)

       CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:298 (list):
         list GET given empty list
       Call Stack (most recent call first):
         CMakeLists.txt:824 (find_package)

   I googled this error and got this answer:
     https://bugs.archlinux.org/task/43688

   It is a bug in FindOpenSSL.cmake on cmake-3.1.0 and fixed on cmake-3.1.2 .
   Of course, It was successful when rebuilding with cmake-3.1.2 .
   So I suggest setting the minimum version required for cmake to 3.1.2 or higher.
   "

Closes: #845
Refs: de4ccee75a
2019-06-26 01:01:46 +03:00
Azat Khuzhin
538141eb7e
evdns: add new options -- so-rcvbuf/so-sndbuf
This will allow to customize SO_RCVBUF/SO_SNDBUF for nameservers in this
evdns_base, you may want to adjust them if the kernel starts dropping
udp packages.
2019-06-15 23:32:39 +03:00
Azat Khuzhin
4f6fc092b3
evutil: drop force_check from evutil_check_interfaces() (unused) 2019-06-15 00:21:04 +03:00
jeremyerb
0de2b1455b
evutil: set the have_checked_interfaces in evutil_check_interfaces()
Closes: #836 (cherry-picked)
Fixes: #834
2019-06-15 00:21:04 +03:00
yuangongji
7201062f3e
cmake: add missing autotools targets (doxygen, uninstall, event_rpcgen.py)
Close: #832 (cherry-picked)
2019-06-13 21:57:39 +03:00
Fabrice Fontaine
0374b55942 m4/libevent_openssl.m4: fix detection of openssl
Since commit 506df426dbeb0187bbd3654bd286b4100628fb16, OPENSSL_INCS is
added to CPPFLAGS without any white space, as a result openssl detection
fails on:
configure:10395: checking openssl/ssl.h usability
configure:10395: /home/fabrice/buildroot-test/buildroot/output/host/bin/riscv32-linux-gcc -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os   -Wall -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64-I/home/fabrice/buildroot-test/buildroot/output/host/bin/../riscv32-buildroot-linux-gnu/sysroot/usr/include  conftest.c >&5
<command-line>:0:0: warning: "_FILE_OFFSET_BITS" redefined
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:23: error: division by zero in #if

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-06-08 23:51:19 +02:00
yuangongji (A)
b002f04f03
doc: cmake command on Windows
Closes: #825 (cherry-pick)
2019-06-03 23:43:45 +03:00
Azat Khuzhin
2d4ac10ea4
becat: remove extra SSL_CTX options usage [ci skip]
Because:
- this do not affects performance
- this breaks builds for with older openssl
2019-06-02 21:55:31 +03:00
Azat Khuzhin
7d569b0faf
Fix detection of the __has_attribute() for apple clang [ci skip]
Fixes build on the next osx env:
- Mac OS 10.9/clang 600
- Mac OS 10.8/clang 500

Refs: https://github.com/libevent/libevent/issues/447#issuecomment-497908488
2019-06-02 21:47:43 +03:00
wenyg
891dd1880f
https-client: correction error checking
When connecting to a non-existent HTTPS service, the "req" is not null
but the "evhttp_request_get_response_code(req)" is zero.

Closes: #822 (cherry-picked)
2019-06-01 00:41:25 +03:00
yuangongji
c03dabd76a typo error in header file 2019-05-31 02:12:55 +08:00
Jan Beich
236762a30d cmake: limit MSVC to Clang-CL 2019-05-28 12:45:59 +00:00
Azat Khuzhin
1c573ab3a9
http: do not name variable "sun" since this breaks solaris builds
-bash-3.2$ /opt/csw/bin/gcc -xc /dev/null -dM -E | grep '#define sun'
  #define sun 1
2019-05-25 23:41:38 +03:00
Azat Khuzhin
51ac04ac62
test: mark bev_connect_hostname() as static (to avoid prototype requirement) 2019-05-25 17:29:55 +03:00
Azat Khuzhin
49a367e6cf
cmake: add -Wmissing-prototypes (like autotools has) 2019-05-25 17:28:53 +03:00
Azat Khuzhin
4c774b6ceb
time-test: disable buffering (mostly for windows) 2019-05-21 10:59:05 +03:00
Azat Khuzhin
3b1864b625
Merge branch 'evbuffer-fixes-806-v2'
* evbuffer-fixes-806-v2:
  evbuffer: fix last_with_datap after prepend with empty chain
  test: regression for evbuffer_expand_fast_() with invalid last_with_datap
  test: cover adjusting of last_with_datap in evbuffer_prepend()

Fixes: #806
2019-05-16 10:25:50 +03:00
Azat Khuzhin
401bd1c09e
evbuffer: fix last_with_datap after prepend with empty chain
last_with_datap should be adjusted only if it buf->first *was* not
empty, otherwise last_with_datap should point to the prepended chain.
2019-05-16 10:16:21 +03:00
Azat Khuzhin
244cacaf8c
test: regression for evbuffer_expand_fast_() with invalid last_with_datap
Before the fix:
  $ regress --no-fork evbuffer/reserve_invalid_last_with_datap
  evbuffer/empty_chain_expand: [err] ../buffer.c:2138: Assertion chain == buf->first failed in evbuffer_expand_fast_
  Aborted (core dumped)

This is the a shorter version of test from the #806 (with some
comments).
2019-05-16 10:16:21 +03:00
Azat Khuzhin
98ca307749
test: cover adjusting of last_with_datap in evbuffer_prepend()
Before the fix:
  $ regress evbuffer/empty_reference_prepend..
  evbuffer/empty_reference_prepend: [forking]
    FAIL ../test/regress_buffer.c:104: assert(chain == buf->first)
    FAIL ../test/regress_buffer.c:2291: Buffer format invalid
    [empty_reference_prepend FAILED]
  evbuffer/empty_reference_prepend_buffer: [forking] OK
  1/2 TESTS FAILED. (0 skipped)
2019-05-16 10:05:07 +03:00
Azat Khuzhin
c8b403a81b
Add getopt into dist archive
Fixes: #815
2019-05-15 21:29:03 +03:00
Joseph Spadavecchia
5e137f3776
Implement bufferevent_socket_connect_hostname_hints()
So that ai_flags (such as AI_ADDRCONFIG) can be specified.

Closes: #193 (cherry-picked with conflicts resolved)
2019-05-13 11:13:04 +03:00
Azat Khuzhin
76eded24d3
Merge branch 'issue-807-accept4-getnameinfo-AF_UNIX'
* issue-807-accept4-getnameinfo-AF_UNIX:
  http-server: add usage/help dialog
  http: avoid use of uninitialized value for AF_UNIX/AF_LOCAL sockaddr
  http-server: add ability to bind to unix-socket
  build: struct sockaddr_un detection (sys/un.h, afunix.h)

Fixes: #807
2019-05-12 19:06:43 +03:00
Azat Khuzhin
c4de602433
http-server: add usage/help dialog 2019-05-12 18:44:20 +03:00
Azat Khuzhin
ad51a3c1ba
http: avoid use of uninitialized value for AF_UNIX/AF_LOCAL sockaddr
unixsock peer does not have sun_path initialized.
2019-05-12 18:21:21 +03:00
Azat Khuzhin
737d1beb14
http-server: add ability to bind to unix-socket
Usage example:
  http-server -u -U /tmp/sock /tmp/no-such-dir
  curl -v --unix-socket /tmp/sock 127.1:8080/foo
2019-05-12 18:21:21 +03:00
Azat Khuzhin
da11217544
build: struct sockaddr_un detection (sys/un.h, afunix.h)
- On UNIX:     sys/un.h
- Since win10: afunix.h

And windows has AF_UNIX but do not have sockaddr_un (before windows
build 17061 [1]), hence the sockaddr_un detection.

  [1]: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
2019-05-12 18:17:53 +03:00
Tobias Stoeckmann
2707a4ffab
kqueue: Avoid undefined behaviour.
As ploxiln pointed out in pull request 811 the check "newsize < 0"
is undefined behaviour (signed int overflow).

Follow the advice and check kqop->changes_size instead.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #813 (cherry-picked)
2019-05-11 11:29:55 +03:00
Tobias Stoeckmann
cf8acae36a Prevent integer overflow in kq_build_changes_list.
On amd64 systems with kqueue (e.g. *BSD systems) an integer overflow
could be triggered with an excessively huge amount of events.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-05-07 20:53:17 +02:00
zhuizhuhaomeng
8701d0d3d2
evdns: fix lock/unlock mismatch in evdns_close_server_port()
Closes: #809 (cherry-picked)
2019-05-06 10:37:18 +03:00
Azat Khuzhin
c6becb26ca
Merge remote-tracking branch 'official/pr/804'
* official/pr/804:
  Added test for evmap slot validations.
  Prevent endless loop in evmap_make_space.
  Enforce limit of NSIG signals.
2019-04-30 08:43:27 +03:00
Tobias Stoeckmann
9b2060c97a Added test for evmap slot validations.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-04-27 11:47:23 +02:00
Tobias Stoeckmann
bd817009d5 Prevent endless loop in evmap_make_space.
If slot is larger than INT_MAX / 2, then the loop which increases
nentries until it is larger than slot would never return.

Also make sure that nentries * msize will never overflow INT_MAX.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-04-26 18:15:57 +02:00
Tobias Stoeckmann
4a1088baf4 Enforce limit of NSIG signals.
It doesn't make sense to allow a signal number higher than NSIG.

The NSIG check already exists in signal.c for internally used
functions.

As this is a programming error of libevent consumers, this is a
purely defensive mechanism.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-04-26 18:15:50 +02:00
Tobias Stoeckmann
176fd56655
Protect min_heap_push_ against integer overflow.
Converting unsigned to size_t for size of memory objects allows
proper handling of very large heaps on 64 bit systems.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #799 (cherry-picked)
2019-04-22 23:51:25 +03:00
linxiaohui
16d8564a2c
le-proxy: initiate use of the Winsock DLL
Closes: #803 (cherry-picked)
2019-04-18 22:43:16 +03:00
Dan Rosen
1cd8830de2 evwatch: fix race condition
There was a race between event_base_loop and evwatch_new (adding a
prepare/check watcher while iterating over the watcher list). Only
release the mutex immediately before invoking each watcher callback,
and reacquire it immediately afterwards (same as is done for normal
event handlers).
2019-04-17 15:52:05 -04:00
Azat Khuzhin
04563d59d2
Ignore build files for autotools build in subfolder too 2019-04-13 13:23:28 +03:00
Azat Khuzhin
c80f6be1e4
Merge branch '21_http_extended_method'
* 21_http_extended_method:
  Added http method extending
  http: Update allowed_methods field from 16 to 32bits.

Fixes: #327
2019-04-11 22:52:10 +03:00
Thomas Bernard
8dcb94a4ca
Added http method extending
User can define his own response method by calling
evhttp_set_ext_method_cmp() on the struct http, or
evhttp_connection_set_ext_method_cmp() on the connection.

We expose a new stucture `evhttp_ext_method` which is passed to the
callback if it's set. So any field can be modified, with some exceptions
(in evhttp_method_):

If the cmp function is set, it has the ability to modify method, and
flags. Other fields will be ignored. Flags returned are OR'd with the
current flags.

Based on changes to the #282 from: Mark Ellzey <socket@gmail.com>
2019-04-11 22:48:01 +03:00
Thomas Bernard
96e56beb94
http: Update allowed_methods field from 16 to 32bits. 2019-04-11 22:47:55 +03:00
Azat Khuzhin
799053db8a
http: replace EVHTTP_REQ_UNKNOWN_ with 0
From the server perspective the evhttp_response_phrase_internal() should
not be called with 0 before this patch, it will be called with
EVHTTP_REQ_UNKNOWN_ hence this patch should not change behavior.

Fixes: 68eb526d7b ("http: add WebDAV methods support")
Fixes: #789
Fixes: #796
Reported-by: Thomas Bernard <miniupnp@free.fr>
2019-04-10 00:51:27 +03:00
Azat Khuzhin
55f9863b18
Remove experimental note for finalizers API 2019-04-07 04:57:32 +03:00
Azat Khuzhin
428f36e5dd
https-client: do not try to free not initialized base
Otherwise:
  $ https-client --help
  Syntax:
     https-client -url <https-url> [-data data-file.bin] [-ignore-cert] [-retries num] [-timeout sec] [-crt crt]
  Example:
     https-client -url https://ip.appspot.com/
  [warn] event_base_free_: no base to free
2019-04-03 23:24:17 +03:00
Azat Khuzhin
35caeff5de
http: drop unused internal macros 2019-04-03 23:21:24 +03:00
Dan Rosen
2f184f8bbf evwatch: Add "prepare" and "check" watchers.
Adds two new callbacks: "prepare" watchers, which fire immediately
before we poll for I/O, and "check" watchers, which fire immediately
after we finish polling and before we process events. This allows other
event loops to be embedded into libevent's, and enables certain
performance monitoring.

Closes: #710
2019-04-03 12:44:50 -04:00
Azat Khuzhin
47d348a631
Disable logging for tests that assume printing warnings
To avoid possible confusion

But there is still one test that has some messages on windows:
  main/methods

Because this test needs >1 of avaiable methods, otherwise it will warn.
2019-04-03 08:00:12 +03:00