From: Carsten Rosenberg Date: Tue, 2 Nov 2021 20:15:53 +0000 (+0100) Subject: [Minor] lua_scanners - icap - lua linting X-Git-Tag: 3.2~296^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d17db4b3ff1d84830d41ad0d406bfc3174d95018;p=rspamd.git [Minor] lua_scanners - icap - lua linting --- diff --git a/lualib/lua_scanners/icap.lua b/lualib/lua_scanners/icap.lua index 414b81c55..e10cf886e 100644 --- a/lualib/lua_scanners/icap.lua +++ b/lualib/lua_scanners/icap.lua @@ -272,7 +272,7 @@ local function icap_check(task, content, digest, rule, maybe_part) local resp_http_headers -- Append all extra headers - if rule.user_agent ~= "none" then + if rule.user_agent ~= "none" then table.insert(respond_headers, string.format("User-Agent: %s\r\n", rule.user_agent)) end @@ -472,7 +472,6 @@ local function icap_check(task, content, digest, rule, maybe_part) icap_requery(err_m, "icap_r_respond_http_cb") else local result = tostring(data) - connection:close() local icap_http_headers = result_header_table(result) or {} -- Find HTTP/[12].x [234]xx response @@ -550,16 +549,16 @@ local function icap_check(task, content, digest, rule, maybe_part) end end - local function icap_w_respond_cb(err_m, conn) - if err_m or conn == nil then + local function icap_w_respond_cb(err_m, connection) + if err_m or connection == nil then icap_requery(err_m, "icap_w_respond_cb") else - conn:add_read(icap_r_respond_cb, '\r\n\r\n') + connection:add_read(icap_r_respond_cb, '\r\n\r\n') end end - local function icap_r_options_cb(err_m, data, conn) - if err_m or conn == nil then + local function icap_r_options_cb(err_m, data, connection) + if err_m or connection == nil then icap_requery(err_m, "icap_r_options_cb") else local icap_headers = result_header_table(tostring(data)) @@ -592,7 +591,7 @@ local function icap_check(task, content, digest, rule, maybe_part) end - conn:add_write(icap_w_respond_cb, get_respond_query()) + connection:add_write(icap_w_respond_cb, get_respond_query()) else rspamd_logger.errx(task, '%s: RESPMOD method not advertised: Methods: %s',