diff options
author | Lyuben Bahtarliev <> | 2023-09-12 00:26:59 +0300 |
---|---|---|
committer | Lyuben Bahtarliev <> | 2023-09-12 23:36:40 +0300 |
commit | 4824b17181d300954751b84272543ece4b81e9a7 (patch) | |
tree | 8ffea086093d7152c47ac674539481e855880043 /lualib | |
parent | 5bb1ce5ee2cb9ef383e6bdc82adfaafd058e925b (diff) | |
download | rspamd-4824b17181d300954751b84272543ece4b81e9a7.tar.gz rspamd-4824b17181d300954751b84272543ece4b81e9a7.zip |
[Feature] Add ICAP Content-Type and Filename from TODO List. Simplify changes. Remove unnecessary debug message.
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_scanners/icap.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lualib/lua_scanners/icap.lua b/lualib/lua_scanners/icap.lua index 042ce1e98..59d2caa4a 100644 --- a/lualib/lua_scanners/icap.lua +++ b/lualib/lua_scanners/icap.lua @@ -241,13 +241,15 @@ local function icap_check(task, content, digest, rule, maybe_part) local function get_req_headers() local in_client_ip = task:get_from_ip() - lua_util.debugm(rule.name, task, 'URL: http://%s/%s | Content-Type: %s/%s', - in_client_ip, maybe_part[1], maybe_part[2], maybe_part[3]) - local req_hlen = 2 - table.insert(req_headers, string.format('GET http://%s/%s HTTP/1.0\r\n', in_client_ip, maybe_part[1])) table.insert(req_headers, string.format('Date: %s\r\n', rspamd_util.time_to_string(rspamd_util.get_time()))) - table.insert(http_headers, string.format('Content-Type: %s/%s\r\n', maybe_part[2], maybe_part[3])) + if maybe_part then + table.insert(req_headers, string.format('GET http://%s/%s HTTP/1.0\r\n', in_client_ip, maybe_part:get_filename())) + table.insert(http_headers, string.format('Content-Type: %s/%s\r\n', maybe_part:get_detected_type())) + else + table.insert(req_headers, string.format('GET %s HTTP/1.0\r\n', rule.req_fake_url)) + table.insert(http_headers, string.format('Content-Type: application/octet-stream\r\n')) + end if rule.user_agent ~= "none" then table.insert(req_headers, string.format("User-Agent: %s\r\n", rule.user_agent)) end |