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.9.0~571 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8dd71d47800da5e8794b96bff8b9f796c337e7b3;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 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), @@ -1159,6 +1168,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) {