diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-17 20:35:34 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-17 20:35:34 +0100 |
commit | 832d1291055bd800fc85223b0fb5f8f73159c871 (patch) | |
tree | bb54f6245331ac762f9f60d4c4f96071cfc76d05 /lualib/lua_selectors.lua | |
parent | 98dd452be0670c9d10f4d471c43f2c754266896b (diff) | |
download | rspamd-832d1291055bd800fc85223b0fb5f8f73159c871.tar.gz rspamd-832d1291055bd800fc85223b0fb5f8f73159c871.zip |
[Minor] Add request header selector
Diffstat (limited to 'lualib/lua_selectors.lua')
-rw-r--r-- | lualib/lua_selectors.lua | 12 |
1 files changed, 12 insertions, 0 deletions
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 } } |