aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/url.c1
-rw-r--r--src/libserver/url.h1
-rw-r--r--src/lua/lua_url.c12
3 files changed, 13 insertions, 1 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index ad77686b7..a97db640a 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -242,6 +242,7 @@ struct rspamd_url_flag_name {
{"query", RSPAMD_URL_FLAG_QUERY, -1},
{"content", RSPAMD_URL_FLAG_CONTENT, -1},
{"no_tld", RSPAMD_URL_FLAG_NO_TLD, -1},
+ {"truncated", RSPAMD_URL_FLAG_TRUNCATED, -1},
};
diff --git a/src/libserver/url.h b/src/libserver/url.h
index 30c5ef0af..11177492d 100644
--- a/src/libserver/url.h
+++ b/src/libserver/url.h
@@ -40,6 +40,7 @@ enum rspamd_url_flags {
RSPAMD_URL_FLAG_NO_TLD = 1u << 22u,
RSPAMD_URL_FLAG_TRUNCATED = 1u << 23u,
};
+#define RSPAMD_URL_MAX_FLAG_SHIFT (24u)
struct rspamd_url_tag {
const gchar *data;
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;
}