aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-03 00:17:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-03 00:17:27 +0000
commit8dd71d47800da5e8794b96bff8b9f796c337e7b3 (patch)
tree5c2ceea3066846d40485dc63ac7718acec307fbe
parent885208be1467ecf4e61b6f516a9d98e867ee26c4 (diff)
downloadrspamd-8dd71d47800da5e8794b96bff8b9f796c337e7b3.tar.gz
rspamd-8dd71d47800da5e8794b96bff8b9f796c337e7b3.zip
Add method to get all raw headers in LUA.
-rw-r--r--src/lua/lua_task.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 98083f187..60dfb7cf7 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -222,6 +222,14 @@ function check_header_delimiter_tab(task, header_name)
end
*/
LUA_FUNCTION_DEF (task, get_header_full);
+
+/***
+ * @method task:get_raw_headers()
+ * Get all undecoded headers of a message as a string
+ * @reeturn {string} all raw headers for a message
+ */
+LUA_FUNCTION_DEF (task, get_raw_headers);
+
/***
* @method task:get_received_headers()
* Returns a list of tables of parsed received headers. A tables returned have
@@ -447,6 +455,7 @@ static const struct luaL_reg tasklib_m[] = {
LUA_INTERFACE_DEF (task, get_header),
LUA_INTERFACE_DEF (task, get_header_raw),
LUA_INTERFACE_DEF (task, get_header_full),
+ LUA_INTERFACE_DEF (task, get_raw_headers),
LUA_INTERFACE_DEF (task, get_received_headers),
LUA_INTERFACE_DEF (task, get_resolver),
LUA_INTERFACE_DEF (task, inc_dns_req),
@@ -1160,6 +1169,21 @@ lua_task_get_header_raw (lua_State * L)
}
static gint
+lua_task_get_raw_headers (lua_State *L)
+{
+ struct rspamd_task *task = lua_check_task (L, 1);
+
+ if (task) {
+ lua_pushstring (L, task->raw_headers_str);
+ }
+ else {
+ lua_pushnil (L);
+ }
+
+ return 1;
+}
+
+static gint
lua_task_get_received_headers (lua_State * L)
{
struct rspamd_task *task = lua_check_task (L, 1);