Skip to content

Commit

Permalink
[Minor] Fix query for the external map case
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Dec 3, 2022
1 parent cc1f592 commit 9da50fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lualib/lua_maps.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9da50fb

Please sign in to comment.