From: Vsevolod Stakhov Date: Tue, 12 Jun 2018 10:59:10 +0000 (+0100) Subject: [Fix] Fix potential race condition for a finished HTTP connections X-Git-Tag: 1.7.6~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b49e6ceb5c3ad19575bb692702598b544f2292bb;p=rspamd.git [Fix] Fix potential race condition for a finished HTTP connections --- diff --git a/src/libutil/http.c b/src/libutil/http.c index 03dbaa7bd..315598871 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1183,7 +1183,13 @@ rspamd_http_event_handler (int fd, short what, gpointer ud) http_errno_description (priv->parser.http_errno)); } - conn->error_handler (conn, err); + if (!conn->finished) { + conn->error_handler (conn, err); + } + else { + msg_err ("got error after HTTP request is finished: %e", err); + } + g_error_free (err); REF_RELEASE (pbuf); @@ -1234,7 +1240,14 @@ rspamd_http_event_handler (int fd, short what, gpointer ud) err = g_error_new (HTTP_ERROR, priv->parser.http_errno, "HTTP parser error: %s", http_errno_description (priv->parser.http_errno)); - conn->error_handler (conn, err); + + if (!conn->finished) { + conn->error_handler (conn, err); + } + else { + msg_err ("got error after HTTP request is finished: %e", err); + } + g_error_free (err); REF_RELEASE (pbuf);