From 57e4e612d326cf39ca4af2aca39fcffc48486a93 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 16 Mar 2015 16:58:48 +0000 Subject: [PATCH] Terminate connection if got EOF on HTTP. --- src/libutil/http.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/libutil/http.c b/src/libutil/http.c index ba759baf1..802aa9e7f 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -660,11 +660,6 @@ rspamd_http_on_message_complete (http_parser * parser) ret = conn->finish_handler (conn, priv->msg); conn->finished = TRUE; rspamd_http_connection_unref (conn); - - /* Disable reading if we have read an HTTP message */ - if (event_pending (&priv->ev, EV_READ, NULL)) { - event_del (&priv->ev); - } } return ret; @@ -799,25 +794,16 @@ rspamd_http_event_handler (int fd, short what, gpointer ud) return; } else if (r == 0) { - if (conn->finished) { - REF_RELEASE (pbuf); - rspamd_http_connection_unref (conn); - /* Double unref to avoid dangling connections */ - rspamd_http_connection_unref (conn); - return; - } - else { - err = g_error_new (HTTP_ERROR, - errno, - "IO read error: unexpected EOF"); - conn->error_handler (conn, err); - g_error_free (err); + 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); + REF_RELEASE (pbuf); + rspamd_http_connection_unref (conn); - return; - } + return; } else { buf->len = r; -- 2.39.5