]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add request header selector
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Aug 2018 19:35:34 +0000 (20:35 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Aug 2018 19:35:34 +0000 (20:35 +0100)
lualib/lua_selectors.lua

index 4d0e7a2ecc7ff66bc9c58249413e25be93af27ce..78888de76bbaa89c2104f1d483b3a926380b9124 100644 (file)
@@ -197,6 +197,18 @@ local selectors = {
     ['get_value'] = function(task, _, args)
       return task:get_mempool():get_variable(args[1], args[2])
     end,
+  },
+  -- Get specific HTTP request header. The first argument must be header name.
+  ['request_header'] = {
+    ['type'] = 'string',
+    ['get_value'] = function(task, _, args)
+      local hdr = task:get_request_header(args[1])
+      if hdr then
+        return tostring(hdr)
+      end
+
+      return nil
+    end
   }
 }