diff options
author | Anton Yuzhaninov <citrin+git@citrin.ru> | 2020-12-22 13:05:58 +0000 |
---|---|---|
committer | Anton Yuzhaninov <citrin+git@citrin.ru> | 2020-12-22 13:05:58 +0000 |
commit | a9e9703a896161f1ff96af4d26223428e57f13ad (patch) | |
tree | 0338e955cbfdd1a94df4a0139f79d395f4ae0c31 /rules/headers_checks.lua | |
parent | 5cd7131d26a4859953e6b886c6f254676b4da54a (diff) | |
download | rspamd-a9e9703a896161f1ff96af4d26223428e57f13ad.tar.gz rspamd-a9e9703a896161f1ff96af4d26223428e57f13ad.zip |
[Minor] Use task:has_header instead of task:get_header
Use task:has_header() to check if header is exists.
Diffstat (limited to 'rules/headers_checks.lua')
-rw-r--r-- | rules/headers_checks.lua | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/rules/headers_checks.lua b/rules/headers_checks.lua index b62676293..c4e4a4a67 100644 --- a/rules/headers_checks.lua +++ b/rules/headers_checks.lua @@ -340,17 +340,17 @@ local check_mime_id = rspamd_config:register_symbol{ callback = function(task) -- Check if there is a MIME-Version header local missing_mime = false - if not task:get_header('MIME-Version') then + if not task:has_header('MIME-Version') then missing_mime = true end -- Check presense of MIME specific headers - local ct_header = task:get_header('Content-Type') - local cte_header = task:get_header('Content-Transfer-Encoding') + local has_ct_header = task:has_header('Content-Type') + local has_cte_header = task:has_header('Content-Transfer-Encoding') -- Add the symbol if we have MIME headers, but no MIME-Version -- (do not add the symbol for RFC822 messages) - if (ct_header or cte_header) and missing_mime then + if (has_ct_header or has_cte_header) and missing_mime then task:insert_result('MISSING_MIME_VERSION', 1.0) end @@ -595,8 +595,7 @@ rspamd_config.MULTIPLE_FROM = { rspamd_config.MV_CASE = { callback = function (task) - local mv = task:get_header('Mime-Version', true) - if (mv) then return true end + return task:has_header('Mime-Version', true) end, description = 'Mime-Version .vs. MIME-Version', score = 0.5, @@ -1117,8 +1116,7 @@ rspamd_config.INVALID_RCPT_8BIT = { rspamd_config.XM_CASE = { callback = function (task) - local xm = task:get_header('X-mailer', true) - if (xm) then return true end + return task:has_header('X-mailer', true) end, description = 'X-mailer .vs. X-Mailer', score = 0.5, |