From aaf5dfba5517cdae8d86b1f8b42b2c10bcab21d3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 17 Feb 2017 16:47:58 +0000 Subject: [PATCH] [Fix] Deal with EOF properly --- src/libutil/http.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) 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) { -- 2.39.5