summaryrefslogtreecommitdiff
path: root/sample
Commit message (Collapse)AuthorAgeFilesLines
* ws-chat-server: fix potential resource leakZhipeng Xue2023-03-051-0/+2
|
* Fix potential null dereference in http-server (#1430)Zhipeng Xue2023-03-041-0/+2
| | | Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
* ws-chat-server: fix session name initialization (using of uninitialized data)Azat Khuzhin2022-11-121-2/+3
|
* ws-chat-server: avoid SIGSEGV in case of evws_new_session() failureAzat Khuzhin2022-11-121-1/+7
|
* sample/ws-chat.html: allow to open it via file:// protocolAzat Khuzhin2022-11-121-1/+5
|
* Add locks for server WS, fixes #1357Dmitry Ilyin2022-10-121-1/+1
|
* Change code for samplesDmitry Ilyin2022-10-042-21/+13
|
* Add minimal WebSocket server implementation for evhttp (#1322)Dmitry Ilyin2022-09-123-0/+346
| | | | | | | | | | | | | | 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.
* Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)Azat Khuzhin2022-07-102-3/+3
| | | | | | | | 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.
* Initial OpenSSL 3.0 supportWilliam Marlow2022-07-092-0/+14
| | | | | | | * 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
* sample/ssl-client-mbedtls.c: fix for MbedTLS 3Azat Khuzhin2022-07-091-9/+46
| | | | | | | | - 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.
* sample/ssl-client-mbedtls.c: break the loop on EOFAzat Khuzhin2022-07-091-0/+3
|
* sample/ssl-client-mbedtls.c: fix printing response in readcbAzat Khuzhin2022-07-091-1/+1
|
* https-client: fix strndup() for mingw buildAzat Khuzhin2022-07-091-2/+3
| | | | | | | | | | | 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
* Add missing strndup function on Windows to fix build on MSVC 2022William Marlow2022-07-091-0/+11
| | | | v2: Only define strndup on non-Mingw32 Windows
* https-client: fix connect to ipv6 address with square bracketsAzat Khuzhin2022-05-121-2/+12
| | | | | | getaddrinfo() cannot process addresses like "[::1]", only "::1" Fixes: #1275
* dns-example: add CNAME supportAzat Khuzhin2021-05-241-1/+6
|
* sample: use unsigned short instead of int for portEmil Engler2021-04-031-1/+1
| | | | | | | 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.
* http-server: add -H option to change listen addressAzat Khuzhin2020-10-271-3/+6
|
* https-client: add newline into error messagesAzat Khuzhin2020-10-271-4/+4
|
* https-client: add -4/-6 switchesAzat Khuzhin2020-10-271-1/+14
|
* becat: add timeout (client/server) and verbosity (event_enable_debug_logging())Azat Khuzhin2020-10-151-2/+32
|
* http-server: add cli argument for max body sizeAzat Khuzhin2020-10-041-1/+6
|
* sample: add https-client-mbedtlsokhowang(王沛文)2020-09-162-1/+101
|
* fix: compat mbedtls < 2.4okhowang(王沛文)2020-07-241-1/+1
|
* le-proxy: ignore SIGPIPEAzat Khuzhin2020-07-231-4/+12
| | | | Fixes: #1057
* fix build system and add test and cleanup codeokhowang(王沛文)2020-07-223-315/+271
|
* simple https client example using mbedtlsJesse Fang2020-07-221-0/+315
| | | | Based on mbedtls's source code programs/ssl/ssl_client1.c
* Mute clang 8 compilation error with gcc pragmaEnji Cooper2020-03-261-3/+14
| | | | | | | 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>
* Add callback support for error pagesnntrab2020-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | 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)
* http-connect: do not check connection on GET cbAzat Khuzhin2020-01-121-3/+0
|
* http-connect: set Host header (for CONNECT and GET) (like curl)Azat Khuzhin2020-01-121-3/+5
|
* http-connect: cleanup and helpersAzat Khuzhin2020-01-121-35/+46
|
* Fix compilation without OPENSSL_API_COMPATAzat Khuzhin2020-01-071-2/+5
| | | | | | | | | | 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
* Initialize variable to 0 replace use memset function in sample/hello-world.cyangyongsheng2019-12-301-2/+1
|
* sample/https-client: link crypt32 explicitly when build with mingw-w64yuangongji2019-10-081-0/+3
|
* https-client: load certificates from the system cert store on Windowsyuangongji2019-09-171-7/+37
|
* Fix checking return value of the evdns_base_resolv_conf_parse()Azat Khuzhin2019-09-051-2/+2
| | | | Reported-by: Maxim Gorbachyov <maxim.gorbachyov@gmail.com>
* sample/http-server: fix parameter parsingDavid Disseldorp2019-08-211-13/+15
| | | | | | | | 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>
* sample/signal-test: fix use of uninitialized variableDavid Disseldorp2019-08-211-1/+1
| | | | | | signal_int is uninitialized in the !base error path. Signed-off-by: David Disseldorp <ddiss@samba.org>
* sample: fix 'INFINITY' undeclared errorygj62019-08-141-0/+4
|
* becat: avoid using anonymous structuresygj62019-08-141-11/+11
| | | | | | 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.
* Fix typos in comments (sample/test/event-internal.h)dota172019-08-093-6/+6
|
* sample/signal-test: add NULL checksdota172019-08-091-4/+15
| | | | Fixes: #865
* becat: remove extra SSL_CTX options usage [ci skip]Azat Khuzhin2019-06-021-7/+0
| | | | | | Because: - this do not affects performance - this breaks builds for with older openssl
* https-client: correction error checkingwenyg2019-06-011-1/+1
| | | | | | | 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)
* time-test: disable buffering (mostly for windows)Azat Khuzhin2019-05-211-0/+3
|
* http-server: add usage/help dialogAzat Khuzhin2019-05-121-3/+14
|
* http-server: add ability to bind to unix-socketAzat Khuzhin2019-05-121-43/+108
| | | | | | Usage example: http-server -u -U /tmp/sock /tmp/no-such-dir curl -v --unix-socket /tmp/sock 127.1:8080/foo
* le-proxy: initiate use of the Winsock DLLlinxiaohui2019-04-181-0/+11
| | | | Closes: #803 (cherry-picked)