From de374366c4872a6edd6a853a3b4dd5d65e2ded11 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 15 Apr 2021 15:52:25 +0100 Subject: [Minor] Lua_url: Propagate numeric flags --- src/lua/lua_url.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/lua/lua_url.c') 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; } -- cgit v1.2.3