diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-14 16:16:56 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-14 16:16:56 +0000 |
commit | 601e6403a2c8bcd9e73bb683cd26aa5d3a2c06b9 (patch) | |
tree | f86b6bc60758d6099a9f11e3f3c44501fd702f6a /src/lua/lua_util.c | |
parent | 568773df1dcf5ed043ca0c760eaf53f1705ceb34 (diff) | |
download | rspamd-601e6403a2c8bcd9e73bb683cd26aa5d3a2c06b9.tar.gz rspamd-601e6403a2c8bcd9e73bb683cd26aa5d3a2c06b9.zip |
[Minor] Allow lua_text in addition to strings
Diffstat (limited to 'src/lua/lua_util.c')
-rw-r--r-- | src/lua/lua_util.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c index 570a51be7..4dd944008 100644 --- a/src/lua/lua_util.c +++ b/src/lua/lua_util.c @@ -1366,11 +1366,12 @@ static gint lua_util_fold_header (lua_State *L) { LUA_TRACE_POINT; - const gchar *name, *value, *how, *stop_chars = NULL; + const gchar *how, *stop_chars = NULL; + struct rspamd_lua_text *name, *value; GString *folded; - name = luaL_checkstring (L, 1); - value = luaL_checkstring (L, 2); + name = lua_check_text_or_string (L, 1); + value = lua_check_text_or_string (L, 2); if (name && value) { @@ -1383,20 +1384,25 @@ lua_util_fold_header (lua_State *L) } if (strcmp (how, "cr") == 0) { - folded = rspamd_header_value_fold (name, value, 0, + folded = rspamd_header_value_fold (name->start, name->len, + value->start, value->len, + 0, RSPAMD_TASK_NEWLINES_CR, stop_chars); } else if (strcmp (how, "lf") == 0) { - folded = rspamd_header_value_fold (name, value, 0, + folded = rspamd_header_value_fold (name->start, name->len, + value->start, value->len, 0, RSPAMD_TASK_NEWLINES_LF, stop_chars); } else { - folded = rspamd_header_value_fold (name, value, 0, + folded = rspamd_header_value_fold (name->start, name->len, + value->start, value->len, 0, RSPAMD_TASK_NEWLINES_CRLF, stop_chars); } } else { - folded = rspamd_header_value_fold (name, value, 0, + folded = rspamd_header_value_fold (name->start, name->len, + value->start, value->len, 0, RSPAMD_TASK_NEWLINES_CRLF, stop_chars); } |