commit 9da50fb: [Minor] Fix query for the external map case
Vsevolod Stakhov
vsevolod at rspamd.com
Sat Dec 3 13:42:05 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-12-03 13:36:00 +0000
URL: https://github.com/rspamd/rspamd/commit/9da50fb4607d7d8fc62a6ea2aeb8203f6714b001
[Minor] Fix query for the external map case
---
lualib/lua_maps.lua | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lualib/lua_maps.lua b/lualib/lua_maps.lua
index 9f633e145..c7c5a983d 100644
--- a/lualib/lua_maps.lua
+++ b/lualib/lua_maps.lua
@@ -126,7 +126,7 @@ local function query_external_map(map_config, upstreams, key, callback, task)
key = key
}
elseif map_config.method == 'query' then
- url = string.format('%s?%s', url, url_encode_string(key))
+ url = string.format('%s?key=%s', url, url_encode_string(tostring(key)))
end
elseif type(key) == 'table' then
if map_config.method == 'body' then
@@ -169,14 +169,16 @@ local function query_external_map(map_config, upstreams, key, callback, task)
local function map_callback(err, code, body, _)
if err then
callback(false, err, code, task)
- else
+ elseif code == 200 then
callback(true, body, 200, task)
+ else
+ callback(false, err, code, task)
end
end
local ret = rspamd_http.request{
task = task,
- url = map_config.backend,
+ url = url,
callback = map_callback,
timeout = map_config.timeout or 1.0,
keepalive = true,
More information about the Commits
mailing list