commit 1e99377: [Minor] Allow to output new body in rspamc

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jul 22 11:56:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-07-22 12:10:27 +0100
URL: https://github.com/rspamd/rspamd/commit/1e9937774f97d81bf0158491d2ef07387f2868aa

[Minor] Allow to output new body in rspamc

---
 src/client/rspamc.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index e118688d0..abea78da7 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -672,6 +672,8 @@ add_options (GQueue *opts)
 		ADD_CLIENT_FLAG (flagbuf, "profile");
 	}
 
+	ADD_CLIENT_FLAG (flagbuf, "body_block");
+
 	if (skip_images) {
 		ADD_CLIENT_HEADER (opts, "Skip-Images", "true");
 	}
@@ -1547,7 +1549,16 @@ rspamc_client_cb (struct rspamd_client_connection *conn,
 	else {
 
 		if (cmd->cmd == RSPAMC_COMMAND_SYMBOLS && mime_output && input) {
-			rspamc_mime_output (out, result, input, diff, err);
+			if (body) {
+				GString tmp;
+
+				tmp.str = (char *)body;
+				tmp.len = bodylen;
+				rspamc_mime_output (out, result, &tmp, diff, err);
+			}
+			else {
+				rspamc_mime_output (out, result, input, diff, err);
+			}
 		}
 		else {
 			if (cmd->need_input) {
@@ -1596,6 +1607,11 @@ rspamc_client_cb (struct rspamd_client_connection *conn,
 					cmd->command_output_func (out, result);
 				}
 
+				if (body) {
+					rspamd_fprintf (out, "\nNew body:\n%*s\n", (int)bodylen,
+							body);
+				}
+
 				ucl_object_unref (result);
 			}
 			else if (err != NULL) {


More information about the Commits mailing list