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)
This commit is contained in:
Andreas Gustafsson 2017-09-26 19:23:29 +03:00 committed by Azat Khuzhin
parent 5b40744d15
commit 826f1134b8
No known key found for this signature in database
GPG Key ID: B86086848EF8686D

4
http.c
View File

@ -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)) {