]> granicus.if.org Git - libevent/log
libevent
9 years agotest: fix bufferevent/bufferevent_pair_release_lock for freebsd
Azat Khuzhin [Thu, 10 Sep 2015 09:39:20 +0000 (12:39 +0300)]
test: fix bufferevent/bufferevent_pair_release_lock for freebsd

On FreeBSD with kqueue there is a call to evthread_debug_lock_mark_unlocked()
during event_base_free(), that will fail with an assert because of unmatched
"held_by", fix this by reseting lock callbacks to NULL before
event_base_free().

Trace:
  bufferevent/bufferevent_pair_release_lock: [warn] Trying to disable lock functions after they have been set up will probaby not work.
  [warn] Trying to disable lock functions after they have been set up will probaby not work.

    FAIL libevent/test/regress_bufferevent.c:259: lock: lock error[err] libevent/evthread.c:277: Assertion lock->held_by == me failed in evthread_debug_lock_mark_unlocked
  [New Thread 802006400 (LWP 100070/regress)]

  Program received signal SIGABRT, Aborted.
  [Switching to Thread 802006400 (LWP 100070/regress)]
  0x000000080167d6ca in thr_kill () from /lib/libc.so.7
  (gdb) bt
  #0  0x000000080167d6ca in thr_kill () from /lib/libc.so.7
  #1  0x0000000801752149 in abort () from /lib/libc.so.7
  #2  0x00000000004dff44 in event_exit (errcode=-559030611) at libevent/log.c:105
  #3  0x00000000004e053c in event_errx (eval=-559030611, fmt=0x5182cc "%s:%d: Assertion %s failed in %s") at libevent/log.c:162
  #4  0x00000000004d9954 in evthread_debug_lock_mark_unlocked (mode=0, lock=0x802017060) at libevent/evthread.c:277
  #5  0x00000000004d909a in debug_lock_unlock (mode=0, lock_=0x802017060) at libevent/evthread.c:290
  #6  0x00000000004e132c in evsig_dealloc_ (base=0x80201e300) at libevent/signal.c:434
  #7  0x00000000004e36c1 in kq_dealloc (base=0x80201e300) at libevent/kqueue.c:435
  #8  0x00000000004c9a44 in event_base_free_ (base=0x80201e300, run_finalizers=1) at libevent/event.c:855
  #9  0x00000000004c931a in event_base_free (base=0x0) at libevent/event.c:887
  #10 0x0000000000452657 in lock_unlock_free_thread_cbs () at libevent/test/regress_bufferevent.c:279
  #11 0x0000000000452621 in free_lock_unlock_profiler (data=0x8020170a0) at libevent/test/regress_bufferevent.c:317
  #12 0x000000000044bc8f in test_bufferevent_pair_release_lock (arg=0x8020170a0) at libevent/test/regress_bufferevent.c:334
  #13 0x00000000004b2288 in testcase_run_bare_ (testcase=0x737660) at libevent/test/tinytest.c:105
  #14 0x00000000004b1e72 in testcase_run_one (group=0x738c90, testcase=0x737660) at libevent/test/tinytest.c:252
  #15 0x00000000004b2930 in tinytest_main (c=3, v=0x7fffffffead0, groups=0x738c20) at libevent/test/tinytest.c:434
  #16 0x00000000004982fe in main (argc=3, argv=0x7fffffffead0) at libevent/test/regress_main.c:459
  (gdb) f 4
  #4  0x00000000004d9954 in evthread_debug_lock_mark_unlocked (mode=0, lock=0x802017060) at libevent/evthread.c:277
  277                     EVUTIL_ASSERT(lock->held_by == me);
  Current language:  auto; currently minimal
  (gdb) p lock
  $1 = (struct debug_lock *) 0x802017060
  (gdb) p lock->held_by
  $2 = 0
  (gdb) p me
  $3 = 34393318400

9 years agoMerge branch 'cloudabi-fixes-pr-278'
Azat Khuzhin [Thu, 10 Sep 2015 09:17:39 +0000 (12:17 +0300)]
Merge branch 'cloudabi-fixes-pr-278'

Rebased version of #278

* cloudabi-fixes-pr-278:
  Assume that ke_udata is an integer type on CloudABI.
  Add missing include of <netinet/in.h>.
  Include <sys/ioctl.h>, <sys/resource.h> and <sys/wait.h> optionally.

9 years agoAssume that ke_udata is an integer type on CloudABI.
Ed Schouten [Tue, 25 Aug 2015 21:31:07 +0000 (23:31 +0200)]
Assume that ke_udata is an integer type on CloudABI.

9 years agoAdd missing include of <netinet/in.h>.
Ed Schouten [Wed, 26 Aug 2015 07:45:23 +0000 (09:45 +0200)]
Add missing include of <netinet/in.h>.

POSIX states that sockaddr_in6 should be declared in <netinet/in.h>. By
including this header, the code now builds on FreeBSD and CloudABI.

9 years agoInclude <sys/ioctl.h>, <sys/resource.h> and <sys/wait.h> optionally.
Ed Schouten [Wed, 26 Aug 2015 08:06:09 +0000 (10:06 +0200)]
Include <sys/ioctl.h>, <sys/resource.h> and <sys/wait.h> optionally.

Though CloudABI implements a very large part of POSIX, it does not
provide these header files, for the reason that there is no raw device
access, no resource limiting and no access to the global process table
through wait().

It looks like these header files are not actually needed in theory.
There don't seem to be any constructs in these source files that use
these features, but I suspect they might still be required on some
systems.

9 years agoAdd a prototype for event_disable_debug_mode()
Sebastian Hahn [Thu, 13 Aug 2015 13:04:14 +0000 (15:04 +0200)]
Add a prototype for event_disable_debug_mode()

Exporting this function seems rather useless, as debugging mode has to
be enabled early and calling this function doesn't allow it to get
toggled back on later.

Fixes a compile warning when using clang 3.6.

Fixes #271
Fixes #224

9 years agohttp: export evhttp_connection_set_family()
Azat Khuzhin [Thu, 10 Sep 2015 08:46:17 +0000 (11:46 +0300)]
http: export evhttp_connection_set_family()

Fixes #176

9 years agotest/regress_be: bufferevent_enable() shouldn't call eventcb by it's own
Azat Khuzhin [Thu, 10 Sep 2015 08:18:20 +0000 (11:18 +0300)]
test/regress_be: bufferevent_enable() shouldn't call eventcb by it's own

It must enter the event loop regardless BEV_OPT_DEFER_CALLBACKS, to avoid
potential errors with subsequent connect(), you will find more info in #43,
since this is a regression for it.

9 years agotest/regress_be: introduce fake_listener_create()
Azat Khuzhin [Wed, 9 Sep 2015 22:17:50 +0000 (01:17 +0300)]
test/regress_be: introduce fake_listener_create()

9 years agoMerge branch 'evhttp-request-own-fixes'
Azat Khuzhin [Wed, 9 Sep 2015 16:31:48 +0000 (19:31 +0300)]
Merge branch 'evhttp-request-own-fixes'

I hope that I validated all places where evhttp_request_free() called and
ownership of request can be belong to user-specific code.

* evhttp-request-own-fixes:
  http: fix evhttp_request_own() by checking EVHTTP_USER_OWNED in more cases
  test/regress_http: cover evhttp_request_own()

Fixes #68

9 years agohttp: fix evhttp_request_own() by checking EVHTTP_USER_OWNED in more cases
Azat Khuzhin [Wed, 9 Sep 2015 16:21:51 +0000 (19:21 +0300)]
http: fix evhttp_request_own() by checking EVHTTP_USER_OWNED in more cases

Suggested-by: @ellzey
Fixes: http/request_own
Fixes: #68
9 years agotest/regress_http: cover evhttp_request_own()
Azat Khuzhin [Wed, 9 Sep 2015 16:15:18 +0000 (19:15 +0300)]
test/regress_http: cover evhttp_request_own()

9 years agoMerge branch 'http-server-EOF-at-read-v3'
Azat Khuzhin [Wed, 9 Sep 2015 15:08:02 +0000 (18:08 +0300)]
Merge branch 'http-server-EOF-at-read-v3'

This patchset fixes an issue with detecting EOF in http server and add some
regression tests to make sure that we will not break anything.

* http-server-EOF-at-read-v3:
  http: fix detecting EOF without write
  test/regress_http: cover write during read
  test/regress_http: verify that closecb will be called without multiple write

Closes #78
Link: http://stackoverflow.com/questions/18743948/libevent2-http-server-how-to-detect-client-close/18776728?noredirect=1#18776728
9 years agohttp: fix detecting EOF without write
Azat Khuzhin [Tue, 8 Sep 2015 13:40:55 +0000 (16:40 +0300)]
http: fix detecting EOF without write

Before this patch http server don't knows when client disconnected until it
will try to write to it, IOW to detect is client still alive you need to write
something to client socket, however it is not convenient since it requires to
store all clients somewhere and poll them periodically, and I don't see any
regressions if we will leave EV_READ always (like libevhtp do), since we
already reset read callback in evhttp_write_buffer() (see
http/write_during_read).

Also since we don't disable EV_READ anymore we don't need some enable EV_READ,
so we will reduce number of epoll_ctl() calls.

Covered-by: http/terminate_chunked_oneshot
Covered-by: http/write_during_read
Fixes: #78
9 years agotest/regress_http: cover write during read
Azat Khuzhin [Wed, 9 Sep 2015 14:45:44 +0000 (17:45 +0300)]
test/regress_http: cover write during read

This is the regression for evhttp_write_buffer() where we reset readcb to avoid
illegal state:
http/write_during_read: [err] evhttp_read_cb: illegal connection state 7

If you will comment that this test will fail.

9 years agotest/regress_http: verify that closecb will be called without multiple write
Azat Khuzhin [Tue, 8 Sep 2015 12:44:13 +0000 (15:44 +0300)]
test/regress_http: verify that closecb will be called without multiple write

And now this works incorrect, i.e. http layer will not detect EOF until another
write.

Reported-in: #78

9 years agotest: run regress with EVENT_DEBUG_MODE=1 and without
Azat Khuzhin [Wed, 2 Sep 2015 08:51:00 +0000 (11:51 +0300)]
test: run regress with EVENT_DEBUG_MODE=1 and without

This could show some bugs like "event_assign called on an already added event",
and some others that debugging mode could track.

9 years agotest/regress: fix bufferevent_pair_release_lock with EVENT_DEBUG_MODE
Azat Khuzhin [Wed, 2 Sep 2015 08:55:14 +0000 (11:55 +0300)]
test/regress: fix bufferevent_pair_release_lock with EVENT_DEBUG_MODE

Before this patch you will see next error:
$ EVENT_DEBUG_MODE= regress --no-fork bufferevent/bufferevent_pair_release_lock
bufferevent/bufferevent_pair_release_lock: [err] evthread initialization must be called BEFORE anything else!

9 years agosample/https-client: add -timeout option
Azat Khuzhin [Wed, 2 Sep 2015 16:34:52 +0000 (19:34 +0300)]
sample/https-client: add -timeout option

9 years agoMerge branch 'be-openssl-drop-fd_is_set-v4'
Azat Khuzhin [Wed, 2 Sep 2015 16:34:15 +0000 (19:34 +0300)]
Merge branch 'be-openssl-drop-fd_is_set-v4'

This must fix some issues with bufferevent openssl layer + some cleanups.

* be-openssl-drop-fd_is_set-v4:
  be_openssl: don't use *_auto() in do_handshake() we can't have fd == -1 there
  be_openssl: don't call set_open_callbacks() if fd == -1
  be_openssl: introduce be_openssl_auto_fd() helper
  be_openssl: introduce set_open_callbacks_auto()
  be_openssl: get rid off hackish "fd_is_set", to fix some corner cases

9 years agobe_openssl: don't use *_auto() in do_handshake() we can't have fd == -1 there
Azat Khuzhin [Wed, 2 Sep 2015 12:09:24 +0000 (15:09 +0300)]
be_openssl: don't use *_auto() in do_handshake() we can't have fd == -1 there

9 years agobe_openssl: don't call set_open_callbacks() if fd == -1
Azat Khuzhin [Wed, 2 Sep 2015 11:19:16 +0000 (14:19 +0300)]
be_openssl: don't call set_open_callbacks() if fd == -1

This must be illegal, firstly we must do set_do handshake and only after this
we could read/write.

9 years agobe_openssl: introduce be_openssl_auto_fd() helper
Azat Khuzhin [Wed, 2 Sep 2015 09:42:29 +0000 (12:42 +0300)]
be_openssl: introduce be_openssl_auto_fd() helper

9 years agobe_openssl: introduce set_open_callbacks_auto()
Azat Khuzhin [Wed, 2 Sep 2015 09:40:26 +0000 (12:40 +0300)]
be_openssl: introduce set_open_callbacks_auto()

This will split cases when we need to extract fd (cases when we have fd==-1
passed to set_open_callbacks()), and cases when we mustn't have to do this --
SET_FD via be_openssl_ctrl().

9 years agobe_openssl: get rid off hackish "fd_is_set", to fix some corner cases
Azat Khuzhin [Sat, 22 Aug 2015 18:38:18 +0000 (21:38 +0300)]
be_openssl: get rid off hackish "fd_is_set", to fix some corner cases

This patch is a cleanup and a bug fix, it drops ```fd_is_set``` flag, and
replace it with some checks to event_initialized(), and now we will not call
event_assign() on already added event, plus we will delete event when we really
have to (this patch fixes the case when server is down, IOW before this patch
we will not call event_del() because ```fd_is_set``` was reset to 0) and this
will fix some issues with retries in http layer for ssl.

Reported-in: #258
Fixes: regress ssl/bufferevent_socketpair_timeout
Fixes: regress ssl/bufferevent_socketpair_timeout_freed_fd
9 years agoMerge branch 'test-regress-be-openssl-v2'
Azat Khuzhin [Wed, 2 Sep 2015 16:18:08 +0000 (19:18 +0300)]
Merge branch 'test-regress-be-openssl-v2'

This patchset is a bunch of regression tests for bufferevent openssl layer,
some of them already show some bugs, that bugs will be fixed in the next
patches.

* test-regress-be-openssl-v2:
  test/regress_ssl: check events fd/pending after timeout triggered
  test/regress_ssl: cover case when server didn't up (failed with timeout)
  test/regress_ssl: covert that we can't change fd with underlying
  test/regress_ssl: cover that events (read/write) at finish not pending
  test/regress_ssl: cover fd manipulations
  test/regress_ssl: convert open_ssl_bufevs() to mask
  test/regress_ssl: convert client/server to mask too
  test/regress_ssl: cover "allow_dirty_shutdown"
  test/regress_ssl: convert regress_bufferevent_openssl() to bitmask

9 years agotest/regress_ssl: check events fd/pending after timeout triggered
Azat Khuzhin [Wed, 2 Sep 2015 14:49:41 +0000 (17:49 +0300)]
test/regress_ssl: check events fd/pending after timeout triggered

In this case client can't connect to server, and this bring to the front some
bugs with assigning on already added events (because of ```fd_is_set``` stuff),
for more info see #258, since this is the reproducible for it.

9 years agotest/regress_ssl: cover case when server didn't up (failed with timeout)
Azat Khuzhin [Wed, 2 Sep 2015 14:36:20 +0000 (17:36 +0300)]
test/regress_ssl: cover case when server didn't up (failed with timeout)

9 years agotest/regress_ssl: covert that we can't change fd with underlying
Azat Khuzhin [Wed, 2 Sep 2015 14:17:43 +0000 (17:17 +0300)]
test/regress_ssl: covert that we can't change fd with underlying

9 years agotest/regress_ssl: cover that events (read/write) at finish not pending
Azat Khuzhin [Wed, 2 Sep 2015 14:06:51 +0000 (17:06 +0300)]
test/regress_ssl: cover that events (read/write) at finish not pending

9 years agotest/regress_ssl: cover fd manipulations
Azat Khuzhin [Wed, 2 Sep 2015 09:35:51 +0000 (12:35 +0300)]
test/regress_ssl: cover fd manipulations

9 years agotest/regress_ssl: convert open_ssl_bufevs() to mask
Azat Khuzhin [Wed, 2 Sep 2015 09:31:15 +0000 (12:31 +0300)]
test/regress_ssl: convert open_ssl_bufevs() to mask

9 years agotest/regress_ssl: convert client/server to mask too
Azat Khuzhin [Wed, 2 Sep 2015 09:26:40 +0000 (12:26 +0300)]
test/regress_ssl: convert client/server to mask too

9 years agotest/regress_ssl: cover "allow_dirty_shutdown"
Azat Khuzhin [Wed, 2 Sep 2015 08:34:13 +0000 (11:34 +0300)]
test/regress_ssl: cover "allow_dirty_shutdown"

9 years agotest/regress_ssl: convert regress_bufferevent_openssl() to bitmask
Azat Khuzhin [Wed, 2 Sep 2015 08:22:43 +0000 (11:22 +0300)]
test/regress_ssl: convert regress_bufferevent_openssl() to bitmask

9 years agoTest against SO_REUSEADDR (along with _WIN32).
Ed Schouten [Tue, 25 Aug 2015 13:29:37 +0000 (15:29 +0200)]
Test against SO_REUSEADDR (along with _WIN32).

This makes the code build on other systems that also don't have
SO_REUSEADDR without requiring special code.

[ azat: partially revert WIN32 check since SO_REUSEADDR on win32 differs from
unix semantics. ]

Closes #275

9 years agotests/regress_ssl: drop duplicated assert
Azat Khuzhin [Tue, 25 Aug 2015 14:01:42 +0000 (17:01 +0300)]
tests/regress_ssl: drop duplicated assert

9 years agoAlways define missing TAILQ functions from sys/queue.h
Christopher Wiley [Fri, 24 Jul 2015 15:42:06 +0000 (08:42 -0700)]
Always define missing TAILQ functions from sys/queue.h

On both Android and Ubuntu machines, TAILQ_END is not defined.  This
header also does not seem to be part of standard BSD sys/queue.h

Fix this by always defining missing TAILQ_ macros rather than
conditioning on a particular macro.

Fixes #267

9 years agoDon't use BSD u_* types.
Ed Schouten [Tue, 25 Aug 2015 13:24:39 +0000 (15:24 +0200)]
Don't use BSD u_* types.

These types are not part of POSIX. As we only use them in a small number
of places, we'd better replace them by C standard types. This makes a
larger part of the code build for CloudABI.

9 years agoRemove BSD-ism: TIMEVAL_TO_TIMESPEC().
Ed Schouten [Tue, 25 Aug 2015 13:32:25 +0000 (15:32 +0200)]
Remove BSD-ism: TIMEVAL_TO_TIMESPEC().

Systems like CloudABI implement kqueue() but do not provide the
BSD-specific TIMEVAL_TO_TIMESPEC() macro. Change the code to perform
this manually, as it is not hard to do this conversion.

9 years agobe: include all variations of headers for sockaddr_in6 struct
Azat Khuzhin [Wed, 19 Aug 2015 20:27:51 +0000 (23:27 +0300)]
be: include all variations of headers for sockaddr_in6 struct

Fixes: c42bc6b279fd7cd4bc9b04c86a12e2ec5512cce1 ("be: fix sockaddr_in6 type
definition for win32")
Fixes: e04555155816306f23829a15b747664a57330c28 ("Merge branch
'reuse-conn_address-on-retry-v11'")
CI: https://ci.appveyor.com/project/nmathewson/libevent/build/2.1.5.109
Tested: manually

9 years agohttp: eliminate warning about "socklen" in evhttp_connection_connect_()
Azat Khuzhin [Wed, 19 Aug 2015 20:00:49 +0000 (23:00 +0300)]
http: eliminate warning about "socklen" in evhttp_connection_connect_()

9 years agobe: fix sockaddr_in6 type definition for win32
Azat Khuzhin [Wed, 19 Aug 2015 19:52:22 +0000 (22:52 +0300)]
be: fix sockaddr_in6 type definition for win32

bufferevent-internal.h:217:23: error: field 'in6' has incomplete type
   struct sockaddr_in6 in6;
                       ^
CI: https://ci.appveyor.com/project/nmathewson/libevent/build/2.1.5.108

9 years agosample/https-client: don't try to free uninitialized SSL
Azat Khuzhin [Wed, 19 Aug 2015 10:22:49 +0000 (13:22 +0300)]
sample/https-client: don't try to free uninitialized SSL

sample/https-client.c:459:3: warning: ‘ssl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   SSL_free(ssl);

9 years agosample/https-client: graceful exit with freeing memory (to make valgrind happy)
Azat Khuzhin [Wed, 19 Aug 2015 10:19:41 +0000 (13:19 +0300)]
sample/https-client: graceful exit with freeing memory (to make valgrind happy)

9 years agohttps-client: correctly handle URLs with no path (like "https://host:port")
Andrey Skriabin [Thu, 2 Apr 2015 17:42:54 +0000 (20:42 +0300)]
https-client: correctly handle URLs with no path (like "https://host:port")

path == NULL check removed

Fixes: #233
Fixes: #234
9 years agosample/http-connect: don't use assert() to make it work with NDEBUG
Azat Khuzhin [Tue, 18 Aug 2015 18:57:28 +0000 (21:57 +0300)]
sample/http-connect: don't use assert() to make it work with NDEBUG

Otherwise it will not work for cmake release target type.

9 years agotest/regress_http: initialize "dns_base" to avoid reading trash
Azat Khuzhin [Tue, 18 Aug 2015 18:30:48 +0000 (21:30 +0300)]
test/regress_http: initialize "dns_base" to avoid reading trash

Even though it is very unlikely, but it will better to fix this.

9 years agosample/http-connect: made it compatible with C90
Azat Khuzhin [Tue, 18 Aug 2015 18:29:03 +0000 (21:29 +0300)]
sample/http-connect: made it compatible with C90

9 years agoMerge branch 'reuse-conn_address-on-retry-v11'
Azat Khuzhin [Tue, 18 Aug 2015 18:19:11 +0000 (21:19 +0300)]
Merge branch 'reuse-conn_address-on-retry-v11'

There is regression tests and also this code worked/tested during crawling a
huge number of pages (billions).

* reuse-conn_address-on-retry-v11:
  be_sock: bufferevent_socket_set_conn_address(): assert instead of silent no-op
  http: reuse connected address only with EVHTTP_CON_REUSE_CONNECTED_ADDR
  be_sock: sanity check in bufferevent_socket_set_conn_address()
  be: replace sockaddr_storage with sockaddr_in6 for conn_address
  be: we don't need to use getpeername() we we have conn_address
  be: replace conn_address by full struct instead of pointer
  test/http: cover retrying with saved conn_address by shutting down dns server
  http: use IP address that we got before (if any) during retrying
  bufferevent: move conn_address out from http into bufferevent
  be: make @sa const for bufferevent_socket_connect()
  util: make @sa const for evutil_socket_connect_()

9 years agobe_sock: bufferevent_socket_set_conn_address(): assert instead of silent no-op
Azat Khuzhin [Tue, 18 Aug 2015 17:41:16 +0000 (20:41 +0300)]
be_sock: bufferevent_socket_set_conn_address(): assert instead of silent no-op

9 years agohttp: reuse connected address only with EVHTTP_CON_REUSE_CONNECTED_ADDR
Azat Khuzhin [Thu, 1 Jan 2015 03:27:31 +0000 (06:27 +0300)]
http: reuse connected address only with EVHTTP_CON_REUSE_CONNECTED_ADDR

9 years agobe_sock: sanity check in bufferevent_socket_set_conn_address()
Azat Khuzhin [Tue, 2 Dec 2014 11:31:03 +0000 (14:31 +0300)]
be_sock: sanity check in bufferevent_socket_set_conn_address()

9 years agobe: replace sockaddr_storage with sockaddr_in6 for conn_address
Azat Khuzhin [Tue, 2 Dec 2014 11:24:19 +0000 (14:24 +0300)]
be: replace sockaddr_storage with sockaddr_in6 for conn_address

We need only ipv6/ipv4 for connect in bufferevent, and since
sockaddr_storage is pretty big (128 bytes) it will be better to use
sockaddr_in6 here (it will fit ipv4 too).

9 years agobe: we don't need to use getpeername() we we have conn_address
Azat Khuzhin [Sat, 15 Nov 2014 21:30:11 +0000 (00:30 +0300)]
be: we don't need to use getpeername() we we have conn_address

Since getpeername() could fail.

9 years agobe: replace conn_address by full struct instead of pointer
Azat Khuzhin [Sat, 15 Nov 2014 21:29:19 +0000 (00:29 +0300)]
be: replace conn_address by full struct instead of pointer

9 years agotest/http: cover retrying with saved conn_address by shutting down dns server
Azat Khuzhin [Sat, 15 Nov 2014 17:35:40 +0000 (20:35 +0300)]
test/http: cover retrying with saved conn_address by shutting down dns server

9 years agohttp: use IP address that we got before (if any) during retrying
Azat Khuzhin [Wed, 12 Nov 2014 17:23:46 +0000 (20:23 +0300)]
http: use IP address that we got before (if any) during retrying

Before this patch every time we are retrying our request we resolve
domain, but we could optimize this (since UDP is slow) by using cached
conn_address value, so do this.

9 years agobufferevent: move conn_address out from http into bufferevent
Azat Khuzhin [Sat, 15 Nov 2014 18:46:11 +0000 (21:46 +0300)]
bufferevent: move conn_address out from http into bufferevent

In http the only case when when we could store it is when we already
connected, *but* if we are doing request using domain name, then we need
to do request to nameserver to get IP address, and this is handled by
bufferevent.
So when we have IP address (from nameserver) and don't have connection
to this IP address, we could already cache it to avoid extra DNS
requests (since UDP is slow), and we can't do this from http layer, only
from bufferevent.

9 years agobe: make @sa const for bufferevent_socket_connect()
Azat Khuzhin [Tue, 2 Dec 2014 12:05:59 +0000 (15:05 +0300)]
be: make @sa const for bufferevent_socket_connect()

9 years agoutil: make @sa const for evutil_socket_connect_()
Azat Khuzhin [Tue, 2 Dec 2014 12:05:36 +0000 (15:05 +0300)]
util: make @sa const for evutil_socket_connect_()

9 years agosample: add HTTP CONNECT tunnelling example using libevent http layer
Azat Khuzhin [Tue, 18 Aug 2015 09:18:31 +0000 (12:18 +0300)]
sample: add HTTP CONNECT tunnelling example using libevent http layer

9 years agohttp: introduce evhttp_request_free_() helper
Azat Khuzhin [Tue, 18 Aug 2015 00:03:51 +0000 (03:03 +0300)]
http: introduce evhttp_request_free_() helper

9 years agohttp: introduce evhttp_is_request_connection_close() helper
Azat Khuzhin [Fri, 24 Apr 2015 16:04:51 +0000 (19:04 +0300)]
http: introduce evhttp_is_request_connection_close() helper

9 years agoUpdated gitignore
Mark Ellzey [Mon, 22 Jun 2015 02:05:21 +0000 (22:05 -0400)]
Updated gitignore

9 years agoMerge pull request #190 from JohnOhl/evhttp-post-fix
Mark Ellzey [Wed, 17 Jun 2015 15:24:52 +0000 (08:24 -0700)]
Merge pull request #190 from JohnOhl/evhttp-post-fix

evhttp: Fix failure to send all output data for POST/PUT requests

9 years agoUpdate dns-example.
Mark Ellzey [Wed, 17 Jun 2015 15:05:53 +0000 (08:05 -0700)]
Update dns-example.

There's somebody out there who is going to have a compiler from 1986 who will complain. Better to fix c99 now.

9 years agoMerge pull request #183 from azat/dns-example
Mark Ellzey [Wed, 17 Jun 2015 15:00:19 +0000 (08:00 -0700)]
Merge pull request #183 from azat/dns-example

Some improvements for dns-example

9 years agoMerge pull request #254 from zeliard/master
Mark Ellzey [Sun, 7 Jun 2015 16:39:24 +0000 (09:39 -0700)]
Merge pull request #254 from zeliard/master

Fix bench_httpclient to support win32

9 years agoUpdate bench_httpclient.c
Seungmo Koo [Sun, 7 Jun 2015 06:51:15 +0000 (15:51 +0900)]
Update bench_httpclient.c

*fixed: socket_geterror instead of WSAGetLastError

9 years agoMerge pull request #253 from ellzey/master
Mark Ellzey [Sat, 6 Jun 2015 09:39:29 +0000 (02:39 -0700)]
Merge pull request #253 from ellzey/master

Set correct socklen for PF_INET6 sockaddr len

9 years ago*fix: bench_httpclient to support win32
zeliard [Fri, 5 Jun 2015 07:39:26 +0000 (16:39 +0900)]
*fix: bench_httpclient to support win32

9 years agoSet correct socklen for PF_INET6 sockaddr len
Mark Ellzey [Mon, 1 Jun 2015 13:55:24 +0000 (06:55 -0700)]
Set correct socklen for PF_INET6 sockaddr len

Reported and patched by Pankaj Sharma

9 years agoMerge pull request #251 from ellzey/21_err_on_thread_init_ordering
Mark Ellzey [Fri, 29 May 2015 13:47:24 +0000 (06:47 -0700)]
Merge pull request #251 from ellzey/21_err_on_thread_init_ordering

Debug mode option to error on evthread init AFTER other event calls.

9 years agoDebug mode option to error on evthread init AFTER other event calls.
Mark Ellzey [Fri, 15 May 2015 09:58:14 +0000 (02:58 -0700)]
Debug mode option to error on evthread init AFTER other event calls.

- A handy event_enable_debug_mode() feature which will error and abort the
  application if any thread-aware libevent functions are called BEFORE the
  evthread API has been initialized (manually, or through
  evthread_use_windows_threads() / evthread_use_pthreads()

- This is done by setting the global debug variable
  'event_debug_created_threadable_ctx_' whenever the following functions
  are called:

     evthreadimpl_lock_alloc_()
     evthreadimpl_cond_alloc_()
     event_base_new_with_config() <- this checks to see if the thread
                                     callbacks are enabled first, so we
                                     have to manually set the variable.

- Example:

int main(int argc, char ** argv) {
    struct event_base * base;

    event_enable_debug_mode();

    base = event_base_new();

    evthread_use_pthreads();

    return 0;
}

When executed, the program will throw an error and exit:

[err] evthread initialization must be called BEFORE anything else!

9 years agoMerge pull request #245 from ellzey/21_size_and_misc_fixes
Mark Ellzey [Wed, 13 May 2015 05:11:08 +0000 (01:11 -0400)]
Merge pull request #245 from ellzey/21_size_and_misc_fixes

Fix garbage value in socketpair util function, stdint?

9 years agoMerge pull request #239 from ellzey/issue237
Mark Ellzey [Wed, 13 May 2015 05:10:42 +0000 (01:10 -0400)]
Merge pull request #239 from ellzey/issue237

Call underlying bev ctrl SET_FD on filtered bufferevents

9 years agoUpdate README.md
Mark Ellzey [Wed, 13 May 2015 04:52:40 +0000 (00:52 -0400)]
Update README.md

9 years agoUpdate README.md
Mark Ellzey [Wed, 13 May 2015 04:51:07 +0000 (00:51 -0400)]
Update README.md

9 years agoUpdate README.md
Mark Ellzey [Wed, 13 May 2015 04:49:08 +0000 (00:49 -0400)]
Update README.md

9 years agoUpdate travis config for status updates
Mark Ellzey [Tue, 12 May 2015 19:43:03 +0000 (15:43 -0400)]
Update travis config for status updates

9 years agoUpdate README.md
Mark Ellzey [Tue, 12 May 2015 19:33:26 +0000 (15:33 -0400)]
Update README.md

9 years agoUse autotools for appveyor until cmake is fixed.
Mark Ellzey [Tue, 12 May 2015 04:27:01 +0000 (00:27 -0400)]
Use autotools for appveyor until cmake is fixed.

9 years agoCommented out a WIN32 threading / timing test for now
Mark Ellzey [Tue, 12 May 2015 02:53:05 +0000 (22:53 -0400)]
Commented out a WIN32 threading / timing test for now

- seems as if windows has some time scale issues which I am looking
  into. For now I am commenting out the regression test until it is
  fixed.

9 years agoMerge branch 'master' into 21_size_and_misc_fixes
Mark Ellzey [Tue, 12 May 2015 02:18:54 +0000 (22:18 -0400)]
Merge branch 'master' into 21_size_and_misc_fixes

9 years agoMerge pull request #241 from ellzey/21_fix_appveyor_ssl_link
Mark Ellzey [Mon, 11 May 2015 20:27:15 +0000 (16:27 -0400)]
Merge pull request #241 from ellzey/21_fix_appveyor_ssl_link

Fix download link for appveyor SSL

9 years agoFix the link for appveyor OpenSSL installer (WIN32)
Mark Ellzey [Mon, 11 May 2015 16:47:40 +0000 (12:47 -0400)]
Fix the link for appveyor OpenSSL installer (WIN32)

* change and move the openssl self installer off to a site we own
   - the old link was 404, probably due to being replaced with a newer
     non-vuln version. But since we are only using this installer to
     auto-build with on appveyor (not as a release), then having a file
     we don't change and own seems to be a better solution.
* reduce verbosity

9 years agoMerge branch 'master' into issue237
Mark Ellzey [Mon, 11 May 2015 16:34:30 +0000 (12:34 -0400)]
Merge branch 'master' into issue237

9 years agoFix garbage value in socketpair util function, stdint?
Mark Ellzey [Mon, 11 May 2015 16:06:01 +0000 (12:06 -0400)]
Fix garbage value in socketpair util function, stdint?

* Fixed an issue with evutil_ersatz_socketpair_, listen_addr could all
  be compared against with agarbage values. So just memset it before
  using it anywhere.

* Nick might punch me in the face, but if we have stdint.h; (as in
  EVENT__HAVE_STDINT_H is defined), might as well use those instead of
  the manual [U]INT[X}_MAX/MIN muck in there now.

9 years agoMerge pull request #242 from ellzey/pullRequest118
Mark Ellzey [Sat, 9 May 2015 06:44:13 +0000 (02:44 -0400)]
Merge pull request #242 from ellzey/pullRequest118

expose bufferevent_incref/decref (with fewer modifications)

9 years agoexpose bufferevent_incref/decref (with fewer modifications)
Mark Ellzey [Wed, 6 May 2015 21:56:31 +0000 (14:56 -0700)]
expose bufferevent_incref/decref (with fewer modifications)

9 years agoCall underlying bev ctrl SET_FD on filtered bufferevents
Mark Ellzey [Tue, 5 May 2015 17:37:00 +0000 (10:37 -0700)]
Call underlying bev ctrl SET_FD on filtered bufferevents

If a bufferevent_filter is set on an underlying bufferevent which has
ctrl functions, bufferevent_filter needs to handle this.

For now I have added just BEV_CTRL_SET_FD, since this is needed for
bufferevent_sock to assign file descriptors to the proper
bufferevent_read/write callbacks.

A good example of the problem can be found in issue #237
https://github.com/libevent/libevent/issues/237

9 years agoFix potential fd leak in listener_read_cb()
Mark Ellzey [Tue, 28 Apr 2015 02:43:04 +0000 (22:43 -0400)]
Fix potential fd leak in listener_read_cb()

As pointed out by harlan_ in #libevent after running a coverity sweep.
If the listener is free'd, 'new_fd' is never closed.

9 years agotab
Greg Hazel [Wed, 25 Mar 2015 00:45:52 +0000 (17:45 -0700)]
tab

9 years agofix the return value of event_deferred_cb_schedule_
Greg Hazel [Wed, 25 Mar 2015 00:29:40 +0000 (17:29 -0700)]
fix the return value of event_deferred_cb_schedule_

9 years agoMerge pull request #220 from miniupnp/fix_warnings
Nick Mathewson [Tue, 17 Feb 2015 17:37:30 +0000 (12:37 -0500)]
Merge pull request #220 from miniupnp/fix_warnings

Fix warnings

9 years agoFix mixed declarations and code (forbidden by ISO C90)
Thomas Bernard [Mon, 16 Feb 2015 22:42:54 +0000 (23:42 +0100)]
Fix mixed declarations and code (forbidden by ISO C90)

9 years agoFix "function declaration isn’t a prototype"
Thomas Bernard [Mon, 16 Feb 2015 22:41:53 +0000 (23:41 +0100)]
Fix "function declaration isn’t a prototype"

add "void" to argument list

9 years agoMerge pull request #214 from JoakimSoderberg/appveyor
Nick Mathewson [Thu, 5 Feb 2015 20:24:55 +0000 (15:24 -0500)]
Merge pull request #214 from JoakimSoderberg/appveyor

Forgot to install OpenSSL for appveyor

9 years agoForgot to install OpenSSL for appveyor
Joakim Söderberg [Thu, 5 Feb 2015 19:21:04 +0000 (20:21 +0100)]
Forgot to install OpenSSL for appveyor