From: Vsevolod Stakhov Date: Fri, 17 Aug 2018 19:35:34 +0000 (+0100) Subject: [Minor] Add request header selector X-Git-Tag: 1.8.0~240 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=832d1291055bd800fc85223b0fb5f8f73159c871;p=rspamd.git [Minor] Add request header selector --- diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index 4d0e7a2ec..78888de76 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -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 } }