Skip to content

Commit

Permalink
[Minor] Add task uid to ICAP User Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
ventulis committed Nov 24, 2020
1 parent 642909e commit a50e403
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lualib/lua_scanners/icap.lua
Expand Up @@ -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
Expand All @@ -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),
Expand Down

0 comments on commit a50e403

Please sign in to comment.