3958 Commits

Author SHA1 Message Date
Breaker
3821cca1a6 Update README.md
The default option of  EVENT__DISABLE_OPENSSL:BOOL is `OFF`
2016-12-23 16:19:35 +08:00
Azat Khuzhin
4798de6c64 test: fix util/date_rfc1123 under win32
Refs: #417
v2: check when gmtime() returns NULL
v3: fix overflow cases
2016-12-22 18:10:24 +03:00
Azat Khuzhin
4545807db4 Fix UB in evutil_date_rfc1123()
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
2016-12-22 14:46:38 +03:00
Azat Khuzhin
68def4352c Merge branch 'date-rfc1123'
Follow RFC2616 (Date header should be in RFC1123 format).

But to reproduce this bug, program that uses libevent http-server should
call `setlocale(LC_ALL, "")` to properly initliaze locale, so that
strftime() retruns locale-specific dates.

* date-rfc1123:
  add tests for evutil_date_rfc1123().
  http: do not use local settings for Date header

Closes: #417
2016-12-19 01:31:20 +03:00
Vis Virial
360aa233f0 add tests for evutil_date_rfc1123(). 2016-12-19 00:58:49 +03:00
Vis Virial
db60ade81d http: do not use local settings for Date header 2016-12-19 00:55:50 +03:00
johnsonlee
23f9a20e8d Fix incorrect MIME type 2016-12-13 11:54:09 +08:00
Azat Khuzhin
32adf4347d be_openssl: make be_openssl_set_fd() static (no prototype required) 2016-12-07 01:48:54 +03:00
Azat Khuzhin
86fa007066 Merge branch 'be-openssl-fd-reset-fix-v2'
Two issues:
- dirty_shutdown for openssl 1.1
- BEV_CTRL_SET_FD for bufferevent_openssl didn't reset state

* be-openssl-fd-reset-fix-v2:
  Fix dirty_shutdown for openssl 1.1
  Fix reusing bufferevent_openssl after fd was reseted (i.e. on new connection)
  test/https: fix ssl dirty bypass for https_simple
  test/https: cover multiple request over the same connection
  test/http: sanity check for http_request_empty_done()

Reported-by: liutao74748@163.com
ML: http://archives.seul.org/libevent/users/Nov-2016/msg00041.html
2016-12-07 01:43:35 +03:00
Azat Khuzhin
d94b1762c5 Fix dirty_shutdown for openssl 1.1
SSL_read() returns -1, even when underlying read() return 0
2016-12-07 01:34:27 +03:00
Azat Khuzhin
5ab9518f15 Fix reusing bufferevent_openssl after fd was reseted (i.e. on new connection)
For example if you trying to issue multiple requests over the same
evhttp_conneciton, and if connection already closed (IOW it should be
re-connected), than you will get into trouble since it will got wrong
openssl state. This patch addresses this issue by restoring state to
initial if SETFD called with -1 fd.
2016-12-07 01:34:14 +03:00
Azat Khuzhin
cfe2ab22f2 test/https: fix ssl dirty bypass for https_simple
Tests:
- http/https_simple_dirty # not affected, since dirty is the default
- http/https_simple       # affected

v2: fix compilation with -DEVENT__DISABLE_OPENSSL=ON
2016-12-07 01:30:41 +03:00
Azat Khuzhin
45247e6fd9 test/https: cover multiple request over the same connection
Introduce two new tests:
- http/https_connection         # fail
- http/https_persist_connection # ok

Reported-by: liutao74748@163.com
2016-12-07 01:24:40 +03:00
Azat Khuzhin
e6ae069b48 test/http: sanity check for http_request_empty_done() 2016-12-07 01:24:40 +03:00
Azat Khuzhin
18a161f0e7 Merge branch 'openssl-1.1-init-fixes-v2'
* openssl-1.1-init-fixes-v2:
  sample/le-proxy: use TLS_method instead of SSLv23_method (latest deprecated)
  test: fix building under openssl 1.1 (init functions has been deprecated)
  le-proxy: fix building under openssl 1.1 (init functions has been deprecated)

Reported-by: varun.net@gmail.com
ML: http://archives.seul.org/libevent/users/Nov-2016/msg00002.html
2016-12-07 01:14:24 +03:00
Azat Khuzhin
fa58cb1da0 sample/le-proxy: use TLS_method instead of SSLv23_method (latest deprecated) 2016-12-07 01:14:16 +03:00
Azat Khuzhin
532a47ce1e test: fix building under openssl 1.1 (init functions has been deprecated)
Refs: #397
2016-12-07 01:14:16 +03:00
Azat Khuzhin
122bf144cf le-proxy: fix building under openssl 1.1 (init functions has been deprecated)
Refs: #397
2016-12-07 01:14:16 +03:00
Azat Khuzhin
13a4acdae3 https-cilent: fix compilation warnings about unused vars/functions on win32 2016-12-06 13:27:02 +03:00
Azat Khuzhin
336f3b11e5 Fix _FILE_OFFSET_BITS redinition (solaris/autotools)
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")
2016-12-06 13:21:28 +03:00
Azat Khuzhin
f7c70aef73 vagrant/osx: use make instead of gmake (there is no gmake)
$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
2016-12-06 13:06:50 +03:00
Azat Khuzhin
253e7fa90c 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__
2016-12-06 12:54:33 +03:00
Azat Khuzhin
2c62062e12 Fix signedness differ for iov_base (solaris) 2016-12-06 12:54:33 +03:00
Azat Khuzhin
3e75194cb5 evutil_time: include <unistd.h> when there is only sleep()/usleep() 2016-12-06 12:54:05 +03:00
Azat Khuzhin
1cbf26f67a http: fix formatter for pritnf for req->ntoread (osx) 2016-12-06 11:51:40 +03:00
Azat Khuzhin
0abe4eba83 sample/http-connect: fix compilation with VS2010
Fixes: nmathewson/Libevent#137
2016-12-06 09:57:16 +03:00
Philip Prindeville
6bf2061c4b C90 doesn't like declarations intermingled with statements
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: #418
Fixes: nmathewson/Libevent#136
2016-12-06 09:56:28 +03:00
Azat Khuzhin
ca591c5b1b vagrant: add centos box
Packages list get from here:
  https://pkgs.org/search/

Refs: #424
2016-11-18 20:58:08 +03:00
Azat Khuzhin
cbd303b6a6 Merge remote-tracking branch 'azat/release-2.1.7-rc-pull'
Finally 2.1 release candidate is out!

* azat/release-2.1.7-rc-pull:
  Bump version to 2.1.7-beta everywhere
  Update changelog for 2.1.7-rc
  README: update AUTHORS
release-2.1.7-rc
2016-11-05 01:35:26 +03:00
Azat Khuzhin
f4489b8323 Bump version to 2.1.7-beta everywhere
- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor
2016-11-04 23:05:20 +03:00
Azat Khuzhin
13ea9f5ee5 Update changelog for 2.1.7-rc 2016-11-04 03:32:57 +03:00
Azat Khuzhin
5904dd53b2 README: update AUTHORS
$ git log --format='%an' HEAD...refs/tags/release-2.1.6-beta | sort -u | xargs -n1 -i bash -c 'fgrep -q "{}" README.md || echo {}'
2016-11-04 03:32:57 +03:00
Azat Khuzhin
e4e099bdb5 travis-ci/osx: install lcov 2016-11-04 03:28:42 +03:00
Tim Hentenaar
cb0df5cfac test/regress: cover a polling of invalid fd
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
2016-11-04 03:28:42 +03:00
Tim Hentenaar
675974ce30 poll: Prevent libevent from spinning if POLLNVAL occurs
This can happen, for example if libevent is being used to poll fds given
by another library where the other library closes the fds without
notifying the program using it that said fds were closed. In this case,
libevent will simply spin on poll() since there are active fds, but
won't call any event callback to handle the condition.

In epoll case after socket closed it automatically removed from epfd, so
IOW it will not spin in epoll* API, just a timeout.

Fixes: #379
2016-11-04 03:28:08 +03:00
Azat Khuzhin
9ac000c724 Use coveralls.io via travis 2016-11-02 15:42:16 +03:00
Azat Khuzhin
40fbffc0df Fix cmake -DEVENT__COVERAGE=ON
- do not use compiler check from the root cmake rules with syntax error,
  let CodeCoverage check it
- fix CodeCoverage to check C compiler not CXX
- case insensitive checking of CMAKE_BUILD_TYPE
- replace flags with --coverage, and fix flags with linking with
  --coverate, otherwise it will not compile during checking flags and
  fails.
2016-11-02 11:36:24 +03:00
Azat Khuzhin
9585338f6c Testing with vagrant for 6 OS and cmake+autoconf
OS:
- linux
- freebsd
- osx
- netbsd
- solaris
- win

And mostly they all are more or less fine, except for timing issues

Also it supports next environment variables:
- NO_PKG
- NO_CMAKE
- NO_AUTOTOOLS

For instance if you run ubuntu box seocnd time, then you can run with:
$ NO_PKG=true vagrant provision ubuntu
2016-11-01 00:26:22 +03:00
Azat Khuzhin
9376ac4dff autogen.sh: learn about gmake
Fixes: 69cce257eb6183dda114d8f5b8ca0325cfabe2e1
("69cce257eb6183dda114d8f5b8ca0325cfabe2e1")
2016-10-31 22:37:56 +03:00
Azat Khuzhin
69cce257eb autogen.sh: remove all autoconf/automake caches, if any
Otherwise if you for example share root of libevent repository with some
vm (for example windows+cygwin) then if you try to build with configure
on host, and then on guest it will fail, so let's just ignore this since
autogen.sh is just for this -- cleaning all stuff.
2016-10-31 12:12:54 +03:00
Azat Khuzhin
3453c0815f cmake: fix finding python2, and check that it is really 2
python version check removed in a4d044c0cd97f68b4b3dde414b83d609719d33d7
("cmake: use PYTHON_EXECUTABLE to find python2"), but in
bcb990ab7cf4921c2c30a1aa4fcb4c0131fffe94 ("cmake/win32: fix running
regress, but fixing finding python2 interpreter") we set
PYTHON_EXECUTABLE only if it exists.
2016-10-31 02:25:43 +03:00
Azat Khuzhin
8fb08ae924 Ignore temporary configure files
So if you kill configure, git still should ignore them.
2016-10-31 02:25:43 +03:00
Azat Khuzhin
43b69b2aed cmake: fix CheckFunctionExistsEx/CheckPrototypeDefinition (CMP0054) 2016-10-26 18:48:41 +03:00
Zonr Chang
dc624adf42 cmake: cleanup
- Remove a redundant check on netdb.h (EVENT__HAVE_NETDB_H).
- Properly setup EVENT__SIZEOF_SSIZE_T for the case where "ssize_t" is
  not "int".
- Remove unused EVENT__HAVE_PTHREAD.
- Set EVENT__HAVE_LIBZ instead of EVENT__HAVE_ZLIB (and remove the
  latter).

Closes: #391 (cherry-picked from PR)
2016-10-26 18:48:41 +03:00
Thomas Bernard
e983712456 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
2016-10-26 01:41:13 +03:00
Azat Khuzhin
bcb990ab7c cmake/win32: fix running regress, but fixing finding python2 interpreter
Could not find executable C:/projects/libevent/build/bin/regress
  Looked in the following places:
  C:/projects/libevent/build/bin/regress
  C:/projects/libevent/build/bin/regress.exe
  ...
   9/13 Test  #9: regress__WIN32_debug ................***Not Run   0.00 sec

Link: https://ci.appveyor.com/project/nmathewson/libevent/build/2.1.6.271/job/wvy2jp7uojcut5cx#L1256
Fixes: #411
2016-10-26 01:41:07 +03:00
Simone Basso
236161611f README.md: fix typo: ar -> are 2016-10-21 10:49:22 +02:00
Azat Khuzhin
7e12e96e7f travis-ci: use container-based infrastructure
- by disabling sudo
- and since we use addons.apt.packages we don't need apt-get update, that requires sudo

Link: https://docs.travis-ci.com/user/migrating-from-legacy/
2016-10-17 01:30:54 +03:00
Azat Khuzhin
9d2f8d4b80 travis-ci/osx: fix compiling/linking openssl libraries
And we need that $(echo /path/*) otherwise bash will expand it only during
assignment that variable to another one, and this doesn't work correctly.
2016-10-17 01:04:05 +03:00
Azat Khuzhin
d7ceae593a travis-ci: use gcc-5 (fixes osx|gcc failures)
Refs: travis-ci/travis-ci#4587
2016-10-16 23:34:08 +03:00