From: Vsevolod Stakhov Date: Sun, 5 Feb 2017 14:24:52 +0000 (+0100) Subject: [Minor] Deal with HTTP requests without content length X-Git-Tag: 1.5.0~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e2bcb60a3225d9136f8143be923cf6fb3d29711;p=thirdparty%2Frspamd.git [Minor] Deal with HTTP requests without content length --- diff --git a/src/libutil/http.c b/src/libutil/http.c index 47c1836d3f..649cebeb22 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1197,17 +1197,21 @@ rspamd_http_event_handler (int fd, short what, gpointer ud) } } else if (r == 0) { - 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); + /* 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); - return; + return; + } } else { if (!priv->ssl) {