diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-21 09:19:04 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-21 09:19:04 +0100 |
commit | 3414828f7041e675007ba307989f64b926cddadb (patch) | |
tree | 6cae0e7305696269e40d9ce32aa92dc9ae86344e /test/functional/lua | |
parent | 3a4ccea2afbaf5605faca23b46ab77d0efc353e6 (diff) | |
download | rspamd-3414828f7041e675007ba307989f64b926cddadb.tar.gz rspamd-3414828f7041e675007ba307989f64b926cddadb.zip |
[Test] Add large TCP request test
Diffstat (limited to 'test/functional/lua')
-rw-r--r-- | test/functional/lua/tcp.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/functional/lua/tcp.lua b/test/functional/lua/tcp.lua index a95497086..925a18913 100644 --- a/test/functional/lua/tcp.lua +++ b/test/functional/lua/tcp.lua @@ -59,6 +59,44 @@ local function http_simple_tcp_ssl_symbol(task) }) end +local function http_large_tcp_ssl_symbol(task) + local data = {} + + local function ssl_get_cb(err, rep, conn) + logger.errx(task, 'ssl_get_cb: got reply: %s, error: %s, conn: %s', rep, err, conn) + task:insert_result('TCP_SSL_LARGE_2', 1.0) + end + local function ssl_read_post_cb(err, conn) + logger.errx(task, 'ssl_large_read_post_cb: write done: error: %s, conn: %s', err, conn) + conn:add_read(ssl_get_cb) + end + local function ssl_read_cb(err, rep, conn) + logger.errx(task, 'ssl_large_read_cb: got reply: %s, error: %s, conn: %s', rep, err, conn) + conn:add_write(ssl_read_post_cb, data) + task:insert_result('TCP_SSL_LARGE', 1.0) + end + + if task:get_queue_id() == 'SSL Large TCP request' then + logger.errx(task, 'ssl_large_tcp_symbol: begin') + for i = 1,10000000 do + data[i] = 'test\n' + end + + rspamd_tcp:request({ + task = task, + callback = ssl_read_cb, + host = '127.0.0.1', + data = data, + read = true, + ssl = true, + ssl_noverify = true, + port = 14433, + }) + else + logger.errx(task, 'ssl_large_tcp_symbol: skip') + end +end + local function http_simple_tcp_symbol(task) logger.errx(task, 'connect_sync, before') @@ -212,6 +250,12 @@ rspamd_config:register_symbol({ no_squeeze = true }) rspamd_config:register_symbol({ + name = 'LARGE_TCP_ASYNC_SSL_TEST', + score = 1.0, + callback = http_large_tcp_ssl_symbol, + no_squeeze = true +}) +rspamd_config:register_symbol({ name = 'SIMPLE_TCP_TEST', score = 1.0, callback = http_simple_tcp_symbol, |