From 826f1134b879cafdb73fed6c4ac1174e3022e410 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Tue, 26 Sep 2017 19:23:29 +0300 Subject: [PATCH] Do not crash when evhttp_send_reply_start() is called after a timeout. This fixes the crash reported in issue #509. The "would be nice" items discussed in #509 can be addressed separately. (cherry picked from commit 99d0a952dada771b91acf63f5208b994e80a2986) --- http.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http.c b/http.c index 8aa2b120..d6dfeea1 100644 --- a/http.c +++ b/http.c @@ -2822,6 +2822,10 @@ evhttp_send_reply_start(struct evhttp_request *req, int code, const char *reason) { evhttp_response_code_(req, code, reason); + + if (req->evcon == NULL) + return; + if (evhttp_find_header(req->output_headers, "Content-Length") == NULL && REQ_VERSION_ATLEAST(req, 1, 1) && evhttp_response_needs_body(req)) {