]> granicus.if.org Git - libevent/commitdiff
fix handling of close_notify (ssl) in http with openssl bufferevents
authorAzat Khuzhin <a3at.mail@gmail.com>
Wed, 13 Sep 2017 18:39:32 +0000 (21:39 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sat, 2 Feb 2019 12:13:53 +0000 (15:13 +0300)
Since it can arrive after we disabled events in that bufferevent and
reseted fd, hence evhttp_error_cb() could be called after
SSL_RECEIVED_SHUTDOWN.

Closes: #557
(cherry picked from commit da3f2ba22adcabaf7355a90d537b4928d0c168d2)

http.c

diff --git a/http.c b/http.c
index f5a2ef931a5f3b5ef605eae807a5cfbc490442ee..3983b3dd4f62c5028546074d5ef1fa31c7dbd996 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1309,6 +1309,8 @@ evhttp_connection_reset_(struct evhttp_connection *evcon)
        struct evbuffer *tmp;
        int err;
 
+       bufferevent_setcb(evcon->bufev, NULL, NULL, NULL, NULL);
+
        /* XXXX This is not actually an optimal fix.  Instead we ought to have
           an API for "stop connecting", or use bufferevent_setfd to turn off
           connecting.  But for Libevent 2.0, this seems like a minimal change