]> source.dussan.org Git - rspamd.git/commitdiff
Fix encryption of messages with no body.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 1 Feb 2015 22:38:36 +0000 (22:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 1 Feb 2015 22:38:36 +0000 (22:38 +0000)
src/libutil/http.c

index 4be5a2a66271fbde9c68e661984c8074fefe8baa..47de412233ea06adf5894ff0063f3d4fed40d0af 100644 (file)
@@ -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;