diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-12 15:17:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-19 12:44:14 +0000 |
commit | 3ec55e1bcb675fb2affcd4977e9517054c9a5342 (patch) | |
tree | fd7529d129af7fe31d5ea06c35178d4151bf45c8 /lualib | |
parent | cb96968b1b705a3cc60658f006a646acc89c9b73 (diff) | |
download | rspamd-3ec55e1bcb675fb2affcd4977e9517054c9a5342.tar.gz rspamd-3ec55e1bcb675fb2affcd4977e9517054c9a5342.zip |
[Project] Add query encoding usage
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_maps.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lualib/lua_maps.lua b/lualib/lua_maps.lua index b2f8dda92..88f0b894a 100644 --- a/lualib/lua_maps.lua +++ b/lualib/lua_maps.lua @@ -141,7 +141,13 @@ local function query_external_map(map_config, upstreams, key, callback, task) else -- query/header and no encode if map_config.method == 'query' then - -- TODO: encode key/value pairs into query params + local params_table = {} + for k,v in pairs(key) do + if type(v) == 'string' then + table.insert(params_table, string.format('%s=%s', url_encode_string(k), url_encode_string(v))) + end + end + url = string.format('%s?%s', url, table.concat(params_table, '&')) elseif map_config.method == 'header' then http_headers = key else @@ -150,7 +156,6 @@ local function query_external_map(map_config, upstreams, key, callback, task) "requested external map key with a wrong combination of encode and input; caller: %s:%s", caller.short_src, caller.currentline) callback(false, 'invalid map usage', 500, task) - return end end |