http: do not call deferred readcb if readcb is not set

Otherwise evhttp_read_cb can be called with invalid connection state:
    http/read_on_write_error: [forking] [msg] libevent using: kqueue
      FAIL ../test/regress_http.c:4079: assert(req)
      FAIL ../test/regress_http.c:4087: assert(req)[err] evhttp_read_cb: illegal connection state 0
This commit is contained in:
Azat Khuzhin 2019-01-27 15:16:39 +03:00
parent 5613bfb8dc
commit d3dcb5aca9
No known key found for this signature in database
GPG Key ID: B86086848EF8686D

4
http.c
View File

@ -1171,7 +1171,9 @@ static void
evhttp_deferred_read_cb(struct event_callback *cb, void *data) evhttp_deferred_read_cb(struct event_callback *cb, void *data)
{ {
struct evhttp_connection *evcon = data; struct evhttp_connection *evcon = data;
evhttp_read_cb(evcon->bufev, evcon); struct bufferevent *bev = evcon->bufev;
if (bev->readcb)
(bev->readcb)(evcon->bufev, evcon);
} }
static void static void