diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-28 18:30:46 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-28 18:30:46 +0100 |
commit | 219ea71d582dd5cabacfaa3f0ace8284d8f99cd8 (patch) | |
tree | 7066db9f6e60addafaddf4a86eb54305de463bab | |
parent | df5991434583bceeb572499f85c89a74e8d325de (diff) | |
download | rspamd-219ea71d582dd5cabacfaa3f0ace8284d8f99cd8.tar.gz rspamd-219ea71d582dd5cabacfaa3f0ace8284d8f99cd8.zip |
Allow to specify classification headers in the options.
-rw-r--r-- | src/libserver/cfg_file.h | 2 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.c | 6 | ||||
-rw-r--r-- | src/libstat/stat_process.c | 11 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index b14690632..258290852 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -261,6 +261,8 @@ struct rspamd_config { gdouble upstream_revive_time; /**< revive timeout for upstreams */ guint32 min_word_len; /**< minimum length of the word to be considered */ + + GList *classify_headers; /**< list of headers using for statistics */ }; diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index b7821b7bb..3948ecdce 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -1313,6 +1313,12 @@ rspamd_rcl_config_init (void) rspamd_rcl_parse_struct_integer, G_STRUCT_OFFSET (struct rspamd_config, dns_io_per_server), RSPAMD_CL_FLAG_INT_32); + rspamd_rcl_add_default_handler (ssub, + "classify_headers", + rspamd_rcl_parse_struct_string_list, + G_STRUCT_OFFSET (struct rspamd_config, classify_headers), + 0); + /* New upstreams configuration */ ssub = rspamd_rcl_add_section (&sub->subsections, "upstream", NULL, diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 2c0cd8955..91d2e7b8d 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -152,10 +152,13 @@ rspamd_stat_tokenize_parts_metadata (struct rspamd_task *task, } } - rspamd_stat_tokenize_header (task, tok, "User-Agent", "UA:", ar); - rspamd_stat_tokenize_header (task, tok, "X-Mailer", "XM:", ar); - rspamd_stat_tokenize_header (task, tok, "Content-Type", "CT:", ar); - rspamd_stat_tokenize_header (task, tok, "X-MimeOLE", "XMOLE:", ar); + cur = g_list_first (task->cfg->classify_headers); + + while (cur) { + rspamd_stat_tokenize_header (task, tok, cur->data, "UA:", ar); + + cur = g_list_next (cur); + } tok->tokenizer->tokenize_func (tok, task->task_pool, |