aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/http_connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/http_connection.c')
-rw-r--r--src/libutil/http_connection.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libutil/http_connection.c b/src/libutil/http_connection.c
index 31e8a3c1e..0762fde81 100644
--- a/src/libutil/http_connection.c
+++ b/src/libutil/http_connection.c
@@ -374,7 +374,8 @@ rspamd_http_on_headers_complete (http_parser * parser)
*
* Hence, we skip body setup here
*/
- if (parser->content_length != ULLONG_MAX && parser->content_length != 0) {
+ if (parser->content_length != ULLONG_MAX && parser->content_length != 0 &&
+ msg->method != HTTP_HEAD) {
if (conn->max_size > 0 &&
parser->content_length > conn->max_size) {
/* Too large message */
@@ -845,6 +846,8 @@ rspamd_http_write_helper (struct rspamd_http_connection *conn)
return;
call_finish_handler:
+ rspamd_ev_watcher_stop (priv->ctx->event_loop, &priv->ev);
+
if ((conn->opts & RSPAMD_HTTP_CLIENT_SIMPLE) == 0) {
rspamd_http_connection_ref (conn);
conn->finished = TRUE;
@@ -954,6 +957,14 @@ rspamd_http_event_handler (int fd, short what, gpointer ud)
err = g_error_new (HTTP_ERROR, 400,
"Encryption required");
}
+ else if (priv->parser.http_errno == HPE_CLOSED_CONNECTION) {
+ msg_err ("got garbage after end of the message, ignore it");
+
+ REF_RELEASE (pbuf);
+ rspamd_http_connection_unref (conn);
+
+ return;
+ }
else {
err = g_error_new (HTTP_ERROR, 500 + priv->parser.http_errno,
"HTTP parser error: %s",