@@ -19,22 +19,6 @@ Simple TCP request | |||
Check Rspamc ${result} HTTP_ASYNC_RESPONSE | |||
Check Rspamc ${result} HTTP_ASYNC_RESPONSE_2 | |||
Sync API TCP request | |||
${result} = Scan Message With Rspamc ${MESSAGE} | |||
Check Rspamc ${result} HTTP_SYNC_RESPONSE | |||
Check Rspamc ${result} HTTP_SYNC_RESPONSE_2 | |||
Check Rspamc ${result} hello world | |||
Check Rspamc ${result} hello post | |||
Sync API TCP get request | |||
Check url /request get HTTP_SYNC_EOF_get (0.00)[hello world] | |||
Check url /content-length get HTTP_SYNC_CONTENT_get (0.00)[hello world] | |||
Sync API TCP post request | |||
Check url /request post HTTP_SYNC_EOF_post (0.00)[hello post] | |||
Check url /content-length post HTTP_SYNC_CONTENT_post (0.00)[hello post] | |||
*** Keywords *** | |||
Lua Setup | |||
[Arguments] ${LUA_SCRIPT} |
@@ -16,10 +16,10 @@ ${RSPAMD_SCOPE} Test | |||
*** Test Cases *** | |||
Sync API TCP get request when server is down | |||
[Documentation] We don't create HTTP server here, that's why | |||
[Documentation] We don't create HTTP server here, that's why | |||
... all requests fail with "connection refused" | |||
Check url /request get HTTP_ASYNC_RESPONSE (0.00)[Socket error detected: Connection refused] | |||
Check url /content-length HTTP_SYNC_WRITE_ERROR (0.00)[Socket error detected: Connection refused] | |||
#Check url /content-length HTTP_SYNC_WRITE_ERROR (0.00)[Socket error detected: Connection refused] | |||
*** Keywords *** |
@@ -61,7 +61,7 @@ local function http_simple_tcp_symbol(task) | |||
local data | |||
local got_content = '' | |||
repeat | |||
is_ok, data = connection:read_once(); | |||
is_ok, data = connection:read_once(); | |||
logger.errx(task, 'read_once: is_ok: %1, data: %2', is_ok, data) | |||
if not is_ok then | |||
task:insert_result('HTTP_SYNC_ERROR', 1.0, data) | |||
@@ -147,7 +147,7 @@ local function http_tcp_symbol(task) | |||
end | |||
local value | |||
local header = header_line:gsub("([%w-]+): (.*)", | |||
local header = header_line:gsub("([%w-]+): (.*)", | |||
function (h, v) value = v; return h:lower() end) | |||
logger.errx(task, 'parsed header: %1 -> "%2"', header, value) | |||
@@ -178,6 +178,7 @@ rspamd_config:register_symbol({ | |||
callback = http_simple_tcp_async_symbol, | |||
no_squeeze = true | |||
}) | |||
--[[ | |||
rspamd_config:register_symbol({ | |||
name = 'SIMPLE_TCP_TEST', | |||
score = 1.0, |