aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>2024-10-14 16:01:35 +0200
committerDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>2024-10-14 16:01:35 +0200
commit6387273113ff352d6036dbcde445e196c7db3a08 (patch)
tree9250d2336f0f5da68f4697d617f051812584769d /src/plugins
parentbeff1ed34a04a9886f349bfb7ab2abf913bec51a (diff)
downloadrspamd-6387273113ff352d6036dbcde445e196c7db3a08.tar.gz
rspamd-6387273113ff352d6036dbcde445e196c7db3a08.zip
reuse http_request data
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/elastic.lua55
1 files changed, 20 insertions, 35 deletions
diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua
index 368ef5b74..45c5c2edf 100644
--- a/src/plugins/lua/elastic.lua
+++ b/src/plugins/lua/elastic.lua
@@ -409,44 +409,29 @@ local function elastic_send_data(flush_all, task, cfg, ev_base)
end
if nlogs_to_send > 0 then
+ local http_request = {
+ url = push_url,
+ headers = {
+ ['Host'] = host,
+ ['Content-Type'] = 'application/x-ndjson',
+ },
+ body = bulk_json,
+ method = 'post',
+ callback=http_callback,
+ gzip = settings.use_gzip,
+ keepalive = settings.use_keepalive,
+ no_ssl_verify = settings.no_ssl_verify,
+ user = settings.user,
+ password = settings.password,
+ timeout = settings.timeout,
+ }
if task then
- return rspamd_http.request({
- url = push_url,
- headers = {
- ['Host'] = host,
- ['Content-Type'] = 'application/x-ndjson',
- },
- body = bulk_json,
- task = task,
- method = 'post',
- callback=http_callback,
- gzip = settings.use_gzip,
- keepalive = settings.use_keepalive,
- no_ssl_verify = settings.no_ssl_verify,
- user = settings.user,
- password = settings.password,
- timeout = settings.timeout,
- })
+ http_request['task'] = task
else
- return rspamd_http.request({
- url = push_url,
- headers = {
- ['Host'] = host,
- ['Content-Type'] = 'application/x-ndjson',
- },
- body = bulk_json,
- ev_base = ev_base,
- config = cfg,
- method = 'post',
- callback=http_callback,
- gzip = settings.use_gzip,
- keepalive = settings.use_keepalive,
- no_ssl_verify = settings.no_ssl_verify,
- user = settings.user,
- password = settings.password,
- timeout = settings.timeout,
- })
+ http_request['ev_base'] = ev_base
+ http_request['config'] = cfg
end
+ return rspamd_http.request(http_request)
end
end