summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Always have evutil_secure_rng_add_bytes available (#1427)Kurt Roeckx2023-03-051-2/+3
| | | | | When libevent doesn't provide random the arc4 function, but they come from libc, there is no need to call this function, so make it do nothing. Fixes: #1393
* Add LEV_OPT_BIND_IPV4_AND_IPV6 flag (#1400)Edoardo Lolletti2023-02-042-1/+26
| | | | | | | | | Libevent introduced the LEV_OPT_BIND_IPV6ONLY to pass to evconnlistener_new_bind to make it automatically set the underlying socket as accepting ipv6 requests. This works fine on posix compliant platforms as by the standard every new AF_INET6 socket is created as both supporting ipv6 and ipv4 connections. But on windows the default is the opposite, with the flag IPV6_V6ONLY being always enabled by default. This makes creating a listener to supports both protocols a bit more tricky as winsock doesn't allow changing this flag after evconnlistener_new_bind does all the initial setup because as stated in the docs, you can't change it after the sonnect connected, so one would have to manually create the socket beforehand and set the flag and then call evconnlistener_new with the socket itself. It would be nice to have libevent keep a consistent behaviour across the platforms in this scenario, maybe or by making it always set IPV6_V6ONLY to false unless LEV_OPT_BIND_IPV6ONLY is passed, in which case it's set to true, or add another flag to forcefully set it to false and keep the system dependent behaviour as default. So this patch add new option for libevent listeners to bind to both - LEV_OPT_BIND_IPV4_AND_IPV6
* Replace magic numbers with consts for evdns_base_resolv_conf_parse() errorsDaniel Kempenich2023-01-271-3/+22
|
* signal: new signal handling backend based on signalfdDmitry Antipov2022-11-121-0/+16
| | | | | | | | Linux-specific signal handling backend based on signalfd(2) system call, and public function event_base_get_signal_method() to obtain an underlying kernel signal handling mechanism. Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
* Add locks for server WS, fixes #1357Dmitry Ilyin2022-10-121-1/+1
|
* Add helpers and all regress tests are passedDmitry Ilyin2022-10-041-3/+16
|
* Add minimal WebSocket server implementation for evhttp (#1322)Dmitry Ilyin2022-09-122-0/+59
| | | | | | | | | | | | | | 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.
* http: allow setting bevcb per socketLeon M. George2022-08-131-0/+10
| | | | | Co-authored-by: Azat Khuzhin <azat@libevent.org> v2: remove handling of HTTP_BIND_IPV6
* Add more HTTP_ response codesDmitry Ilyin2022-08-071-1/+12
|
* Add a note that IOCP is experimental featureAzat Khuzhin2022-07-101-0/+2
| | | | Refs: #1228
* Fix some typos (#1284)cui fliter2022-06-121-1/+1
| | | Signed-off-by: cuishuang <imcusg@gmail.com>
* fix grammar in commentzhongzedu2022-05-121-1/+1
|
* include/event.h: include <event2/util.h> over deprecatd <evutil.h>Syedh302022-04-301-1/+1
| | | | Fixes: #1263
* Fix build w/o OpenSSL by w/ MbedTLSJay Freeman (saurik)2022-02-121-3/+3
| | | | | | | | | | | | | | | | | In 78fa3971be892194aa168c04fc34bf5f2cd99b99 from https://github.com/libevent/libevent/pull/1241#commitcomment-63865496 a new "if MBEDTLS" block was added to include/include.am. This is not parsed by automake as it isn't on the first column, resulting in a subsequent error in the build. From [1]: > The if, else, and endif statements should not be indented, i.e., start on column one. [1]: https://www.gnu.org/software/automake/manual/html_node/Usage-of-Conditionals.html Fixes: #1251 Fixes: google/oss-fuzz#7149
* Fix make install failed when Automake used and both OpenSSL and MbedTLS are ↵Dmitry Ilyin2022-01-151-3/+4
| | | | | | | activated Issue: https://github.com/libevent/libevent/pull/1241#commitcomment-63865496
* Install bufferevent_ssl.h with MbedTLS support alsoDmitry Ilyin2021-12-151-0/+3
|
* feat: add `evdns_base_get_nameserver_fd` methodYongsheng Xu2021-12-101-0/+12
| | | | To get underlying udp socket fd.
* Fix comment for evdns_base_new()Azat Khuzhin2021-11-221-2/+2
|
* doc: adjust flags notice on event_base_loop()Yong Wu2021-09-121-1/+2
|
* http: support unix domain socketsSean Young2021-08-101-1/+33
| | | | | | | | | | | There are no standard for encoding a unix socket in an url. nginx uses: http://unix:/path/to/unix/socket:/httppath The second colon is needed to delimit where the unix path ends and where the rest of the url continues. Signed-off-by: Sean Young <sean@mess.org>
* evdns: add ability to get CNAMESergey Matveychuk2021-05-241-0/+3
| | | | | | | | Add new flag (DNS_CNAME_CALLBACK) for evdns_base_resolve_ipv4()/evdns_base_resolve_ipv6(). If set, you will get one more callback with type == DNS_CNAME and CNAME in addrs argument.
* Merge #1152 -- remove no op evdns functionsAzat Khuzhin2021-04-031-25/+0
|\ | | | | | | | | | | * upstream/pr/1152: dns: remove evdns_set_transaction_id_fn dns: remove evdns_set_random_bytes_fn
| * dns: remove evdns_set_transaction_id_fnfanquake2021-04-031-13/+0
| |
| * dns: remove evdns_set_random_bytes_fnfanquake2021-04-031-12/+0
| |
* | doc: adjust edge-trigger notice on event_new()Emil Engler2021-04-021-1/+1
|/ | | | | This makes it easier to read and to understand it in my opinon. It also fixes a missing "-" character.
* build: remove splice implementation fragmentsfanquake2021-03-281-6/+5
| | | | | | | Looks like a `splice` implementation was planned, but has clearly never eventuated (the TODO comment is from ~12 years ago, in 8b5bd77415fb6634fadf08357676926fecf5f032). For now, it's probably better to remove the unused code/correct the docs.
* bufferevent: introduce bufferevent_replacefd() (like setfd() but also close fd)Azat Khuzhin2021-03-231-0/+12
|
* Check return value of evbuffer_remove() in bufferevent_read()lilei2021-02-041-1/+2
| | | | | | | | | | | The conflict cast convertion between the return value of bufferevent_read() and evbuffer_remove(), int(-1)->size_t(An undefined maximum) Add test case of bufferevent_read() should return 0 in case of evbuffer_remove() returns -1 Fixes: #1132
* evdns: add max-probe-timeout/probe-backoff-factor settingschux05192021-01-121-3/+12
| | | | | | | | | | | I recently found that when the network status changed when calling bufferevent_socket_connect_hostname (e.g. switching between several WIFIs), all DNS servers would fail, and the timeout of probe would be very long if there were many DNS requests. I want libevent to support manual setting of MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR So move hardcoded MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR into struct, and allow changing them.
* Fix bufferevent_ssl_*flags() w/ disabled OpenSSL but enabled mbedTLSAzat Khuzhin2020-11-011-25/+28
|
* Introduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSLAzat Khuzhin2020-10-311-0/+12
|
* Introduce new API for flags of the SSL buffereventAzat Khuzhin2020-10-311-32/+70
| | | | | | | | | | | | | Introduce more generic API (like for evbuffer): - bufferevent_ssl_set_flags() - bufferevent_ssl_clear_flags() - bufferevent_ssl_get_flags() And deprecate existing: - bufferevent_openssl_get_allow_dirty_shutdown() - bufferevent_openssl_set_allow_dirty_shutdown() - bufferevent_mbedtls_get_allow_dirty_shutdown() - bufferevent_mbedtls_set_allow_dirty_shutdown()
* http: eliminate redundant bev fd manipulating and caching [WIP]Azat Khuzhin2020-10-311-1/+5
| | | | | | | | | | | | | | | | | At the very beginning we reset the bufferevent fd (if bev has it), which is not a good idea, since if user passes bufferevent with existing fd he has some intention. So we need to: - use BEV_OPT_CLOSE_ON_FREE for default bufferevent_socket_new() (to avoid manual shutdown/closee) - drop getsockopt(SOL_SOCKET, SO_ERROR), since bufferevent already has evutil_socket_finished_connecting_() - drop supperior bufferevent_setfd(bev, -1) in evhttp_connection_connect_() Closes: #795 Refs: #875
* http: add EVHTTP_URI_HOST_STRIP_BRACKETSAzat Khuzhin2020-10-271-0/+9
| | | | Refs: #1115
* http: const out address param to evcon_get_peerLeon M. George2020-09-091-1/+1
|
* Detect existence of pthread_mutexattr_setprotocol()Azat Khuzhin2020-08-291-1/+2
| | | | Fixes: #1084
* Convert from WinCrypt to Windows BCryptGerry Garvey2020-08-021-1/+1
| | | | Fixes: #1069
* fix build system and add test and cleanup codeokhowang(王沛文)2020-07-222-2/+3
|
* mbedtls based SSL implementationJesse Fang2020-07-221-3/+78
| | | | prototype is libevent-2.1.11-stable libevent_openssl.c
* doc: fix typo in thread.hfanquake2020-07-201-1/+1
| | | | s/evthred_use_pthreads_with_flags/evthread_use_pthreads_with_flags/
* evdns: Add support for setting maximum UDP DNS message size.seleznevae2020-05-311-1/+3
| | | | | | Added new option `edns-udp-size` for evdns_base which allows to control maximum allowed size of UDP DNS messages. This maximum size is passed to the DNS server via edns mechanism.
* http: Merge branch 'http-max_connections-pr-592'Azat Khuzhin2020-05-251-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | @jcoffland: "When the max connection limit is enabled and the limit is reached, the server will respond immediately with 503 Service Unavailable. This can be used to prevent servers from running out of file descriptors. This is better than request limiting because clients may make more than one request over a single connection. Blocking a request does not necessarily close the connection and free up a socket." * http-max_connections-pr-592: test: cover evhttp max connections Added evhttp max simultaneous connection limiting
| * Added evhttp max simultaneous connection limitingJoseph Coffland2018-01-301-0/+18
| |
* | evdns: Implement dns requests via tcpayuseleznev2020-05-211-7/+68
| |
* | Add EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD flag (fixes: #958)Azat Khuzhin2020-03-011-1/+14
| | | | | | | | | | | | | | | | By default we are using CLOCK_MONOTONIC_COARSE, but if EVENT_BASE_FLAG_PRECISE_TIMER isset, then CLOCK_MONOTONIC will be used, however this will also enable timerfd, while this is not always what someone wants, hence add a flag to control this (by default the old behavior is preserved, set new flag to change it).
* | Fix typo in thread.h (s/event/evthread)Azat Khuzhin2020-03-011-2/+2
| |
* | misspelling of output in bufferevent_struct.hyangyongsheng2020-01-281-1/+1
| |
* | Add callback support for error pagesnntrab2020-01-131-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | Add support for priority inheritanceAndre Pereira Azevedo Pinto2019-12-091-0/+15
| | | | | | | | | | | | | | | | 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>
* | Parse IPv6 scope IDs.Philip Homburg2019-11-061-0/+6
| |