From: Vsevolod Stakhov Date: Tue, 3 Mar 2015 00:17:27 +0000 (+0000) Subject: Add method to get all raw headers in LUA. X-Git-Tag: 0.8.2~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=638765ecf306e98d34c63385a1e44249b67e1b5a;p=rspamd.git Add method to get all raw headers in LUA. --- diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 3c92c7336..178519b27 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -227,6 +227,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 @@ -452,6 +460,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), @@ -1162,6 +1171,21 @@ lua_task_get_header_raw (lua_State * L) return lua_task_get_header_common (L, FALSE, TRUE); } +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) {