Skip to content

Commit

Permalink
in_splunk: http_server: Add and handle no keepalive flag
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jun 28, 2024
1 parent 5534d44 commit ce2d751
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/fluent-bit/http_server/flb_http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#define FLB_HTTP_SERVER_FLAG_KEEPALIVE (((uint64_t) 1) << 0)
#define FLB_HTTP_SERVER_FLAG_AUTO_INFLATE (((uint64_t) 1) << 1)
#define FLB_HTTP_SERVER_FLAG_NO_KEEPALIVE (((uint64_t) 1) << 2)

#define HTTP_SERVER_SUCCESS 0
#define HTTP_SERVER_PROVIDER_ERROR -1
Expand Down
2 changes: 1 addition & 1 deletion plugins/in_splunk/splunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static int in_splunk_init(struct flb_input_instance *ins,
if (ctx->enable_http2) {
ret = flb_http_server_init(&ctx->http_server,
HTTP_PROTOCOL_AUTODETECT,
FLB_HTTP_SERVER_FLAG_AUTO_INFLATE,
(FLB_HTTP_SERVER_FLAG_AUTO_INFLATE | FLB_HTTP_SERVER_FLAG_NO_KEEPALIVE),
NULL,
ins->host.listen,
ins->host.port,
Expand Down
5 changes: 3 additions & 2 deletions src/http_server/flb_http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,9 @@ int flb_http_server_init(struct flb_http_server *session,

session->downstream = NULL;

if (networking_setup->keepalive) {
session->flags = FLB_HTTP_SERVER_FLAG_KEEPALIVE | FLB_HTTP_SERVER_FLAG_AUTO_INFLATE;
if (networking_setup->keepalive &&
!(flags & FLB_HTTP_SERVER_FLAG_NO_KEEPALIVE)) {
session->flags |= FLB_HTTP_SERVER_FLAG_KEEPALIVE;
}

cfl_list_init(&session->clients);
Expand Down

0 comments on commit ce2d751

Please sign in to comment.