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)
This is important, as otherwise clients can easily exhaust the file
descriptors available on a libevent HTTP server, which can cause
problems in other code which does not handle EMFILE well: for example,
see https://github.com/bitcoin/bitcoin/issues/11368Closes: #578 (patch cherry picked)
This is the second hunk of the first patch
5ff8eb26371c4dc56f384b2de35bea2d87814779 ("Fix crashing http server when
callback do not reply in place")
Fixes: #567
General http callback looks like:
static void http_cb(struct evhttp_request *req, void *arg)
{
evhttp_send_reply(req, HTTP_OK, "Everything is fine", NULL);
}
And they will work fine becuase in this case http will write request
first, and during write preparation it will disable *read callback* (in
evhttp_write_buffer()), but if we don't reply immediately, for example:
static void http_cb(struct evhttp_request *req, void *arg)
{
return;
}
This will leave connection in incorrect state, and if another request
will be written to the same connection libevent will abort with:
[err] ../http.c: illegal connection state 7
Because it thinks that read for now is not possible, since there were no
write.
Fix this by disabling EV_READ entirely. We couldn't just reset callbacks
because this will leave EOF detection, which we don't need, since user
hasn't replied to callback yet.
Reported-by: Cory Fields <cory@coryfields.com>
In function ‘send_a_byte_cb’:
test/regress.c:1853:2: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]
(void) write(*sockp, "A", 1);
Because checking in cmake breaks cross-compiling.
Introduced-in: 43eb56c7c738e3642f0981e3dd6ab9e082eec798.
Fixes: #482Fixes: #462
Refs: #475
v2: use waitid() with WNOWAIT
v3: use WNOWAIT only if it available in waitpid(), because not all netbsd
supports it
Before this patch we have one test.sh (well test-script.sh), and tooks
very long to run it sequentially, but they are pretty lightweight, so we
should run then in parallel.
Right now it fails because of regression for filtered openssl
bufferevent, and by it I mean ssl/bufferevent_filter_write_after_connect
test, and by fails - hang.
Regression-for: da52933550fd4736aa1c213b6de497e2ffc31e34 ("be_openssl:
don't call do_write() directly from outbuf_cb")
If system resolver (sync one) will respond too slow, then we can fail async
request and evdns will retransmit tham again, but evdns server will accept that
failed requets, so we will have not 2 requests but 4.
Reproduced on centos box sometimes.
As pointed in https://github.com/libevent/libevent/pull/417#issuecomment-267860738
"code is unsafe because in evutil_date_rfc1123() the pointer to the
automatic variable struct tm cur is used outside the scope it defined."
Checked with `clang -fsanitize=address -fsanitize-address-use-after-scope`
and test that call evutil_date_rfc1123() with tm==NULL
Tests:
- http/https_simple_dirty # not affected, since dirty is the default
- http/https_simple # affected
v2: fix compilation with -DEVENT__DISABLE_OPENSSL=ON
So firstly include our header (config.h) -- <evconfig-private.h>, and
only after it <sys/types.h> since latest has #ifdef guard, while our
config.h is not inteded for this.
And besides all this thing with LARGE_FILE is a abit awkward, since we
don't nefine _LP64/_LP32 anyway, and so we have next error actually (64bit VS
32bit):
==> solaris: In file included from ./util-internal.h:30:0,
==> solaris: from test/regress_ssl.c:49:
==> solaris: ./evconfig-private.h:29:0: warning: "_FILE_OFFSET_BITS" redefined
==> solaris: #define _FILE_OFFSET_BITS 64
==> solaris: ^
==> solaris: In file included from /usr/include/sys/types.h:17:0,
==> solaris: from test/regress_ssl.c:38:
==> solaris: /opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/include-fixed/sys/feature_tests.h:196:0: note: this is the location of the previous definition
==> solaris: #define _FILE_OFFSET_BITS 32
==> solaris: ^
For cmake it commented in: 8b228e27f57300be61b57a41a2ec8666b726dc34
("Lot's of cmake updates")
==> 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__
So move all of the declarations to the top of the offending function.
This patch includes both of issues (Fixes:), from @jeking3 and
@pprindeville
Fixes: #418Fixes: nmathewson/Libevent#136
Test that an event's callback is called if the fd is closed prior to being
polled for activity.
azat: make it run only for poll backend/method, and do not close fd
twice
Like in `sockaddr_in` structure in /usr/include/netinet/in.h
@azat: convert all other users (bench, compat, ..) and tweak message
Fixes: #178Fixes: #196
Refs: 6bf1ca78
Link: https://codereview.appspot.com/156040043/#msg4