aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-17 16:56:34 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-17 16:56:34 +0100
commit85808f5e8da889d9c9420094eb5f16b923be77eb (patch)
treeda26ddb9d7cfd158a8acb27ee8935eb0905954c6 /src/libserver/task.c
parent59b33944544ab47404bf72448bfc89ddc78991fe (diff)
downloadrspamd-85808f5e8da889d9c9420094eb5f16b923be77eb.tar.gz
rspamd-85808f5e8da889d9c9420094eb5f16b923be77eb.zip
Add support of custom request and reply headers.
Diffstat (limited to 'src/libserver/task.c')
-rw-r--r--src/libserver/task.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c
index d71e0412e..59f015f1b 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -41,6 +41,15 @@ rcpt_destruct (void *pointer)
}
}
+
+static void
+gstring_destruct (gpointer ptr)
+{
+ GString *s = (GString *)ptr;
+
+ g_string_free (s, TRUE);
+}
+
/*
* Create new task
*/
@@ -77,16 +86,26 @@ rspamd_task_new (struct rspamd_worker *worker)
(rspamd_mempool_destruct_t) rcpt_destruct, new_task);
new_task->results = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
rspamd_mempool_add_destructor (new_task->task_pool,
- (rspamd_mempool_destruct_t) g_hash_table_destroy,
+ (rspamd_mempool_destruct_t) g_hash_table_unref,
new_task->results);
new_task->re_cache = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
rspamd_mempool_add_destructor (new_task->task_pool,
- (rspamd_mempool_destruct_t) g_hash_table_destroy,
+ (rspamd_mempool_destruct_t) g_hash_table_unref,
new_task->re_cache);
new_task->raw_headers = g_hash_table_new (rspamd_strcase_hash,
rspamd_strcase_equal);
+ new_task->request_headers = g_hash_table_new_full ((GHashFunc)g_string_hash,
+ (GEqualFunc)g_string_equal, gstring_destruct, gstring_destruct);
+ rspamd_mempool_add_destructor (new_task->task_pool,
+ (rspamd_mempool_destruct_t) g_hash_table_unref,
+ new_task->request_headers);
+ new_task->reply_headers = g_hash_table_new_full ((GHashFunc)g_string_hash,
+ (GEqualFunc)g_string_equal, gstring_destruct, gstring_destruct);
+ rspamd_mempool_add_destructor (new_task->task_pool,
+ (rspamd_mempool_destruct_t) g_hash_table_unref,
+ new_task->reply_headers);
rspamd_mempool_add_destructor (new_task->task_pool,
- (rspamd_mempool_destruct_t) g_hash_table_destroy,
+ (rspamd_mempool_destruct_t) g_hash_table_unref,
new_task->raw_headers);
new_task->emails = g_tree_new (compare_email_func);
rspamd_mempool_add_destructor (new_task->task_pool,