201 Commits

Author SHA1 Message Date
dota17
9c151f3c34
Fix typos in comments (sample/test/event-internal.h) 2019-08-09 12:34:46 +03:00
dota17
101fbe3100
sample/signal-test: add NULL checks
Fixes: #865
2019-08-09 12:31:02 +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
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
Azat Khuzhin
4c774b6ceb
time-test: disable buffering (mostly for windows) 2019-05-21 10:59:05 +03:00
Azat Khuzhin
c4de602433
http-server: add usage/help dialog 2019-05-12 18:44:20 +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
linxiaohui
16d8564a2c
le-proxy: initiate use of the Winsock DLL
Closes: #803 (cherry-picked)
2019-04-18 22:43:16 +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
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
d5b24cc0c8
sample/becat: bufferevent cat, ncat/nc/telnet analog 2019-03-16 17:40:20 +03:00
Azat Khuzhin
afdccee9b3
s/http-server: fix cleanup routines
Fixes: bdd71f18 ("s/http-server: graceful cleanup")
2019-01-29 01:23:02 +03:00
Azat Khuzhin
56f3bdefca
s/http-server: check for EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED 2018-11-13 23:24:26 +03:00
Azat Khuzhin
bdd71f18b1
s/http-server: graceful cleanup 2018-11-13 11:10:17 +03:00
Azat Khuzhin
41b6b279cd
s/http-server: enable debug logging if EVENT_DEBUG_LOGGING_ALL env isset 2018-11-13 11:10:15 +03:00
Azat Khuzhin
3c8ded5c96
s/http-server: turn off buffering (otherwise do output on win32) 2018-11-13 11:10:12 +03:00
Azat Khuzhin
5d3f9d4d92
s/http-server: add an option to use IOCP 2018-11-13 11:10:11 +03:00
Azat Khuzhin
ed705ba704
s/http-server: add options (for persistent port) 2018-11-13 11:10:08 +03:00
Bogdan Harjoc
855f080430
dns-example: free result in getaddrinfo callback
According to evdns.c, the result not freed by libevent after
the callback runs:

evdns_getaddrinfo_gotresolve()
{
    ...
    data->user_cb(0, data->pending_result, data->user_data);
    data->pending_result = NULL;
    ...
}

To reproduce, build with -fsanitize=address, add -g to the getopt
list in dns-example.c like in the current commit and run

  dns-example -g google.com

Closes: #681 # cherry-picked
2018-08-17 03:22:28 +03:00
Bernard Spil
28b8075400 Fix build with LibreSSL 2.7
LibreSSL 2.7 implements OpenSSL 1.1 API except for BIO_get_init()

See also: https://bugs.freebsd.org/226900
Signed-off-by: Bernard Spil <brnrd@FreeBSD.org>
Closes: #617 (cherry-pick)
2018-04-02 23:13:28 +03:00
Azat Khuzhin
c2c08e0203 Add missing includes into openssl-compat.h
Before it depends from the caller #include appropriate headers (at least
for OPENSSL_VERSION_NUMBER), but let's make it independent.

Fixes: #574
2017-11-22 10:35:01 +03:00
Azat Khuzhin
33e363f3df Free dns/event bases in dns-example to avoid leaks 2017-11-20 02:08:08 +03:00
Carlo Marcelo Arenas Belón
0ec5edde50 autotools: pass $(OPENSSL_INCS) for samples (FTBFS macOS)
if OpenSSL is in a non standard location, need to pass that information
to any sample that needs it

Closes: #550
2017-08-22 11:28:41 +03:00
Azat Khuzhin
74a2f5935a le-proxy: fix compiling under win32 (because of no "inline" in C)
Include <util-internal.h> for regular "inline", since it is used everywhere.
2017-05-29 21:49:58 +03:00
Azat Khuzhin
d22e12eefa http-connect: exit on error 2017-05-28 16:38:55 +03:00
Maximilian Brunner
00ae45fe53 le-proxy: add missing return statement (UAF)
Refs: #501501501501501501501501501
2017-04-30 02:00:23 +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
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
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
johnsonlee
23f9a20e8d Fix incorrect MIME type 2016-12-13 11:54:09 +08:00
Azat Khuzhin
fa58cb1da0 sample/le-proxy: use TLS_method instead of SSLv23_method (latest deprecated) 2016-12-07 01:14:16 +03:00
Azat Khuzhin
122bf144cf le-proxy: fix building under openssl 1.1 (init functions has been deprecated)
Refs: #397
2016-12-07 01:14:16 +03:00
Azat Khuzhin
13a4acdae3 https-cilent: fix compilation warnings about unused vars/functions on win32 2016-12-06 13:27:02 +03:00
Azat Khuzhin
253e7fa90c util-internal: fix __func__ redefinition (netbsd)
==> netbsd: In file included from ../listener.c:57:0:
==> netbsd: ../util-internal.h:58:0: warning: "__func__" redefined [enabled by default]
==> netbsd:  #define __func__ EVENT____func__
==> netbsd:  ^
==> netbsd: In file included from /usr/include/amd64/types.h:39:0,
==> netbsd:                  from /usr/include/sys/types.h:45,
==> netbsd:                  from ../listener.c:30:
==> netbsd: /usr/include/sys/cdefs.h:394:0: note: this is the location of the previous definition
==> netbsd:  #define __func__ __PRETTY_FUNCTION__
2016-12-06 12:54:33 +03:00
Azat Khuzhin
0abe4eba83 sample/http-connect: fix compilation with VS2010
Fixes: nmathewson/Libevent#137
2016-12-06 09:57:16 +03:00
Thomas Bernard
e983712456 use ev_uint16_t instead of unsigned short for port
Like in `sockaddr_in` structure in /usr/include/netinet/in.h

@azat: convert all other users (bench, compat, ..) and tweak message
Fixes: #178
Fixes: #196
Refs: 6bf1ca78
Link: https://codereview.appspot.com/156040043/#msg4
2016-10-26 01:41:13 +03:00
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
basavesh.as
666db91af0 Fix memory leak in signal-test.c 2016-06-29 15:11:50 +05:30
kirillDanshin
2d3cd35362 sample/hello-world: exAmple, not eXMple
Fixes: #334
2016-03-09 01:10:51 +03:00
Azat Khuzhin
1bf7595644 http-connect: make it win32 compilable
Fixes: commit 1d34498ea31134bd7a8fcadcb95910b30a479e19 ("sample: add HTTP
CONNECT tunnelling example using libevent http layer")
2016-01-14 11:58:39 +03:00
Azat Khuzhin
fdf713a08b sample/https-client: allow to change path to ca-certificates
And default to one that linux have, for freebsd you will need:
$ https-client -url https://google.com -crt /usr/local/share/certs/ca-root-nss.crt
2015-11-24 01:37:06 +03:00
Azat Khuzhin
c4e9d9bd66 sample/https-client: check for ERR_remove_thread_state() existence
Fixes: freebsd 9.2 build
2015-11-24 01:19:25 +03:00
Azat Khuzhin
77ad68a658 sample/https-client: replace ERR_remove_state() by ERR_remove_thread_state()
Since ERR_remove_state() is deprecated:
  $ git log --grep ERR_remove_thread_state
  commit 2ecd2ededece66bf090fefc93ef3ddb672d9e71a
  Author: Bodo Möller <bodo@openssl.org>
  Date:   Wed Aug 13 19:30:01 2008 +0000

      Mention ERR_remove_state() deprecation, and ERR_remove_thread_state(NULL).

Link: https://www.openssl.org/docs/manmaster/crypto/ERR_remove_state.html
2015-11-18 15:39:08 +03:00
Azat Khuzhin
3316a21005 Add missing <string.h> for openssl_hostname_validation module
Now it included by openssl, but nfter
openssl/openssl@master-post-reformat-1494-g6329b60 it will print warning
(apparently they dropped <string.h> from the generic headers).
2015-11-18 15:39:00 +03:00
Azat Khuzhin
4637aa8841 sample/https-client: add -timeout option 2015-09-02 19:34:52 +03:00
Azat Khuzhin
f3d7ff5da2 sample/https-client: don't try to free uninitialized SSL
sample/https-client.c:459:3: warning: ‘ssl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   SSL_free(ssl);
2015-08-19 13:23:20 +03:00
Azat Khuzhin
24a1f25ab6 sample/https-client: graceful exit with freeing memory (to make valgrind happy) 2015-08-19 13:19:41 +03:00
Andrey Skriabin
29a04825d0 https-client: correctly handle URLs with no path (like "https://host:port")
path == NULL check removed

Fixes: #233
Fixes: #234
2015-08-19 12:28:03 +03:00