sample

Branch


Log

Author Commit Date CI Message
Kirill Rodriguez a8cd11f9 2024-10-29T11:18:48 remove proxy-connection from http-connect
icy17 25f4439d 2024-04-22T15:11:15 sample/event-read-fifo: add proper exit path Co-authored-by: Azat Khuzhin <azat@libevent.org>
icy17 09738283 2024-04-10T18:21:47 Fix potential Null pointer dereference in event-read-fifo.c
Cœur 49d6b4b0 2024-07-08T10:10:42 samples: use evutil_socket_t instead and handle 64 bit Windows (#1682) * Use evutil_socket_t instead in http server sample and handle 64 bit Windows * Update http-server.c * consistently using EV_SOCK_FMT for Windows compatibility * code review: fix missing symbol strsignal * Add evutil_strsignal() helper instead of strsignal() macro --------- Co-authored-by: Hernan Martinez <hernan.c.martinez@gmail.com> Co-authored-by: Azat Khuzhin <azat@libevent.org>
Cœur dabf4e13 2024-06-24T03:10:56 Fix potential Null pointer dereference in ws-chat-server.c (#1674) Co-authored-by: icy17 <1061499390@qq.com>
Cœur 6d8c38af 2024-06-02T10:31:11 Reducing the number of mingw warnings
Andy Pan ee4fa05d 2024-05-19T16:10:02 Fix the compiler errors in sample/http-server.c --------- Signed-off-by: Andy Pan <i@andypan.me>
icy17 64decd48 2024-04-29T13:51:22 Fix potential Null pointer dereference in dns-example.c (#1601)
icy17 a584efaa 2024-04-22T14:47:34 Fix potential Null pointer dereference in time-test.c
Andy Pan 23cdd610 2024-01-15T12:26:58 Use evutil_set_tcp_keepalive for sample/becat.c Since #1532 introduced the util function for consolidating TPC keep-alive settings, there is no need to write other handmade functions elsewhere.
Hemanth Nandish 0c54433c 2023-11-26T14:53:23 time-test: use event_new for compatibility with future libevent (#1525)
Sam James 4c38de8c 2023-11-26T20:52:32 Fix -Walloc-size (#1526) Co-authored-by: Azat Khuzhin <azat@libevent.org>
Azat Khuzhin 9e4693ed 2023-09-22T10:21:06 becat: change -R to -b (since it is more of a buffer size)
Azat Khuzhin 617cf5ef 2023-09-22T10:21:06 becat: add ability to set TCP keepalive
Azat Khuzhin d9780cf9 2023-09-21T22:04:17 Fix -Wsingle-bit-bitfield-constant-conversion warning in clang 16 report: /src/le/libevent/sample/becat.c:304:29: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion] case 'k': o.extra.keep = 1; break;
Dmitry Ilyin f39ad1c4 2023-08-31T22:38:41 ws: replace evws_send with evws_send_text/evws_send_binary (ABI breakage) (#1500) Replace evws_send with evws_send_text, and introduce new API - evws_send_binary, that can be used to send binary frames. But note, that this commit breaks the ABI compatibility, but it should be OK, since there was only alpha release with evws_send, and nobody should rely on this, and I hope nobody does (we decided to go this way to avoid supporting deprecated API).
Azat Khuzhin 2b729238 2023-06-28T21:33:41 becat: fix handling positional arguments
Azat Khuzhin 687124d0 2023-06-28T21:33:41 becat: handle -T correctly
Leo Zhang 1418e793 2023-05-25T10:37:24 build: fix some new warnings /opensource/libevent/sample/ws-chat-server.c:253:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
Zhipeng Xue 3a0cf34b 2023-03-04T22:29:09 ws-chat-server: fix potential resource leak
Zhipeng Xue bac9d10a 2023-03-05T05:13:54 Fix potential null dereference in http-server (#1430) Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
Azat Khuzhin 72a4fe76 2022-11-12T18:59:41 ws-chat-server: fix session name initialization (using of uninitialized data)
Azat Khuzhin 8482e227 2022-11-12T18:44:44 ws-chat-server: avoid SIGSEGV in case of evws_new_session() failure
Azat Khuzhin dda05f45 2022-11-12T18:11:08 sample/ws-chat.html: allow to open it via file:// protocol
Dmitry Ilyin c2ecb4ac 2022-10-12T14:13:44 Add locks for server WS, fixes #1357
Dmitry Ilyin 10ed1f1c 2022-10-04T17:57:01 Change code for samples
Dmitry Ilyin e8313084 2022-09-12T22:16:56 Add minimal WebSocket server implementation for evhttp (#1322) This adds few functions to use evhttp-based webserver to handle incoming WebSockets connections. We've tried to use both libevent and libwebsockets in our application, but found that we need to have different ports at the same time to handle standard HTTP and WebSockets traffic. This change can help to stick only with libevent library. Implementation was inspired by modified Libevent source code in ipush project [1]. [1]: https://github.com/sqfasd/ipush/tree/master/deps/libevent-2.0.21-stable Also, WebSocket-based chat server was added as a sample.
Azat Khuzhin c22f2757 2022-07-09T23:27:23 Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility) Since OpenSSL 3.0 there is new OPENSSL_VERSION_MAJOR, but previous releases does not have it. So let's use plain old OPENSSL_VERSION_NUMBER to avoid more preprocessor macros.
William Marlow 29c420c4 2022-06-18T21:43:31 Initial OpenSSL 3.0 support * Don't use deprecated functions when building against OpenSSL 3.0. * Recognise that OpenSSL 3.0 can signal a dirty shutdown as a protocol. error in addition to the expected IO error produced by OpenSSL 1.1.1 * Update regress_mbedtls.c for compatibility with OpenSSL 3
Azat Khuzhin 6e310e3c 2022-07-09T20:05:35 sample/ssl-client-mbedtls.c: fix for MbedTLS 3 - use build_info.h over version.h - provide own certs P.S. since it is simpler then adding detection of the library version into autotools.
Azat Khuzhin ce20356a 2022-07-09T21:07:36 sample/ssl-client-mbedtls.c: break the loop on EOF
Azat Khuzhin fcf85e48 2022-07-09T21:03:36 sample/ssl-client-mbedtls.c: fix printing response in readcb
Azat Khuzhin 1bc62ce1 2022-07-09T14:13:57 https-client: fix strndup() for mingw build Right now it still reports [1]: 2022-07-09T10:53:05.4152800Z ../sample/https-client.c:558:43: warning: implicit declaration of function 'strndup' [-Wimplicit-function-declaration] 2022-07-09T10:53:05.4153300Z 558 | char *host_ipv6 = strndup(&host[1], strlen(&host[1]) - 1); 2022-07-09T10:53:05.4153651Z | ^~~~~~~ 2022-07-09T10:53:05.4154095Z ../sample/https-client.c:558:43: warning: incompatible implicit declaration of built-in function 'strndup' [-Wbuiltin-declaration- [1]: https://github.com/libevent/libevent/runs/7263194178?check_suite_focus=true
William Marlow e43376df 2022-06-18T21:43:31 Add missing strndup function on Windows to fix build on MSVC 2022 v2: Only define strndup on non-Mingw32 Windows
Azat Khuzhin 41239c9d 2022-05-12T07:37:19 https-client: fix connect to ipv6 address with square brackets getaddrinfo() cannot process addresses like "[::1]", only "::1" Fixes: #1275
Azat Khuzhin 862b83f9 2021-05-24T21:03:58 dns-example: add CNAME support
Emil Engler e77f1872 2021-04-02T21:02:12 sample: use unsigned short instead of int for port The C standard gurantees that an unsigned short is at least up to 65535 huge. Enough to store every TCP port. Also the parameter PORT is overgiven to the `htons()` function which assumes that the parameter is of type `uint16_t` which unsigned short is on most platforms.
Azat Khuzhin eb822ac7 2020-10-27T01:22:59 http-server: add -H option to change listen address
Azat Khuzhin 6135248a 2020-10-27T01:19:40 https-client: add newline into error messages
Azat Khuzhin f51ec253 2020-10-27T01:17:44 https-client: add -4/-6 switches
Azat Khuzhin 22872176 2020-10-15T23:23:15 becat: add timeout (client/server) and verbosity (event_enable_debug_logging())
Azat Khuzhin 852af060 2020-10-04T17:44:34 http-server: add cli argument for max body size
okhowang(王沛文) b45a02ef 2020-09-16T11:31:33 sample: add https-client-mbedtls
okhowang(王沛文) 85c67599 2020-07-24T17:19:14 fix: compat mbedtls < 2.4
Azat Khuzhin e458696c 2020-07-23T00:28:09 le-proxy: ignore SIGPIPE Fixes: #1057
okhowang(王沛文) 028385f6 2020-05-28T17:14:46 fix build system and add test and cleanup code
Jesse Fang 7680409a 2020-01-13T23:08:26 simple https client example using mbedtls Based on mbedtls's source code programs/ssl/ssl_client1.c
Enji Cooper d4e392b5 2020-03-26T18:28:07 Mute clang 8 compilation error with gcc pragma Move the pragma ignoring outside the function to fix the build with gcc. While here, add equivalent clang pragmas to mute the warning, as well. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
nntrab 02905413 2016-02-09T18:01:00 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)
Azat Khuzhin 9c91fe14 2020-01-12T15:31:50 http-connect: do not check connection on GET cb
Azat Khuzhin 415ddee3 2020-01-12T15:24:35 http-connect: set Host header (for CONNECT and GET) (like curl)
Azat Khuzhin e54d5fc5 2020-01-12T15:14:24 http-connect: cleanup and helpers
Azat Khuzhin 08981f8d 2020-01-05T19:02:22 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@0b7347effee5
yangyongsheng 1edb6f61 2019-12-29T20:52:17 Initialize variable to 0 replace use memset function in sample/hello-world.c
yuangongji 78b5bca6 2019-10-08T21:38:58 sample/https-client: link crypt32 explicitly when build with mingw-w64
yuangongji 572a5651 2019-09-15T21:45:26 https-client: load certificates from the system cert store on Windows
Azat Khuzhin c3f35345 2019-09-05T23:31:19 Fix checking return value of the evdns_base_resolv_conf_parse() Reported-by: Maxim Gorbachyov <maxim.gorbachyov@gmail.com>
David Disseldorp 7d71214e 2019-08-21T01:10:19 sample/http-server: fix parameter parsing argv[1] is currently unconditionally passed as the docroot to send_document_cb(). This is broken if any optional parameters are provided, such as -p <port>. Signed-off-by: David Disseldorp <ddiss@samba.org>
David Disseldorp a0276292 2019-08-21T01:00:07 sample/signal-test: fix use of uninitialized variable signal_int is uninitialized in the !base error path. Signed-off-by: David Disseldorp <ddiss@samba.org>
ygj6 759573c9 2019-08-14T19:47:45 sample: fix 'INFINITY' undeclared error
ygj6 80009c50 2019-08-13T17:10:37 becat: avoid using anonymous structures It hasn't been part of the C standard until C11, although it is very useful GCC extension it is better to avoid using this in cross platform projects like libevent.
dota17 9c151f3c 2019-08-06T18:19:15 Fix typos in comments (sample/test/event-internal.h)
dota17 101fbe31 2019-08-08T21:28:20 sample/signal-test: add NULL checks Fixes: #865
Azat Khuzhin 2d4ac10e 2019-06-02T21:51:35 becat: remove extra SSL_CTX options usage [ci skip] Because: - this do not affects performance - this breaks builds for with older openssl
wenyg 891dd188 2019-05-30T17:38:49 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)
Azat Khuzhin 4c774b6c 2019-05-21T10:59:05 time-test: disable buffering (mostly for windows)
Azat Khuzhin c4de6024 2019-05-12T18:25:37 http-server: add usage/help dialog
Azat Khuzhin 737d1beb 2019-05-11T18:49:28 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
linxiaohui 16d8564a 2019-04-18T17:10:33 le-proxy: initiate use of the Winsock DLL Closes: #803 (cherry-picked)
Azat Khuzhin 428f36e5 2019-04-03T23:22:54 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
Dan Rosen 2f184f8b 2019-03-26T13:33:57 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
Azat Khuzhin d5b24cc0 2019-03-05T21:34:31 sample/becat: bufferevent cat, ncat/nc/telnet analog
Azat Khuzhin afdccee9 2019-01-29T01:23:02 s/http-server: fix cleanup routines Fixes: bdd71f18 ("s/http-server: graceful cleanup")
Azat Khuzhin 56f3bdef 2018-11-13T23:23:09 s/http-server: check for EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED
Azat Khuzhin bdd71f18 2018-11-13T10:48:41 s/http-server: graceful cleanup
Azat Khuzhin 41b6b279 2018-11-13T10:26:17 s/http-server: enable debug logging if EVENT_DEBUG_LOGGING_ALL env isset
Azat Khuzhin 3c8ded5c 2018-11-08T11:19:16 s/http-server: turn off buffering (otherwise do output on win32)
Azat Khuzhin 5d3f9d4d 2018-11-08T11:13:21 s/http-server: add an option to use IOCP
Azat Khuzhin ed705ba7 2018-11-13T10:33:24 s/http-server: add options (for persistent port)
Bogdan Harjoc 855f0804 2018-08-09T14:47:17 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
Bernard Spil 28b80754 2018-04-02T13:18:27 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)
Azat Khuzhin c2c08e02 2017-11-22T10:33:15 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
Azat Khuzhin 33e363f3 2017-11-20T02:07:54 Free dns/event bases in dns-example to avoid leaks
Carlo Marcelo Arenas Belón 0ec5edde 2017-08-21T01:08:15 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
Azat Khuzhin 74a2f593 2017-05-29T16:24:48 le-proxy: fix compiling under win32 (because of no "inline" in C) Include <util-internal.h> for regular "inline", since it is used everywhere.
Azat Khuzhin d22e12ee 2017-05-28T16:38:20 http-connect: exit on error
Maximilian Brunner 00ae45fe 2017-04-25T23:10:13 le-proxy: add missing return statement (UAF) Refs: #501501501501501501501501501
Pierce Lopez 05318f13 2017-03-05T11:33:44 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
Pierce Lopez 5d18d879 2017-03-02T21:09:32 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
David Disseldorp 55cadb2b 2017-02-20T16:55:57 sample/dns-example: fix compiler warning (getopt() returns an int) Signed-off-by: David Disseldorp <ddiss@suse.de> Closes: #449
David Disseldorp e139cbac 2017-02-20T14:47:59 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>
Jan Beich d057c45e 2017-01-28T16:42:13 Unbreak build with LibreSSL after openssl 1.1 support added Fixes: 3e9e0a0d46e4 ("Make it build using OpenSSL 1.1.0") Fixes: #445
johnsonlee 23f9a20e 2016-12-13T11:54:09 Fix incorrect MIME type
Azat Khuzhin fa58cb1d 2016-11-16T01:16:30 sample/le-proxy: use TLS_method instead of SSLv23_method (latest deprecated)
Azat Khuzhin 122bf144 2016-11-14T02:17:38 le-proxy: fix building under openssl 1.1 (init functions has been deprecated) Refs: #397
Azat Khuzhin 13a4acda 2016-12-06T13:26:09 https-cilent: fix compilation warnings about unused vars/functions on win32
Azat Khuzhin 253e7fa9 2016-12-06T12:08:32 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__
Azat Khuzhin 0abe4eba 2016-12-06T09:54:13 sample/http-connect: fix compilation with VS2010 Fixes: nmathewson/Libevent#137
Thomas Bernard e9837124 2014-12-13T19:42:42 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
Kurt Roeckx 3e9e0a0d 2016-09-19T22:05:15 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)