fix handling of close_notify (ssl) in http with openssl bufferevents

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
This commit is contained in:
Azat Khuzhin 2017-09-13 21:39:32 +03:00
parent 8b0aa7b36a
commit da3f2ba22a

2
http.c
View File

@ -1309,6 +1309,8 @@ evhttp_connection_reset_(struct evhttp_connection *evcon)
struct evbuffer *tmp; struct evbuffer *tmp;
int err; int err;
bufferevent_setcb(evcon->bufev, NULL, NULL, NULL, NULL);
/* XXXX This is not actually an optimal fix. Instead we ought to have /* 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 an API for "stop connecting", or use bufferevent_setfd to turn off
connecting. But for Libevent 2.0, this seems like a minimal change connecting. But for Libevent 2.0, this seems like a minimal change