]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
metadata_exporter http pusher: Extend valid return codes
authoryo <johan@nosd.in>
Sun, 13 Nov 2022 15:24:53 +0000 (16:24 +0100)
committeryo <johan@nosd.in>
Sun, 13 Nov 2022 15:24:53 +0000 (16:24 +0100)
src/plugins/lua/metadata_exporter.lua

index dceb81cd4760fea5867a4231aa2434b83a654a52..e011c56a911d330f875619eb44cff02b2b5448a5 100644 (file)
@@ -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