3958 Commits

Author SHA1 Message Date
Kurt Roeckx
3e9e0a0d46 Make it build using OpenSSL 1.1.0
Rebased (azat):
- tabs instead of whitespaces
- make openssl-compat.h safe for complex expressions
- do not call sk_SSL_COMP_free() in 1.1 (fixes double free)

TODO:
- clean methods_bufferevent

Closes: #397 (cherry-picked)
2016-10-16 19:05:24 +03:00
Adam Langley
6702da1a8c Don't call BIO_number_{read|written} on NULL BIOs.
OpenSSL doesn't document the behaviour of these functions when given a
NULL BIO, and it happens to return zero at the moment. But don't depend
on that.

Closes: #406 (cherry-picked)
2016-10-16 02:09:43 +03:00
Adam Langley
f9803a6943 Switch from a 512 to 2048-bit RSA key.
The 512 bit key is too small to sign larger hashes. This can cause the
regression tests to fail depending on the defaults in libssl.
2016-10-13 16:12:07 -07:00
Azat Khuzhin
b9c5077e99 Merge branch 'contrib-guide-v2'
Something that should help with reviewing patches.

* contrib-guide-v2:
  Add CONTRIBUTING.md (with checkpatch.sh examples)
  Add checkpatch script
  Add config for clang-format
  Add config for uncrustify

Refs: #301
2016-10-05 15:52:41 +03:00
Azat Khuzhin
a22d203386 Add CONTRIBUTING.md (with checkpatch.sh examples) 2016-10-05 15:51:40 +03:00
Azat Khuzhin
d482486a15 Add checkpatch script
Support:
- files
- files-diffs
- patches
- git-refs
2016-10-05 15:51:40 +03:00
Azat Khuzhin
f523cb7967 Add config for clang-format 2016-10-05 15:47:46 +03:00
Azat Khuzhin
807e2662f8 Add config for uncrustify
Original: https://strcpy.net/mark/libevent-uncrustify.cfg (@ellzey)
2016-10-05 15:47:46 +03:00
Seven
752166436c be: just a simple mistake, reinclude the <errno.h>
include the <errno.h> twice.
2016-10-05 00:03:12 +03:00
Azat Khuzhin
a4d044c0cd cmake: use PYTHON_EXECUTABLE to find python2
Since most of the distros have symlinks for this.
2016-10-04 23:22:34 +03:00
Azat Khuzhin
83c7cdf426 Merge branch 'force-disable-clockgettime'
* force-disable-clockgettime:
  Add -DEVENT__DISABLE_CLOCK_GETTIME switch for cmake
  Adding option to ignore clock_gettime: --disable-clock-gettime
2016-10-03 03:24:28 +03:00
Azat Khuzhin
91559607fd Add -DEVENT__DISABLE_CLOCK_GETTIME switch for cmake
See-also: adc402ba5f0e15f4c77505852507f33b50f37ab6 ("Adding option to
ignore clock_gettime: --disable-clock-gettime")
2016-10-03 03:20:07 +03:00
Vlad Shcherban
adc402ba5f Adding option to ignore clock_gettime: --disable-clock-gettime
macOS 10.12 introduced `clock_gettime` to libsystem. This means, built
on OS X 10.12 application would crash on earlier versions of OS X
because it will try to call clock_gettime. This options is useful to
make backwards compatible macOS apps.

Fixes: #398
Fixes: #399
Fixes: #400
2016-10-03 03:16:20 +03:00
Azat Khuzhin
a73fb2f443
Merge branch 'release-2.1.6-beta-pull'
* release-2.1.6-beta-pull:
  Bump version to 2.1.6-beta everywhere
  ChangeLog: Add brief notes
  Update changelog for 2.1.6-beta (ugh, pretty huge)
  Update AUTHORS section in README
release-2.1.6-beta
2016-08-27 01:53:49 +03:00
Azat Khuzhin
51019e9460 Bump version to 2.1.6-beta everywhere
- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor
2016-08-27 01:28:36 +03:00
Azat Khuzhin
81d219321e ChangeLog: Add brief notes 2016-08-27 01:28:36 +03:00
Azat Khuzhin
ea2cee72c8 Update changelog for 2.1.6-beta (ugh, pretty huge)
Changes for:
- 2.1.5-beta: 118
- 2.1.6-beta: 350

We should really hurry with the release!
2016-08-27 01:28:36 +03:00
Azat Khuzhin
3298c254b7 Update AUTHORS section in README
P.S. "Sebastian Hahn" was declared two times.
2016-08-27 01:28:36 +03:00
Zonr Chang
c6b1ec1220 Fix evhttp_uriencode() regression.
http_uriencode_test() (in test/regress_http.c) has been failed after
72afe4c as "hello\0world" is encoded to "hello" instead of
"hello%00world". This is because of a misplaced overflow check which
causes the non-negative "size" specified in parameter being ignored in
within-bound URI.

Fixes: #392
2016-08-27 01:24:11 +03:00
Mark Ellzey
e94250c8e3
removed unused vars 2016-08-14 14:03:56 -07:00
Mark Ellzey
72afe4c93b
pointer overflow checks for evhttp_uriencode
Check to make sure pointer math is all OK.
2016-08-14 14:02:37 -07:00
Azat Khuzhin
43eb56c7c7 tests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris
According to solaris docs:
  "One instance of a SIGCHLD signal is queued for each child process whose
  status has changed. If waitpid() returns because the status of a child
  process is available, and WNOWAIT was not specified in options, any pending
  SIGCHLD signal associated with the process ID of that child process is
  discarded. Any other pending SIGCHLD signals remain pending."

And interesting thing that it works if you add sleep(1) before waitpid(), and
also if you run with --verbose (some race or what).

But linux doesn't support WNOWAIT in waitpid() so add detection into
cmake/autotools.

Fixes: #387
Link: https://bugzilla.redhat.com/show_bug.cgi?id=840782
2016-08-11 17:08:35 +03:00
Azat Khuzhin
16d220cb6f test: replace sleeping with syncing pair in main/fork
About this syncing pair:
- read endpoint, must be blocked, to make it a checkpoint or smth like this
- write endpoint, must be nonblocking, to avoid readcb hung

Refs: #387
2016-08-11 16:18:12 +03:00
Azat Khuzhin
685a6a1917 travis: split long lines, and make it cleaner 2016-08-11 09:28:14 +03:00
Azat Khuzhin
088ea5e0b7 travis: fix autotools on osx by reinstalling libtool
Link: mkrufky/libdvbtee#22
2016-08-11 00:18:04 +03:00
Azat Khuzhin
3189eb000b be_sock: handle readv() returns ECONNREFUSED (freebsd 9.2)
During testing sometimes bufferevent/bufferevent_connect_fail_eventcb fails,
and after some digging I found that this was the case when connect() doesn't
return ECONNREFUSED immediately, and instead next operation will return it (in
our case evbuffer_read()->readv(), needless to say that after this
bufferevent_writecb() called and it checks error with getsockopt() but of
course it doesn't return any error), so this patch checks "errno" after
"readv()" and installs "bufev::connection_refused" flag, to handle this from
writecb and only once.

Fixes: bufferevent/bufferevent_connect_fail_eventcb
Fixes: bufferevent/bufferevent_connect_fail_eventcb_defer
Refs: #388
2016-08-11 00:11:05 +03:00
Azat Khuzhin
500b6b7577 test/http: do not run tests that based on backlog filling (freebsd)
I cannot find any other solution for now, so simply ignore them for now, we
should think about normal fix for this.

Refs: #388
2016-08-11 00:11:05 +03:00
Azat Khuzhin
5a157c871c evutil: mark ai_find_protocol() static (prototype-less) 2016-08-10 16:09:45 +03:00
Azat Khuzhin
4410e9dfb3 test/bufferevent/iocp: fix test name for "bufferevent_connect_fail_eventcb" 2016-08-10 12:07:58 +03:00
Azat Khuzhin
40730ae333 Fix getaddrinfo under solaris (for multiprotocol case)
During testing on solaris 11.3, util/getaddrinfo failed at:
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags = EVUTIL_AI_NUMERICHOST;
  r = evutil_getaddrinfo("1.2.3.4", NULL, &hints, &ai);
  tt_assert(ai_find_by_protocol(ai, IPPROTO_TCP));

And this is because solaris's getaddrinfo() returns:
$6 = {
  ai_flags = 32,
  ai_family = 2,
  ai_socktype = 0,
  ai_protocol = 0, <-- no proto
  ai_addrlen = 16,
  ai_canonname = 0x0,
  ai_addr = 0x815d658,
  ai_next = 0x0 <-- nothing else
}

So we should emulate this too.

Plus introduce helper that will search through all results, not only first one.

Fixes: util/getaddrinfo
Fixes: #354
2016-08-10 11:15:15 +03:00
Azat Khuzhin
dc95823cd7 cmake/solaris: set CMAKE_REQUIRED_LIBRARIES to fix functions detections
Otherwise we will not detect next functions for instance:
- gethostbyname_r # and related

And now both autotools/cmake builds passes all regress tests in basic env (on
solaris of course).

Fixes: dns/client_fail_requests_getaddrinfo
2016-08-10 00:34:44 +03:00
Azat Khuzhin
050bfc7fc6 cmake/solaris: fix building (link with socket,nsl) 2016-08-10 00:17:01 +03:00
Azat Khuzhin
00514a2a1e Merge branch 'appveyor-cmake-v6'
This patch set introduces matrix for appveyor and fixes bugs related to win32,
during debugging this matrix. This should greatly reduce number of work for
making a release ('check under windows' part only).

Right now tests on appveyor still failes in summary, but we should dig into
problems, not hide them.

Test matrix looks like this:
- autotools
- autotools --disable-openssl
- autotools --disable-thread-support
- autotools --disable-debug-mode
- autotools --disable-malloc-replacement
- cmake
- cmake -DEVENT__DISABLE_OPENSSL=ON
- cmake -DEVENT__DISABLE_THREAD_SUPPORT=ON
- cmake -DEVENT__DISABLE_DEBUG_MODE=ON
- cmake -DEVENT__DISABLE_MM_REPLACEMENT=ON
- cmake -DEVENT__ENABLE_VERBOSE_DEBUG=ON
- cmake -DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'
And takes 90min (was 7min, and this is the sad part).

* appveyor-cmake-v6:
  test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32
  test/https_basic: increase timeout for complete write (fixes win32)
  cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers
  autotools/win32: fix searching ssl library
  appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS
  appveyor: image already had openssl installed
  cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON
  cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON
  appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only)
  cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)
  test: fix building with --disable-thread-support under win32
  cmake: do not use stderr for notifications/version-info
  autoconf: fix --disable-thread-support build under win32
  appveyor: ignore failure of mingw-get
  appveyor: drop shallow_clone, since we use tags for detecting version in cmake
  appveyor: support cmake & autotools using build matrix (like travis-ci has)

Fixes: #364
2016-08-09 15:53:05 +03:00
Azat Khuzhin
a9e8cd6738 test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.107/job/k70our1xdp0ym4dm#L1906
Fixes: ssl/bufferevent_connect_sleep
2016-08-09 15:47:58 +03:00
Azat Khuzhin
d5a2f2f97f test/https_basic: increase timeout for complete write (fixes win32)
Otherwise on win32 we got 2, but test is ok, some timings issue.

Introduced-in: c968eb3
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.107/job/k70our1xdp0ym4dm#L1906
2016-08-09 15:47:58 +03:00
Azat Khuzhin
c4dfb93ff2 cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers 2016-08-09 15:47:58 +03:00
Azat Khuzhin
671a24f29b autotools/win32: fix searching ssl library 2016-08-09 15:47:58 +03:00
Azat Khuzhin
6fcfa25d82 appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS
This never works, hence green tests in production. and now it works:
https://ci.appveyor.com/project/azat/libevent/build/2.1.5.100/job/eib4xqfb7d3ruo16
(look by /"evthread_win32.c")
2016-08-09 15:47:58 +03:00
Azat Khuzhin
4634b85bf2 appveyor: image already had openssl installed
Fixes messages like "Version mismatch for openssl: compiled with 1000201f but
running with 1000208f" [1].

According to next link:
  http://help.appveyor.com/discussions/questions/1132-openssl-installation-issues
Refs: appveyor/ci#576
[1]: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.95/job/dcy9cfoj3rfo4gdh
2016-08-09 15:47:58 +03:00
Azat Khuzhin
de0c1965ca cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON 2016-08-09 15:47:58 +03:00
Azat Khuzhin
ecb0ec821a cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON
There is duplicated "evthread_win32.c" appending to ${SRC_CORE} list, leave
only one that under if EVENT__DISABLE_THREAD_SUPPORT

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.96/job/44q3rgifasny7gek
2016-08-09 15:47:58 +03:00
Azat Khuzhin
e9acc441b7 appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only)
Link: https://github.com/libevent/libevent/wiki/ReleaseChecklist
2016-08-09 15:47:58 +03:00
Azat Khuzhin
e35f22416a cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)
Fixes: 8b228e27f57300be61b57a41a2ec8666b726dc34 ("Lot's of cmake updates")
2016-08-09 15:47:58 +03:00
Azat Khuzhin
a487706e10 test: fix building with --disable-thread-support under win32 2016-08-09 15:47:58 +03:00
Azat Khuzhin
38716c653d cmake: do not use stderr for notifications/version-info
For all except "STATUS" message() will write to stderr, and this also includes
case when you does not have <mode> at all. Plus for every message in stderr
powershell generates exception and make appveyor fails.

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.85/job/i10k7m0t80330mtr
2016-08-09 15:47:58 +03:00
Azat Khuzhin
bb09535bda autoconf: fix --disable-thread-support build under win32
Fixes: https://ci.appveyor.com/project/azat/libevent/build/job/gvud4tcqsd5bnarl
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/5frnb1c3n4quxxqy
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/3wdahbrew7setmoa
2016-08-09 15:47:58 +03:00
Azat Khuzhin
1810857425 appveyor: ignore failure of mingw-get
Since according to doc [1], appveyour will fail the build on every powershell's
exception:
  "PowerShell script is considered successful if it finishes without exception."

[1]: https://www.appveyor.com/docs/build-configuration#powershell
2016-08-09 15:47:58 +03:00
Azat Khuzhin
ac90133c16 appveyor: drop shallow_clone, since we use tags for detecting version in cmake 2016-08-09 15:47:58 +03:00
Azat Khuzhin
8f95015543 appveyor: support cmake & autotools using build matrix (like travis-ci has)
This will allow us to avoid possible compilation regressions, and also some
failures in different environments (for example because of different
sizeof(size_t)).

For example we can avoid next issues:
- #361
- #314
- #311
(And I'm pretty sure that this is not complete list)

And of course it reduce job for maintainers.
But it also have one downside, appveyor doesn't have such concurrency like
travis-ci, so it can take a while to finish the whole build, but we can resolve
this later, or reduce build matrix to only one for autotools and one for cmake.

Fixes: #364
2016-08-09 15:47:57 +03:00
Azat Khuzhin
8a2c6c7759 Ignore make dist generated files 2016-08-09 15:47:47 +03:00