From 9da50fb4607d7d8fc62a6ea2aeb8203f6714b001 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 3 Dec 2022 13:36:00 +0000 Subject: [PATCH] [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, -- 2.39.5