3958 Commits

Author SHA1 Message Date
Azat Khuzhin
66a4eb0c3a Check for WNOWAIT in waitpid() in runtime (not in cmake/configure)
Because checking in cmake breaks cross-compiling.

Introduced-in: 43eb56c7c738e3642f0981e3dd6ab9e082eec798.
Fixes: #482
Fixes: #462
Refs: #475

v2: use waitid() with WNOWAIT
v3: use WNOWAIT only if it available in waitpid(), because not all netbsd
    supports it
2017-03-08 13:31:55 +03:00
Azat Khuzhin
b2b4b4d74e cmake: add <pthread.h> into CMAKE_REQUIRED_INCLUDES for sizeof(pthread_t)
Fixes: #475
2017-03-08 13:31:55 +03:00
Azat Khuzhin
7f945b2d1b cmake: fix values for #cmakedefine 2017-03-08 13:31:53 +03:00
Azat Khuzhin
852726028f cmake: drop duplicates from event-config template 2017-03-08 12:47:32 +03:00
Azat Khuzhin
336ab816c8 cmake: add value for the #cmakedefine macros (like autoconf)
Before this patch for cmake we had:
  #define EVENT__HAVE_ACCEPT4
  /* #undef EVENT__HAVE_ARC4RANDOM */

While autotools has:
 #define EVENT__HAVE_ACCEPT4 1
 /* #undef EVENT__HAVE_ARC4RANDOM */
2017-03-08 12:47:31 +03:00
Azat Khuzhin
fa135bdcd9 cmake: Fix checking of enum values from sysctl.h
CheckSymbolExists do not do this, so add new CheckConstExists that will
use CheckCSourceCompiles() to check this.

v2: use set() instead of string(APPEND)
2017-03-08 12:47:22 +03:00
Azat Khuzhin
c199df7bc7 travis-ci: remove -DEVENT__ENABLE_VERBOSE_DEBUG=ON (too much useless logs)
I guess we can revert part of 59649f7 commit, we tried, but it adds more problems than solves.

Refs: https://github.com/libevent/libevent/pull/476#issuecomment-284259602
2017-03-06 02:56:27 +03:00
Azat Khuzhin
98faf19895 Merge branch 'fix-openssl-linking'
* fix-openssl-linking:
  sample/https-client: use ERR_remove_*state() when we have them
  Do not check for ERR_remove_thread_state() (do not link ssl into every library)

Closes: #476
2017-03-06 02:46:38 +03:00
Pierce Lopez
05318f1314 sample/https-client: use ERR_remove_*state() when we have them
ERR_remove_thread_state:
- openssl 0.9.8         does not have
- openssl 1.0/libressl  has
- openssl 1.1           deprecates
2017-03-06 02:44:58 +03:00
Pierce Lopez
5d18d87916 Do not check for ERR_remove_thread_state() (do not link ssl into every library)
This reverts commit c4e9d9bd662de7f575f2172c160795d452ebe709
("sample/https-client: check for ERR_remove_thread_state() existence").

Calling AC_SEARCH_LIBS() modifies LIBS - -lcrypto incorrectly
ends up in LIBS, and thus linked to by libevent_core.so.

Checking for ERR_remove_thread_state should no longer be needed
because it was introduced in openssl 1.0.0, and the previous line
0.9.8 had support discontinued at the end of 2015.

Fixes: #473
2017-03-06 01:39:29 +03:00
tim-le
8df81546f3 evutil: fix a typo of comment
Fixes: #481
Fixes: #480
2017-03-05 18:14:02 +03:00
Trond Norbye
cc0e04d798 Fix RPATH for APPLE
By setting the CMake minimum version to 3.1 CMake automatically
adds the correct magic to make the library relocatable on
the filesystem (instead of burning the location of the library
at link time into the binary).

ex:
otool -L bin/http-connect
bin/http-connect:
	@rpath/libevent_extra.2.2.0.dylib (compatibility version 2.2.0, current version 0.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

Fixes: #468 (cherry-picked)
2017-02-28 11:02:39 +03:00
David Disseldorp
55cadb2b03 sample/dns-example: fix compiler warning (getopt() returns an int)
Signed-off-by: David Disseldorp <ddiss@suse.de>
Closes: #449
2017-02-28 00:39:50 +03:00
David Disseldorp
e139cbac0a sample/https-client: use host SSL certificate store by default
Currently a static (Debian) certificate path is used by default, which
can be overridden using the -crt parameter. This commit changes the
default behaviour such that the openssl default certificate store is
used, unless overridden by -crt.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-02-28 00:39:50 +03:00
Azat Khuzhin
ffbce578c4 Fix clang 3 (some versions) misbehaviour for __has_attribute()
Refs: #447
Clang: https://reviews.llvm.org/rL223468 ("Modify __has_attribute so
that it only looks for GNU-style attributes")
2017-01-30 11:50:02 +03:00
Jan Beich
d057c45e8f Unbreak build with LibreSSL after openssl 1.1 support added
Fixes: 3e9e0a0d46e4 ("Make it build using OpenSSL 1.1.0")
Fixes: #445
2017-01-30 00:25:26 +03:00
Azat Khuzhin
9d5a4bdc5c Merge branch 'fix-struct-linger'
@jbech
  "Accidentally disabled by 0dda56a due to confusion between struct
  linger vs. SO_LINGER and #define vs. AC_DEFINE. Try adding synthetic
  #error test to confirm."

* fix-struct-linger:
  cmake: check for 'struct linger' existence
  test/bench*: prefix event-config.h macros after 0dda56a48e94
  test/bench_httpclient: restore SO_LINGER usage after 0dda56a48e94

Fixes: #444 (original pull-request)
2017-01-29 23:07:40 +03:00
Azat Khuzhin
b24a78cccf cmake: check for 'struct linger' existence 2017-01-29 23:06:34 +03:00
Jan Beich
77ec05e50d test/bench*: prefix event-config.h macros after 0dda56a48e94 2017-01-29 23:02:41 +03:00
Jan Beich
d9118c8daa test/bench_httpclient: restore SO_LINGER usage after 0dda56a48e94 2017-01-29 23:02:41 +03:00
Azat Khuzhin
7bc822cad9 Include openssl-compat.h into dist archive
Refs: nmathewson/Libevent@140
Refs: http://archives.seul.org/libevent/users/Jan-2017/msg00001.html
2017-01-29 22:13:46 +03:00
Azat Khuzhin
fe2c2622c3 Make EVENT_STAGE_NAME non cached
It did not work before correctly anyway, since cmake do not reset cache
entries by default, so that reset to "beta" didn't work.

But I don't think that making this variable cached is useful, so let's
remove this.
2017-01-29 20:35:57 +03:00
Azat Khuzhin
0344edf62d Do not overwrite version from GIT if it is older then defaults 2017-01-29 20:35:57 +03:00
Azat Khuzhin
efcfa046ae Bump version in master to 2.2.0-alpha-dev
And according to f8d80a285cf941505277d9060d0357b5b7e543d2 ("Bump version
to 2.1.3-alpha-dev") numeric version have 1 at the end, since it means
"-dev".
2017-01-29 20:33:55 +03:00
Azat Khuzhin
94e7dcebc3 Fix -Werror=implicit-fallthrough (fixes gcc-7)
Fixes: #447
2017-01-29 17:58:31 +03:00
Azat Khuzhin
e7ff4ef2b4 Merge branch 'release-2.1.8-stable-pull'
* release-2.1.8-stable-pull:
  Bump version to 2.1.8-stable everywhere
  VERSION_INFO should me equal to library version
  Bump whatsnew-2.1 document
  Update ChangeLog for 2.1.8-stable
  README: update AUTHORS
release-2.1.8-stable
2017-01-26 02:37:15 +03:00
Azat Khuzhin
9b63b5d410 Bump version to 2.1.8-stable everywhere
P.S. in referenced commit I made a mistake and instead of *-rc* I wrote
*-beta*.

See-also: f4489b8323cda0bf8eed7c1353911a852d7a947c ("Bump version to
2.1.7-beta everywhere")
2017-01-26 02:36:00 +03:00
Azat Khuzhin
bed52ff6ff VERSION_INFO should me equal to library version
This reverts commit 43243b9d55efcd0e6e2767a5c45bc7da46cff60c (I
shouldn't do this).
2017-01-26 02:36:00 +03:00
Azat Khuzhin
227bfe5626 Bump whatsnew-2.1 document 2017-01-26 02:36:00 +03:00
Azat Khuzhin
d9eb42e082 Update ChangeLog for 2.1.8-stable
$ git log --format='    o %s (%h %cN)' HEAD...refs/tags/release-2.1.7-rc
2017-01-26 02:36:00 +03:00
Azat Khuzhin
50824ae2a0 README: update AUTHORS
$ git log --format='%an' HEAD...refs/tags/release-2.1.6-beta | sort -u | xargs -n1 -i bash -c 'fgrep -q "{}" README.md || echo {}'
2017-01-22 16:14:30 +03:00
Azat Khuzhin
59e217dfe1 Merge branch 'automake-tests-parallel-v4' (*includes ci bits also*)
This patch set runs tests in parallel (on travis/appveyor/vagrant), it
includes cmake/autotools(automake).

It should significantly decrease time that tests tooks on travis-ci (3-4
times lower, right now it is about 14-17 hours - too long!), but not
without downsides, now because travis-ci workers has limited resources
we will have more timing-related failures, but this is another storry,
anyway ~16 hours is not acceptable. Anyway if machine has enough
resources it is great to have ability to run tests in parallel (which
automake couldn't do before).

Changes for common test env:
- autotools: before 17m / after 3m
- cmake:     before 15m / after 87 sec

* automake-tests-parallel-v4:
  Run tests in parallel (they are lightweight), on CI and vagrant boxes
  travis-ci: install cmake from xenial (CTEST_PARALLEL_LEVEL support)
  test: register different tests in automake
  test: run different tests under different options (in a wrapper)
  automake: do not use serial-tests if parallel-test-harness available

Fixes: #439
2017-01-22 04:12:04 +03:00
Azat Khuzhin
9c9be3994d vagrant/netbsd: missing libtool 2017-01-22 03:58:15 +03:00
Azat Khuzhin
108b5fef41 Run tests in parallel (they are lightweight), on CI and vagrant boxes
By default 20 parllel jobs, but one caveat for travis-ci, osx boxes
there slower and have less resources then linux (discovered during
testing), so limit number of parallel jobs to 4 there, and also install
travis_wait, so that travis-ci will not fail the build when there is no
output for 10 minutes, since for osx boxes it is very likely.

Refs: travis-ci/travis-ci@7202
2017-01-22 03:22:27 +03:00
Azat Khuzhin
2a67f4fc12 travis-ci: install cmake from xenial (CTEST_PARALLEL_LEVEL support)
cmake supports it since 3.0 I guess.

And it must be trusty (not precise), otherwise it fails:
  dpkg: error processing
  /var/cache/apt/archives/ifupdown_0.8.10ubuntu1_amd64.deb (--unpack):
   trying to overwrite '/etc/init.d/networking', which is also in package netbase 4.47ubuntu1

Link: https://travis-ci.org/azat/libevent/jobs/193744023
2017-01-22 03:22:27 +03:00
Azat Khuzhin
ea1d30cac4 test: register different tests in automake
Before this patch we have one test.sh (well test-script.sh), and tooks
very long to run it sequentially, but they are pretty lightweight, so we
should run then in parallel.
2017-01-22 03:22:07 +03:00
Azat Khuzhin
54d7473f91 test: run different tests under different options (in a wrapper) 2017-01-22 03:21:43 +03:00
Azat Khuzhin
a7513cc968 automake: do not use serial-tests if parallel-test-harness available
Revert: 61179dec7716975a151c6dae4524ae504d05780e ("automake: define
serial-tests only if automake have this option") Revert:
Revert: 44d755e00e249c09914cf35089c16735df82e270 ("test/automake: don't
use paralell test harness (since automake 1.12)")
2017-01-22 02:58:02 +03:00
Azat Khuzhin
43243b9d55 Bump VERSION_INFO so that libraries symlinks will have the same version
Fixes: f4489b8323cda0bf8eed7c1353911a852d7a947c ("Bump version to 2.1.7-beta
everywhere")
2017-01-20 21:24:54 +03:00
Azat Khuzhin
d6bafbbeb2 test/dns: replace servname since solaris does not have "http"
Yes, by default solaris (solaris10.dev 5.10 Generic_147148-26 i86pc i386 i86pc)
does not have "http" in /etc/services
2017-01-20 02:16:50 +03:00
Azat Khuzhin
83e0f43b03 Merge branch 'openssl-filter-fixes-v4'
* openssl-filter-fixes-v4:
  be: fix with filtered bufferevents and connect() without EAGAIN
  test/ssl: fix bufferevent_getfd() for bufferevent_openssl_filter_new()
  be_openssl: Fix writing into filted openssl bufferevent after connected
  test/https: separate cases for https client with filtered openssl bufferevent
  test/ssl: cover case when we writing to be_openssl after connecting

Fixes: #428
2017-01-19 20:53:18 +03:00
Azat Khuzhin
9a0a3a3e65 be: fix with filtered bufferevents and connect() without EAGAIN
With filtered bufferevents (i.e. not real one, that have socket), we can
trigger incorrect callback in this case. Let's look at example with http
and bufferevent_openssl_filter_new():
- bev = bufferevent_openssl_filter_new()
- http layer trying to connect() to localhost with bev
  # at this time, bev have writecb/readcb NULL but ev_write/ev_read has
  # timeout with 45 secs, default HTTP connect timeout
- and when connect() retruns without EAGAIN (BSD'ism) we called
  event_active() before (with EV_WRITE), and this will call ev_write
  timeout only, while it is more correct to act on bufferevent instead
  of plain event, so let's trigger EV_WRITE for bufferevent which will
  do the job (and let's do this deferred).

Fixes: http/https_simple # under solaris
2017-01-19 20:53:05 +03:00
Azat Khuzhin
09b6201304 test/ssl: fix bufferevent_getfd() for bufferevent_openssl_filter_new() 2017-01-19 20:53:05 +03:00
Azat Khuzhin
8939676706 be_openssl: Fix writing into filted openssl bufferevent after connected
The main problems was due to when bufferevent_openssl has underlying (i.e.
created with bufferevent_openssl_filter_new()) some events was
disabled/suspended, while with openssl, READ can require WRITE and vice-versa
hence this issues.

The BEV_CTRL_GET_FD hunk to fix http subsystem, since it depends from what
bufferevent_getfd() returns.

Fixes: #428
Fixes: ssl/bufferevent_filter_write_after_connect
Fixes: http/https_filter_chunk_out
Fixes: da52933550fd4736aa1c213b6de497e2ffc31e34 ("be_openssl: don't call
do_write() directly from outbuf_cb")
2017-01-19 20:53:05 +03:00
Azat Khuzhin
d77fcea15f test/https: separate cases for https client with filtered openssl bufferevent
- http/https_filter_chunk_out # now hang
- http/https_filter_basic     # works, since writes only before connect()
2017-01-19 20:53:05 +03:00
Azat Khuzhin
d047c2412e test/ssl: cover case when we writing to be_openssl after connecting
Right now it fails because of regression for filtered openssl
bufferevent, and by it I mean ssl/bufferevent_filter_write_after_connect
test, and by fails - hang.

Regression-for: da52933550fd4736aa1c213b6de497e2ffc31e34 ("be_openssl:
don't call do_write() directly from outbuf_cb")
2017-01-19 20:53:05 +03:00
Azat Khuzhin
3c7422fc52 test/thread: netbsd is too slow, increase timeout for conditions_simple 2017-01-19 20:51:38 +03:00
Azat Khuzhin
0786253115 test/dns: run async resolving after sync one (to avoid timeouts)
If system resolver (sync one) will respond too slow, then we can fail async
request and evdns will retransmit tham again, but evdns server will accept that
failed requets, so we will have not 2 requests but 4.

Reproduced on centos box sometimes.
2017-01-19 20:50:22 +03:00
Azat Khuzhin
36da6877f0 vagrant/netbsd: more reliable way of installing packages
Link: http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/doc/pkgsrc.html#installing-binary-packages
2017-01-19 20:46:07 +03:00
Azat Khuzhin
26f416c1a5 test/http: turn off some tests that based on backlog filling (falky)
Since this technique does not work well everywhere, anyway it fails from time
to time.

See: https://travis-ci.org/libevent/libevent/jobs/186426446
2017-01-08 05:22:02 +03:00