From: Vsevolod Stakhov Date: Fri, 17 Feb 2017 16:47:58 +0000 (+0000) Subject: [Fix] Deal with EOF properly X-Git-Tag: 1.5.0~88 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aaf5dfba5517cdae8d86b1f8b42b2c10bcab21d3;p=rspamd.git [Fix] Deal with EOF properly --- diff --git a/src/libutil/http.c b/src/libutil/http.c index df710ac42..b46009794 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1198,20 +1198,19 @@ rspamd_http_event_handler (int fd, short what, gpointer ud) } else if (r == 0) { /* We can still call http parser */ - if (http_parser_execute (&priv->parser, &priv->parser_cb, d, r) - != (size_t)r) { - if (!conn->finished) { - err = g_error_new (HTTP_ERROR, - errno, - "IO read error: unexpected EOF"); - conn->error_handler (conn, err); - g_error_free (err); - } - REF_RELEASE (pbuf); - rspamd_http_connection_unref (conn); + http_parser_execute (&priv->parser, &priv->parser_cb, d, r); - return; + if (!conn->finished) { + err = g_error_new (HTTP_ERROR, + errno, + "IO read error: unexpected EOF"); + conn->error_handler (conn, err); + g_error_free (err); } + REF_RELEASE (pbuf); + rspamd_http_connection_unref (conn); + + return; } else { if (!priv->ssl) {