aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-01 20:31:56 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-01 20:31:56 +0000
commit9eaf2c53c53dcd977ab9e948843e6cece684be05 (patch)
treeba0821d23dd2226574ceb335783634ff4f13cf9a /src/plugins
parent299edf3801951c537751d7315d4f8d2cfa6a11ea (diff)
downloadrspamd-9eaf2c53c53dcd977ab9e948843e6cece684be05.tar.gz
rspamd-9eaf2c53c53dcd977ab9e948843e6cece684be05.zip
[Minor] Rbl: Minor performance improvement when checking URL flags
Suggested by: @citrin
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/rbl.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index bb333a6f7..3d0e02529 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -29,6 +29,7 @@ local selectors = require "lua_selectors"
local bit = require 'bit'
local lua_maps = require "lua_maps"
local rbl_common = require "plugins/rbl"
+local rspamd_url = require "rspamd_url"
-- This plugin implements various types of RBL checks
-- Documentation can be found here:
@@ -43,6 +44,7 @@ local white_symbols = {}
local black_symbols = {}
local monitored_addresses = {}
local known_selectors = {} -- map from selector string to selector id
+local url_flag_bits = rspamd_url.flags
local function get_monitored(rbl)
local default_monitored = '1.0.0.127'
@@ -539,9 +541,9 @@ local function gen_rbl_callback(rule)
local urls = lua_util.extract_specific_urls(ex_params)
for _,u in ipairs(urls) do
- local flags = u:get_flags()
+ local flags = u:get_flags_num()
- if flags.numeric then
+ if bit.band(flags, url_flag_bits.numeric) ~= 0 then
-- For numeric urls we convert data to the ip address and
-- reverse octets. See #3948 for details
local to_resolve = u:get_host()