diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-14 09:56:06 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-14 09:56:06 +0100 |
commit | 4f1f869748207d12c2deda80e12aeb206ce37fcb (patch) | |
tree | 352b8b6acfb90d1b073226e8c866ebf578710c5e /test/functional/lua | |
parent | 5a5e892a64a1d23964010620c529d0947d692237 (diff) | |
download | rspamd-4f1f869748207d12c2deda80e12aeb206ce37fcb.tar.gz rspamd-4f1f869748207d12c2deda80e12aeb206ce37fcb.zip |
[Test] Add large https body test
Diffstat (limited to 'test/functional/lua')
-rw-r--r-- | test/functional/lua/http.lua | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/test/functional/lua/http.lua b/test/functional/lua/http.lua index 1981c8734..d0ed4e7b7 100644 --- a/test/functional/lua/http.lua +++ b/test/functional/lua/http.lua @@ -106,13 +106,51 @@ local function periodic(cfg, ev_base) end rspamd_config:register_symbol({ -name = 'SIMPLE_TEST', -score = 1.0, -callback = http_symbol, -no_squeeze = true, -flags = 'coro' + name = 'SIMPLE_TEST', + score = 1.0, + callback = http_symbol, + no_squeeze = true, + flags = 'coro' }) +local function http_large_symbol(task) + if task:get_queue_id() == 'SSL Large HTTP request' then + local data = {} + for i = 1,2 do + local st = {} + for j=1,300000 do + st[j] = 't' + end + data[i] = table.concat(st) + end + data[#data + 1] = '\n' + + local function http_callback(err, code, body) + if err then + rspamd_logger.errx('http_callback error: ' .. err) + task:insert_result('HTTP_ERROR', 1.0, err) + else + task:insert_result('HTTP_SSL_LARGE', 1.0) + end + end + rspamd_http.request({ + url = 'https://127.0.0.1:18081/', + task = task, + method = 'post', + callback = http_callback, + timeout = 10, + body = data, + no_ssl_verify = true, + }) + end +end +rspamd_config:register_symbol({ + name = 'LARGE_TEST', + score = 1.0, + callback = http_large_symbol, + no_squeeze = true, + flags = 'coro' +}) rspamd_config:register_finish_script(finish) |