From: Vsevolod Stakhov Date: Sun, 1 Feb 2015 22:38:36 +0000 (+0000) Subject: Fix encryption of messages with no body. X-Git-Tag: 0.9.0~788 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=88f13a02d8b53132a0c49b0120d48f845d9ad3a2;p=rspamd.git Fix encryption of messages with no body. --- diff --git a/src/libutil/http.c b/src/libutil/http.c index 4be5a2a66..47de41223 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1047,7 +1047,7 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, encrypted = TRUE; } - if (encrypted) { + if (encrypted && msg->body != NULL) { priv->outlen += 2; bodylen += crypto_box_NONCEBYTES + crypto_box_ZEROBYTES; } @@ -1132,7 +1132,7 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, /* Now set up all iov */ priv->out[0].iov_base = buf->str; - if (!encrypted) { + if (!encrypted || msg->body == NULL) { priv->out[0].iov_len = buf->len; } else { @@ -1146,6 +1146,7 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, } i = 1; + /* XXX: encrypt headers */ LL_FOREACH (msg->headers, hdr) { priv->out[i].iov_base = hdr->name->str;