commit 86d9940: metadata_exporter http pusher: Extend valid return codes

yo johan at nosd.in
Sun Nov 13 20:49:03 UTC 2022


Author: yo
Date: 2022-11-13 16:24:53 +0100
URL: https://github.com/rspamd/rspamd/commit/86d99407f4980a25112a3d6b40cae3419a677ea1

metadata_exporter http pusher: Extend valid return codes

---
 src/plugins/lua/metadata_exporter.lua | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua
index dceb81cd4..e011c56a9 100644
--- a/src/plugins/lua/metadata_exporter.lua
+++ b/src/plugins/lua/metadata_exporter.lua
@@ -300,15 +300,19 @@ local pushers = {
   end,
   http = function(task, formatted, rule)
     local function http_callback(err, code)
+      local valid_status = {200, 201, 202, 204}
+
       if err then
         rspamd_logger.errx(task, 'got error %s in http callback', err)
         return maybe_defer(task, rule)
       end
-      if code ~= 200 then
-        rspamd_logger.errx(task, 'got unexpected http status: %s', code)
-        return maybe_defer(task, rule)
+      for i, v in ipairs(valid_status) do
+        if v == code then
+          return true
+        end
       end
-      return true
+      rspamd_logger.errx(task, 'got unexpected http status: %s', code)
+      return maybe_defer(task, rule)
     end
     local hdrs = {}
     if rule.meta_headers then


More information about the Commits mailing list