diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/cfg_file.h | 1 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.cxx | 8 | ||||
-rw-r--r-- | src/libserver/cfg_utils.cxx | 1 | ||||
-rw-r--r-- | src/lua/lua_config.c | 24 |
4 files changed, 33 insertions, 1 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index 1ba1d84ad..a963f952f 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -366,6 +366,7 @@ struct rspamd_config { gboolean public_groups_only; /**< Output merely public groups everywhere */ enum rspamd_gtube_patterns_policy gtube_patterns_policy; /**< Enable test patterns */ gboolean enable_css_parser; /**< Enable css parsing in HTML */ + gboolean enable_mime_utf; /**< Enable utf8 mime parsing */ gsize max_cores_size; /**< maximum size occupied by rspamd core files */ gsize max_cores_count; /**< maximum number of core files */ diff --git a/src/libserver/cfg_rcl.cxx b/src/libserver/cfg_rcl.cxx index ce3df4010..2fe37f18e 100644 --- a/src/libserver/cfg_rcl.cxx +++ b/src/libserver/cfg_rcl.cxx @@ -1917,7 +1917,13 @@ rspamd_rcl_config_init(struct rspamd_config *cfg, GHashTable *skip_sections) rspamd_rcl_parse_struct_boolean, G_STRUCT_OFFSET(struct rspamd_config, enable_css_parser), 0, - "Enable CSS parser (experimental)"); + "Enable CSS parser"); + rspamd_rcl_add_default_handler(sub, + "enable_mime_utf", + rspamd_rcl_parse_struct_boolean, + G_STRUCT_OFFSET(struct rspamd_config, enable_mime_utf), + 0, + "Enable UTF8 mode for mime"); rspamd_rcl_add_default_handler(sub, "enable_experimental", rspamd_rcl_parse_struct_boolean, diff --git a/src/libserver/cfg_utils.cxx b/src/libserver/cfg_utils.cxx index 1344bc4f9..92a230395 100644 --- a/src/libserver/cfg_utils.cxx +++ b/src/libserver/cfg_utils.cxx @@ -341,6 +341,7 @@ rspamd_config_new(enum rspamd_config_init_flags flags) cfg->heartbeat_interval = 10.0; cfg->enable_css_parser = true; + cfg->enable_mime_utf = true; cfg->script_modules = g_ptr_array_new(); REF_INIT_RETAIN(cfg, rspamd_config_free); diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index f9a79eef1..f5405f76d 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -791,6 +791,13 @@ LUA_FUNCTION_DEF(config, get_cpu_flags); LUA_FUNCTION_DEF(config, has_torch); /*** + * @method rspamd_config:is_mime_utf() + * Returns true if Rspamd is configured to use UTF for mime processing + * @return {boolean} true if mime utf is enabled + */ +LUA_FUNCTION_DEF(config, is_mime_utf); + +/*** * @method rspamd_config:experimental_enabled() * Returns true if experimental plugins are enabled * @return {boolean} true if experimental plugins are enabled @@ -917,6 +924,7 @@ static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF(config, set_peak_cb), LUA_INTERFACE_DEF(config, get_cpu_flags), LUA_INTERFACE_DEF(config, has_torch), + LUA_INTERFACE_DEF(config, is_mime_utf), LUA_INTERFACE_DEF(config, experimental_enabled), LUA_INTERFACE_DEF(config, load_ucl), LUA_INTERFACE_DEF(config, parse_rcl), @@ -4259,6 +4267,22 @@ lua_config_has_torch(lua_State *L) } static int +lua_config_is_mime_utf(lua_State *L) +{ + LUA_TRACE_POINT; + struct rspamd_config *cfg = lua_check_config(L, 1); + + if (cfg != NULL) { + lua_pushboolean(L, cfg->enable_mime_utf); + } + else { + return luaL_error(L, "invalid arguments"); + } + + return 1; +} + +static int lua_config_experimental_enabled(lua_State *L) { LUA_TRACE_POINT; |