diff options
author | Andrew Lewis <nerf@judo.za.org> | 2020-11-24 12:32:10 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2020-11-24 12:32:10 +0200 |
commit | a9f2fb8d1af4ab42d581e1e3924623039470e2b7 (patch) | |
tree | 1cf22e8bc32159c1f76bd91e867a60d93794944b /lualib/lua_selectors | |
parent | 92108ce3bc49e9c0066ce5011e82136cdf094976 (diff) | |
download | rspamd-a9f2fb8d1af4ab42d581e1e3924623039470e2b7.tar.gz rspamd-a9f2fb8d1af4ab42d581e1e3924623039470e2b7.zip |
[Minor] Selectors: fixes for specific URLs
Diffstat (limited to 'lualib/lua_selectors')
-rw-r--r-- | lualib/lua_selectors/extractors.lua | 27 | ||||
-rw-r--r-- | lualib/lua_selectors/init.lua | 6 |
2 files changed, 31 insertions, 2 deletions
diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua index 162f01808..770887ff6 100644 --- a/lualib/lua_selectors/extractors.lua +++ b/lualib/lua_selectors/extractors.lua @@ -287,7 +287,34 @@ e.g. `get_tld`]], ['args_schema'] = {ts.shape{ limit = ts.number + ts.string / tonumber, esld_limit = (ts.number + ts.string / tonumber):is_optional(), + flags = ts.array_of(ts.one_of{ + 'content', + 'has_port', + 'has_user', + 'host_encoded', + 'html_displayed', + 'idn', + 'image', + 'missing_slahes', -- sic + 'no_tld', + 'numeric', + 'obscured', + 'path_encoded', + 'query', + 'query_encoded', + 'redirected', + 'schema_encoded', + 'schemaless', + 'subject', + 'text', + 'unnormalised', + 'url_displayed', + 'zw_spaces', + 'phished', + }):is_optional(), + flags_mode = ts.one_of{'explicit'}:is_optional(), prefix = ts.string:is_optional(), + need_content = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), need_emails = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), need_images = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), ignore_redirected = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua index 54d42f242..3839cec9e 100644 --- a/lualib/lua_selectors/init.lua +++ b/lualib/lua_selectors/init.lua @@ -236,8 +236,10 @@ local function make_grammar() FUNCTION = l.Ct(atom * spc * (obrace * l.V("ARG_LIST") * ebrace)^0), METHOD = l.Ct(atom / function(e) return '__' .. e end * spc * (obrace * l.V("ARG_LIST") * ebrace)^0), ARG_LIST = l.Ct((l.V("ARG") * comma^0)^0), - ARG = l.Cf(tbl_obrace * l.V("NAMED_ARG") * tbl_ebrace, rawset) + argument, - NAMED_ARG = (l.Ct("") * l.Cg(argument * eqsign * argument * comma^0)^0), + ARG = l.Cf(tbl_obrace * l.V("NAMED_ARG") * tbl_ebrace, rawset) + argument + l.V("LIST_ARGS"), + NAMED_ARG = (l.Ct("") * l.Cg(argument * eqsign * (argument + l.V("LIST_ARGS")) * comma^0)^0), + LIST_ARGS = l.Ct(tbl_obrace * l.V("LIST_ARG") * tbl_ebrace), + LIST_ARG = l.Cg(argument * comma^0)^0, } end |