diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-11 14:13:53 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-11 14:13:53 +0100 |
commit | d97f53a95530cb73f847a366210a29f5e1b58f61 (patch) | |
tree | 56f15649bdddc621a55be1f950c645c05b1d1865 | |
parent | 3b7a3f0a28b5edf3a844884b26184b989c7b7df5 (diff) | |
download | rspamd-d97f53a95530cb73f847a366210a29f5e1b58f61.tar.gz rspamd-d97f53a95530cb73f847a366210a29f5e1b58f61.zip |
[Fix] Another fix for legacy clients
-rw-r--r-- | src/libutil/http.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c index 93e946ffc..f2d1675c4 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1675,7 +1675,10 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, else { /* Legacy spamd reply */ if (msg->flags & RSPAMD_HTTP_FLAG_SPAMC) { - rspamd_printf_fstring (buf, "SPAMD/1.1 0 EX_OK\r\n"); + rspamd_printf_fstring (buf, "SPAMD/1.1 0 EX_OK\r\n" + "Content-length: %z\r\n" + "\r\n", + bodylen); } else { rspamd_printf_fstring (buf, "RSPAMD/1.3 0 EX_OK\r\n"); @@ -1929,14 +1932,17 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn peer_key = msg->peer_key; priv->wr_total = bodylen + 2; + hdrcount = 0; - HASH_ITER (hh, msg->headers, hdr, htmp) { - /* <name: value\r\n> */ - priv->wr_total += hdr->combined->len; - enclen += hdr->combined->len; - priv->outlen ++; - hdrcount ++; + if (msg->method < HTTP_SYMBOLS) { + HASH_ITER (hh, msg->headers, hdr, htmp) { + /* <name: value\r\n> */ + priv->wr_total += hdr->combined->len; + enclen += hdr->combined->len; + priv->outlen ++; + hdrcount ++; + } } /* Allocate iov */ @@ -2005,11 +2011,12 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn } else { i = 1; - HASH_ITER (hh, msg->headers, hdr, htmp) { - priv->out[i].iov_base = hdr->combined->str; - priv->out[i++].iov_len = hdr->combined->len; - } if (msg->method < HTTP_SYMBOLS) { + HASH_ITER (hh, msg->headers, hdr, htmp) { + priv->out[i].iov_base = hdr->combined->str; + priv->out[i++].iov_len = hdr->combined->len; + } + priv->out[i].iov_base = "\r\n"; priv->out[i++].iov_len = 2; } |