diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-07 15:58:57 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-07 15:58:57 +0100 |
commit | 58fe582b5d21d10d365954759fcb4c436b557810 (patch) | |
tree | 2a89ae956ce033551e16fcd825709251ece8c9b0 /src/libserver/task.c | |
parent | 1a0025def020ebdcc88f85c5e4a364ce9219de79 (diff) | |
download | rspamd-58fe582b5d21d10d365954759fcb4c436b557810.tar.gz rspamd-58fe582b5d21d10d365954759fcb4c436b557810.zip |
Fix the code for updated strings in HTTP library.
Diffstat (limited to 'src/libserver/task.c')
-rw-r--r-- | src/libserver/task.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c index 6d0eca2a2..907260af2 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -71,15 +71,15 @@ rspamd_task_new (struct rspamd_worker *worker) 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 (rspamd_gstring_icase_hash, - rspamd_gstring_icase_equal, rspamd_gstring_free_hard, - rspamd_gstring_free_hard); + new_task->request_headers = g_hash_table_new_full (rspamd_ftok_icase_hash, + rspamd_ftok_icase_equal, rspamd_fstring_mapped_ftok_free, + rspamd_fstring_mapped_ftok_free); 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 (rspamd_gstring_icase_hash, - rspamd_gstring_icase_equal, rspamd_gstring_free_hard, - rspamd_gstring_free_hard); + new_task->reply_headers = g_hash_table_new_full (rspamd_ftok_icase_hash, + rspamd_ftok_icase_equal, rspamd_fstring_mapped_ftok_free, + rspamd_fstring_mapped_ftok_free); rspamd_mempool_add_destructor (new_task->task_pool, (rspamd_mempool_destruct_t) g_hash_table_unref, new_task->reply_headers); @@ -261,6 +261,7 @@ rspamd_task_load_message (struct rspamd_task *task, ucl_object_t *control_obj; gchar filepath[PATH_MAX], *fp; gint fd, flen; + rspamd_ftok_t srch, *tok; gpointer map; struct stat st; @@ -268,11 +269,19 @@ rspamd_task_load_message (struct rspamd_task *task, rspamd_protocol_handle_headers (task, msg); } - if (task->flags & RSPAMD_TASK_FLAG_FILE) { - g_assert (task->msg.len > 0); + srch.begin = "file"; + srch.len = 4; + tok = g_hash_table_lookup (task->request_headers, &srch); - r = rspamd_strlcpy (filepath, task->msg.begin, - MIN (sizeof (filepath), task->msg.len + 1)); + if (tok == NULL) { + srch.begin = "path"; + srch.len = 4; + tok = g_hash_table_lookup (task->request_headers, &srch); + } + + if (tok) { + r = rspamd_strlcpy (filepath, tok->begin, + MIN (sizeof (filepath), tok->len + 1)); rspamd_decode_url (filepath, filepath, r + 1); flen = strlen (filepath); |