4443 Commits

Author SHA1 Message Date
Azat Khuzhin
391003e9b7 test: use THREAD_* wrappers over pthread* in del_notify 2020-01-14 00:42:13 +03:00
Azat Khuzhin
a6f81aa454 Merge branch 'osx-clock'
Moves the thread into real-time scheduling class, as recommended in [1], it
fixes the separate test provided by @ygj6 [2] everywhere (github actions,
travis-ci, appveyor) under osx.

  [1]: https://developer.apple.com/library/archive/technotes/tn2169/_index.html
  [2]: dde1a6e4d0

Although even after this changes the following time-related tests failed
on travis-ci:
- no_events
- del_wait

But anyway I guess #940 can be closed, since this fixes the issue in common.

* osx-clock:
  test: Use THREAD_* wrappers in del_notify/del_wait
  test: move threads created with THREAD_START() to realtime scheduling class too
  test: put thread into real time scheduling class on osx for better latencies

Closes: #940
2020-01-13 23:36:40 +03:00
Azat Khuzhin
4b72024b7f test: Use THREAD_* wrappers in del_notify/del_wait 2020-01-13 23:36:19 +03:00
Azat Khuzhin
e6285eed62 test: move threads created with THREAD_START() to realtime scheduling class too 2020-01-13 23:36:19 +03:00
Azat Khuzhin
b1e46c32db test: put thread into real time scheduling class on osx for better latencies 2020-01-13 23:36:19 +03:00
Azat Khuzhin
603d7937d2 Merge branch 'ci-improvements'
* ci-improvements:
  travis-ci: measure build/tests time
  travis-ci: drop travis_wait (does not work with sub processes)
  cmake: do not print used method (EVENT_SHOW_METHOD) while running tests
  cmake: run regress test quietly like autotools (makes CI logs cleaner)
2020-01-13 22:27:32 +03:00
Azat Khuzhin
b30717eb23 travis-ci: measure build/tests time 2020-01-13 22:26:37 +03:00
Azat Khuzhin
fbe6f7d92a travis-ci: drop travis_wait (does not work with sub processes)
Refs: https://github.com/travis-ci/travis-ci/issues/8526
2020-01-13 22:26:37 +03:00
Azat Khuzhin
f8a6f12712 cmake: do not print used method (EVENT_SHOW_METHOD) while running tests
autotools don't, plus this will make CI logs cleaner
2020-01-13 22:26:37 +03:00
Azat Khuzhin
fa33819e3b cmake: run regress test quietly like autotools (makes CI logs cleaner) 2020-01-13 22:26:37 +03:00
nntrab
02905413fd Add callback support for error pages
The existing error pages are very basic and don't allow for
multi-lingual support or for conformity with other pages in a web site.
The aim of the callback functionality is to allow custom error pages to
be supported for calls to evhttp_send_error() by both calling
applications and Libevent itself.

A backward-incompatible change has been made to the title of error pages
sent by evhttp_send_error(). The original version of the function used
the reason argument as part of the title. That might have unforeseen
side-effects if it contains HTML tags. Therefore the title has been
changed to always use the standard status text.

An example of the error callback can be found in this
[version](https://github.com/libevent/libevent/files/123607/http-server.zip)
of the 'http-server' sample. It will output error pages with very bright
backgrounds, the error code using a very large font size and the reason.

Closes: #323 (cherr-picked from PR)
2020-01-13 00:50:14 +03:00
Azat Khuzhin
462f2e9766 Merge branch 'http-connect'
After this patchset http-connect works with pproxy [1]:

    $ pproxy -l http://:8000/ -vvv &
    $ http-connect //127.1:8000 http://kernel.org:80/

  [1]: https://pypi.org/project/pproxy/

* http-connect:
  http-connect: do not check connection on GET cb
  http-connect: set Host header (for CONNECT and GET) (like curl)
  http-connect: cleanup and helpers
  http: do not close connection for CONNECT
  http: do not assume body for CONNECT

Fixes: #946
2020-01-12 15:35:10 +03:00
Azat Khuzhin
9c91fe1479 http-connect: do not check connection on GET cb 2020-01-12 15:34:01 +03:00
Azat Khuzhin
415ddee337 http-connect: set Host header (for CONNECT and GET) (like curl) 2020-01-12 15:34:01 +03:00
Azat Khuzhin
e54d5fc57c http-connect: cleanup and helpers 2020-01-12 15:34:01 +03:00
Azat Khuzhin
12ad0c8fcd http: do not close connection for CONNECT 2020-01-12 15:34:01 +03:00
Azat Khuzhin
998e68340e http: do not assume body for CONNECT 2020-01-12 15:33:59 +03:00
Dimo Markov
f0e79bafd8 Added uninstall target check to cmakelists 2020-01-08 20:37:16 +02:00
Azat Khuzhin
08981f8d75 Fix compilation without OPENSSL_API_COMPAT
Use the following for openssl 1.1+:
- X509_getm_notBefore over X509_get_notBefore
- X509_getm_notAfter  over X509_get_notAfter
- use OPENSSL_VERSION_NUMBER over SSLeay()
- add missing headers

Refs: openssl/openssl@0b7347effe
2020-01-07 22:15:08 +03:00
yuangongji
6412f34f24 evutil_time: Implements usleep() using wait funtion on Windows 2019-12-31 00:37:29 +03:00
yangyongsheng
1edb6f6188 Initialize variable to 0 replace use memset function in sample/hello-world.c 2019-12-30 10:09:15 +08:00
Azat Khuzhin
ea12428db6 appveyor: switch to Previous Visual Studio 2019 (VS issues after update)
After update [1] of the Visual Studio 2019 image cmake unable to find
path to the c compiler [2]:

    cmake : CMake Error at CMakeLists.txt:47 (project):
    At line:1 char:1
    + cmake -G 'Visual Studio 16 2019' -A x64 ..
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (CMake Error at ...t:47 (project)::String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError

      The CMAKE_C_COMPILER:
        C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
      is not a full path to an existing compiler tool.

  [1]: https://github.com/appveyor/ci/issues/3231
       https://www.appveyor.com/updates/2019/12/09/
  [2]: https://ci.appveyor.com/project/libevent/libevent/builds/29431286/job/a68h7dn9rcride9g
2019-12-10 09:29:08 +03:00
Andre Pereira Azevedo Pinto
f76456b0dc Add support for priority inheritance
Add support for posix mutex priority inheritance. This is important to
avoid priority inversion in systems running with threads with different
priorities.

Signed-off-by: Andre Azevedo <andre.azevedo@gmail.com>
2019-12-09 14:55:31 -08:00
Azat Khuzhin
8f13c170cf cmake: set CMAKE_{RUNTIME,LIBRARY,ARCHIVE}_OUTPUT_DIRECTORY they are not defined
This will allow overriding them in parent cmake rules, i.e. if libevent
is used via add_subdirectory().

Closes: #931
2019-11-30 15:58:17 +03:00
Azat Khuzhin
b9f442e2d7 cmake: use CMAKE_LIBRARY_OUTPUT_DIRECTORY for the final shared library symlink
Fixes: 669a53f3 ("cmake: set library names to be the same as with autotools")
2019-11-30 15:54:56 +03:00
Azat Khuzhin
aff231229e appveyor: fix EVENT_CMAKE_OPTIONS expansion (for multiple arguments)
Fixes: 63f73ee2 ("CI: integrate testing for components export")
2019-11-17 23:31:14 +03:00
Azat Khuzhin
8a34869984 test-ratelim: calculate timers bias (for slow CPUs) to avoid false-positive
This can be/should be done for regression tests too.

Refs: https://ci.appveyor.com/project/libevent/libevent/builds/28916689/job/kg621aa194a0qbym
Refs: https://github.com/libevent/libevent/pull/917#issuecomment-553811834
v2: EVENT_BASE_FLAG_PRECISE_TIMER
2019-11-17 20:52:28 +03:00
Azat Khuzhin
026590f908 mailmap: add name/email aliases for yuangongji (name and email)
Before:
  $ git log --format='%aE %aN' --author=yuangongji | sort | uniq -c
       30 82787816@qq.com yuangongji
        1 82787816@qq.com yuangongji (A)

After:
  $ git log --format='%aE %aN' --author=yuangongji | sort | uniq -c
       34 yuangongji@foxmail.com yuangongji
2019-11-17 15:51:07 +03:00
Azat Khuzhin
8be8ac4602 Merge #929 -- cmake package improvements
Example:

  find_package(Libevent 2.2.0 REQUIRED COMPONENTS core)
  add_executable(test test.c)
  target_link_libraries(test ${LIBEVENT_LIBRARIES})

* upstream/pr/929:
  CI: integrate testing for components export
  cmake: test for find_package()
  cmake: improve package config file
2019-11-17 02:45:54 +03:00
yuangongji
02dc7a1b17 appveyor: fix openssl version mismatch warning
yuangongji:

  "Many warnings appear when building and running with Visual Studio 2019 in Appveyor:

   WARN C:\projects\libevent\test\regress_ssl.c:210: Version mismatch for openssl: compiled with 1000214f but running with 1000212f

   Simply add the openssl binary to the "PATH" environment variable to fix it.

   I wrote a simple demo to reproduce it: https://github.com/ygj6/verify
   I see there are dozens of openssl libraries in the system of appveyor: https://ci.appveyor.com/project/ygj6/verify/builds/28290688
   If you do not specify which openssl to use, the system cannot find the correct library."
2019-11-17 02:42:42 +03:00
Azat Khuzhin
28ba0a4797 appveyor: disable parallel tests execution
Refs: https://github.com/libevent/libevent/pull/917#issuecomment-553784701
2019-11-17 02:42:41 +03:00
yuangongji
63f73ee2ad CI: integrate testing for components export 2019-11-15 22:00:41 +08:00
yuangongji
cd15112b62 cmake: test for find_package() 2019-11-14 18:28:31 +08:00
yuangongji
dc4be869d5 cmake: improve package config file 2019-11-14 18:09:31 +08:00
Azat Khuzhin
1495f8b67a Link with iphlpapi only on windows
Fixes: 9fecb59a ("Parse IPv6 scope IDs.")
Refs: #923
2019-11-06 21:44:30 +03:00
Philip Homburg
9fecb59a94 Parse IPv6 scope IDs. 2019-11-06 21:07:16 +03:00
Azat Khuzhin
4436287d12 Relax bufferevent_connect_hostname_emfile
Do not do any assumptions on the error for the EMFILE from
getaddrinfo(), expect just any error.

Fixes: #924
2019-10-31 09:20:49 +03:00
yuangongji
53b3be4ee9 autotools: fails build when need but can not find openssl 2019-10-26 22:43:26 +08:00
yuangongji
5fe83d7433 cmake: eliminate duplicate installation of public headers 2019-10-25 21:54:13 +08:00
Azat Khuzhin
1ba94bdf08 Merge pull request #915 from ygj6 -- evutil_socketpair win32 fixes
* upstream/pr/915:
  appveyor: add vs2019 os to test some new features brought by Win10
  test: add testcase for evutil_socketpair()
  evutil: make evutil_socketpair() have the same behavior on Windows with build number lower and higher than 17063
2019-10-21 22:21:19 +03:00
Michael Davidsaver
84affc1837 append to CMAKE_MODULE_PATH
Don't override any -DCMAKE_MODULE_PATH= passed from CLI
to eg. test custom Platform/ support.
2019-10-21 10:41:27 -07:00
yuangongji
38eb4846e2 appveyor: add vs2019 os to test some new features brought by Win10 2019-10-19 13:16:25 +08:00
yuangongji
55d60c9258 test: add testcase for evutil_socketpair() 2019-10-19 13:07:04 +08:00
yuangongji
879d249619 evutil: make evutil_socketpair() have the same behavior on Windows with build number lower and higher than 17063 2019-10-18 21:03:40 +08:00
Azat Khuzhin
b9b9f19058 Do not use sysctl.h on linux (it had been deprecated)
It had been deprecated for a long time (AFAIK), but since
glibc-2.29.9000-309-g744e829637 it produces a #warning
2019-10-16 01:11:51 +03:00
yuangongji
dda8968c71 evutil: implement socketpair with unix domain socket on Win10 2019-10-14 23:23:56 +03:00
Azat Khuzhin
11bdd41c56 travis-ci: add OPENSSL_1_1=yes for the openssl 1.1 to distinguish it in list 2019-10-14 23:22:55 +03:00
Azat Khuzhin
fb95772ac7 travis-ci: use matrix.include over env.matrix/matrix.exclude for coveralls 2019-10-14 23:20:44 +03:00
Azat Khuzhin
f2bdd6eea1 travis-ci: build with clang only basic configurations
I tried to exclude clang instead (for PRs), but matrix.exclude cannot
have conditions (i..e matrix.exclude.if).
2019-10-14 23:20:20 +03:00
Azat Khuzhin
c1c8ae714b Use matrix.include.if over matrix.exclude.if for doxygen
And use if.repo over if.slug

Fixes: aeb014cc ("Do not try to deploy documentaion for PR")
2019-10-14 22:24:37 +03:00