diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-12-03 13:36:00 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-12-03 13:36:00 +0000 |
commit | 9da50fb4607d7d8fc62a6ea2aeb8203f6714b001 (patch) | |
tree | 3c8ffe33269e9ee9decf1f7dcb6ddbff676f1ca3 /lualib | |
parent | cc1f592ff0315060a35779b4027ea37dc03d8c8a (diff) | |
download | rspamd-9da50fb4607d7d8fc62a6ea2aeb8203f6714b001.tar.gz rspamd-9da50fb4607d7d8fc62a6ea2aeb8203f6714b001.zip |
[Minor] Fix query for the external map case
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_maps.lua | 8 |
1 files 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, |