aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-15 15:52:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-15 15:52:25 +0100
commitde374366c4872a6edd6a853a3b4dd5d65e2ded11 (patch)
tree227ba3f3984f74ae55ff02e66b2ea6ac800c90cc /src/lua
parent6b15d1ed13c0e082d25097f4833e9d533b753678 (diff)
downloadrspamd-de374366c4872a6edd6a853a3b4dd5d65e2ded11.tar.gz
rspamd-de374366c4872a6edd6a853a3b4dd5d65e2ded11.zip
[Minor] Lua_url: Propagate numeric flags
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_url.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index c2dade139..f3d64e225 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -1391,13 +1391,23 @@ lua_url_lt (lua_State *L)
return 1;
}
-
static gint
lua_load_url (lua_State * L)
{
lua_newtable (L);
luaL_register (L, NULL, urllib_f);
+ /* Push flags */
+ lua_createtable (L, 0, RSPAMD_URL_MAX_FLAG_SHIFT);
+ for (int i = 0; i < RSPAMD_URL_MAX_FLAG_SHIFT; i ++) {
+ guint flag = 1u << i;
+
+ lua_pushinteger (L, flag);
+ lua_setfield (L, -2, rspamd_url_flag_to_string (flag));
+ }
+
+ lua_setfield (L, -2, "flags");
+
return 1;
}