diff --git a/http.c b/http.c index 8838e192..e17808ef 100644 --- a/http.c +++ b/http.c @@ -2066,6 +2066,11 @@ evhttp_send(struct evhttp_request *req, struct evbuffer *databuf) { struct evhttp_connection *evcon = req->evcon; + if (evcon == NULL) { + evhttp_request_free(req); + return; + } + EVUTIL_ASSERT(TAILQ_FIRST(&evcon->requests) == req); /* we expect no more calls form the user on this request */ diff --git a/include/event2/http.h b/include/event2/http.h index a56526e8..2c5ebf4c 100644 --- a/include/event2/http.h +++ b/include/event2/http.h @@ -374,7 +374,12 @@ void evhttp_request_own(struct evhttp_request *req); /** Returns 1 if the request is owned by the user */ int evhttp_request_is_owned(struct evhttp_request *req); -/** Returns the connection object associated with the request or NULL */ +/** + * Returns the connection object associated with the request or NULL + * + * The server needs to either free the request explicitly or call + * evhttp_send_reply_end(). + */ struct evhttp_connection *evhttp_request_get_connection(struct evhttp_request *req); void evhttp_connection_set_max_headers_size(struct evhttp_connection *evcon,