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)
* evbuffer-fixes-806-v2:
evbuffer: fix last_with_datap after prepend with empty chain
test: regression for evbuffer_expand_fast_() with invalid last_with_datap
test: cover adjusting of last_with_datap in evbuffer_prepend()
Fixes: #806
Before the fix:
$ regress --no-fork evbuffer/reserve_invalid_last_with_datap
evbuffer/empty_chain_expand: [err] ../buffer.c:2138: Assertion chain == buf->first failed in evbuffer_expand_fast_
Aborted (core dumped)
This is the a shorter version of test from the #806 (with some
comments).
* issue-807-accept4-getnameinfo-AF_UNIX:
http-server: add usage/help dialog
http: avoid use of uninitialized value for AF_UNIX/AF_LOCAL sockaddr
http-server: add ability to bind to unix-socket
build: struct sockaddr_un detection (sys/un.h, afunix.h)
Fixes: #807
As ploxiln pointed out in pull request 811 the check "newsize < 0"
is undefined behaviour (signed int overflow).
Follow the advice and check kqop->changes_size instead.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #813 (cherry-picked)
On amd64 systems with kqueue (e.g. *BSD systems) an integer overflow
could be triggered with an excessively huge amount of events.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
If slot is larger than INT_MAX / 2, then the loop which increases
nentries until it is larger than slot would never return.
Also make sure that nentries * msize will never overflow INT_MAX.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
It doesn't make sense to allow a signal number higher than NSIG.
The NSIG check already exists in signal.c for internally used
functions.
As this is a programming error of libevent consumers, this is a
purely defensive mechanism.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Converting unsigned to size_t for size of memory objects allows
proper handling of very large heaps on 64 bit systems.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #799 (cherry-picked)
There was a race between event_base_loop and evwatch_new (adding a
prepare/check watcher while iterating over the watcher list). Only
release the mutex immediately before invoking each watcher callback,
and reacquire it immediately afterwards (same as is done for normal
event handlers).
User can define his own response method by calling
evhttp_set_ext_method_cmp() on the struct http, or
evhttp_connection_set_ext_method_cmp() on the connection.
We expose a new stucture `evhttp_ext_method` which is passed to the
callback if it's set. So any field can be modified, with some exceptions
(in evhttp_method_):
If the cmp function is set, it has the ability to modify method, and
flags. Other fields will be ignored. Flags returned are OR'd with the
current flags.
Based on changes to the #282 from: Mark Ellzey <socket@gmail.com>
From the server perspective the evhttp_response_phrase_internal() should
not be called with 0 before this patch, it will be called with
EVHTTP_REQ_UNKNOWN_ hence this patch should not change behavior.
Fixes: 68eb526d7b ("http: add WebDAV methods support")
Fixes: #789Fixes: #796
Reported-by: Thomas Bernard <miniupnp@free.fr>
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
To avoid possible confusion
But there is still one test that has some messages on windows:
main/methods
Because this test needs >1 of avaiable methods, otherwise it will warn.
Otherwise build errors will be ignored, i.e. if build fails but regress
binary exists (copied from artifacts) it will be runned instead of newly
compiled.
There is one more report that is false positive, see [1]:
"In bufferevent_openssl.c, pointer wm is dereferenced on line 871
before it is null checked on line 873."
[1]: https://github.com/libevent/libevent/issues/382#issuecomment-238081938
* fix-uchex-warnings:
evdns: do not check server_req twice
evrpc: do not check req twice
Fixes: #382
Reported by µchex:
"In evdns.c, pointer server_req is null checked on line 1289 after it
is dereferenced above. Since server_req was already null checked above
on line 1243, there is no risk of crashing and the only bug is the
redundant null check (and indentation) on line 1289.
"
- DNS_OPTION_NAMESERVERS_NO_DEFAULT
Do not "default" nameserver (i.e. "127.0.0.1:53") if there is no nameservers
in resolv.conf, (iff DNS_OPTION_NAMESERVERS is set)
- EVDNS_BASE_NAMESERVERS_NO_DEFAULT
If EVDNS_BASE_INITIALIZE_NAMESERVERS isset, do not add default
nameserver if there are no nameservers in resolv.conf (just set
DNS_OPTION_NAMESERVERS_NO_DEFAULT internally)
Fixes: #569
Due to regress linked with event and event_core (both of them includes
evthread.c) there will be two different evthread_id_fn_ variables under
mingw64:
evthread_id_fn_: &0x5294f20a8
evthread_id_fn_: &0x4ba0030a8
And because of this evthread_use_pthreads() can/will set one copy of
variables while evthread*() functions will access another, which will
break a lot of things (for example main/del_notify test).
Fixes: #792