aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_scanners
diff options
context:
space:
mode:
authorventulis <72085617+ventulis@users.noreply.github.com>2020-11-24 17:00:53 +0100
committerventulis <72085617+ventulis@users.noreply.github.com>2020-11-24 17:00:53 +0100
commita50e40356d93838b978076157e8b6c5e7f3979ef (patch)
treecd067445391aa481f9f07efee4d40207d662ebc0 /lualib/lua_scanners
parent642909e84aab0a6b9cb110152c1e908ba501fe6e (diff)
downloadrspamd-a50e40356d93838b978076157e8b6c5e7f3979ef.tar.gz
rspamd-a50e40356d93838b978076157e8b6c5e7f3979ef.zip
[Minor] Add task uid to ICAP User Agent
Diffstat (limited to 'lualib/lua_scanners')
-rw-r--r--lualib/lua_scanners/icap.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/lualib/lua_scanners/icap.lua b/lualib/lua_scanners/icap.lua
index 5fb332dc0..9efe1c14c 100644
--- a/lualib/lua_scanners/icap.lua
+++ b/lualib/lua_scanners/icap.lua
@@ -88,10 +88,6 @@ local function icap_config(opts)
icap_conf.servers,
icap_conf.default_port)
- if icap_conf.user_agent == "extended" then
- icap_conf.user_agent = string.format("Rspamd/%s-%s (%s)", rspamd_version('main'), rspamd_version('id'), rspamd_util.get_hostname())
- end
-
if icap_conf.upstreams then
lua_util.add_debug_alias('external_services', icap_conf.name)
return icap_conf
@@ -109,6 +105,11 @@ local function icap_check(task, content, digest, rule)
local retransmits = rule.retransmits
local respond_headers = {}
+ -- Build extended User Agent
+ if rule.user_agent == "extended" then
+ rule.user_agent = string.format("Rspamd/%s-%s (%s/%s)", rspamd_version('main'), rspamd_version('id'), rspamd_util.get_hostname(), string.sub(task:get_uid(), 1,6))
+ end
+
-- Build the icap queries
local options_request = {
string.format("OPTIONS icap://%s:%s/%s ICAP/1.0\r\n", addr:to_string(), addr:get_port(), rule.scheme),