aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-10-25 21:20:49 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-10-25 21:20:49 +0400
commit2e15cacc80101d91108be8aaa4ea722f31d22d6b (patch)
tree1bed5d6b92159cf3f5421307b7c7ae096475cc29 /src/protocol.c
parent88f4ea9a5b1e55169fa23ad2b7ffe7985fb8c3ed (diff)
downloadrspamd-2e15cacc80101d91108be8aaa4ea722f31d22d6b.tar.gz
rspamd-2e15cacc80101d91108be8aaa4ea722f31d22d6b.zip
Do not try to validate empty headers.
Write symbols to log in case of HTTP/Json output.
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 8d72420a1..73f8b9de6 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -898,6 +898,8 @@ metric_symbols_callback_json (gpointer key, gpointer value, void *user_data)
}
cd->symbols_offset += rspamd_snprintf (cd->symbols_buf + cd->symbols_offset, cd->symbols_size - cd->symbols_offset,
" },");
+ cd->log_offset += rspamd_snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset,
+ "%s,", (gchar *)key);
}
/*
* Print a single symbol using json protocol
@@ -917,6 +919,10 @@ show_metric_symbols_json (struct metric_result *metric_res, struct metric_callba
g_hash_table_foreach (h, metric_symbols_callback_json, cd);
g_hash_table_unref (h);
if (cd->alive) {
+ /* Remove last , from log buf */
+ if (cd->log_buf[cd->log_offset - 1] == ',') {
+ cd->log_buf[--cd->log_offset] = '\0';
+ }
/* Remove last ',' symbol */
if (cd->symbols_buf[cd->symbols_offset - 1] == ',') {
cd->symbols_buf[--cd->symbols_offset] = '\0';