Skip to content

Commit b84219b

Browse files
committed
out_http: add http.response_timeout (60s) and http.read_idle_timeouts props
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 80e2f89 commit b84219b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

plugins/out_http/http.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,15 @@ static int http_post(struct flb_out_http *ctx,
193193
*/
194194
c->cb_ctx = ctx->ins->callback;
195195

196+
flb_http_set_response_timeout(c, ctx->response_timeout);
197+
198+
if (ctx->read_idle_timeout > 0) {
199+
flb_http_set_read_idle_timeout(c, ctx->read_idle_timeout);
200+
}
201+
else {
202+
flb_http_set_read_idle_timeout(c, ctx->ins->net_setup.io_timeout);
203+
}
204+
196205
/* Append headers */
197206
if (headers) {
198207
append_headers(c, headers);
@@ -678,6 +687,16 @@ static struct flb_config_map config_map[] = {
678687
0, FLB_TRUE, offsetof(struct flb_out_http, log_response_payload),
679688
"Specify if the response paylod should be logged or not"
680689
},
690+
{
691+
FLB_CONFIG_MAP_TIME, "http.response_timeout", "60s",
692+
0, FLB_TRUE, offsetof(struct flb_out_http, response_timeout),
693+
"Set maximum time to wait for a server response"
694+
},
695+
{
696+
FLB_CONFIG_MAP_TIME, "http.read_idle_timeout", "0s",
697+
0, FLB_TRUE, offsetof(struct flb_out_http, read_idle_timeout),
698+
"Set maximum allowed time between two consecutive reads"
699+
},
681700
{
682701
FLB_CONFIG_MAP_STR, "http_user", NULL,
683702
0, FLB_TRUE, offsetof(struct flb_out_http, http_user),

plugins/out_http/http.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ struct flb_out_http {
9494
/* Log the response paylod */
9595
int log_response_payload;
9696

97+
/* Response timeout */
98+
int response_timeout;
99+
100+
/* Read idle timeout */
101+
int read_idle_timeout;
102+
97103
/* Upstream connection to the backend server */
98104
struct flb_upstream *u;
99105

0 commit comments

Comments
 (0)