diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-05 15:24:52 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-05 15:24:52 +0100 |
commit | 8e2bcb60a3225d9136f8143be923cf6fb3d29711 (patch) | |
tree | 2660e82559d78ddb239ddfed91f952403d40b261 /src | |
parent | 360e573bdf5f87d23c584448c12f2973e4cc2754 (diff) | |
download | rspamd-8e2bcb60a3225d9136f8143be923cf6fb3d29711.tar.gz rspamd-8e2bcb60a3225d9136f8143be923cf6fb3d29711.zip |
[Minor] Deal with HTTP requests without content length
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/http.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c index 47c1836d3..649cebeb2 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) { |