Skip to content

Commit 4f8ac4e

Browse files
author
Vasyl Vavrychuk
committed
Do not set Connection: keep-alive unless -enable_keep_alive is set
cesanta/mongoose@8601b03
1 parent b5a4d25 commit 4f8ac4e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/third_party/mongoose/mongoose.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,9 @@ static int match_extension(const char *path, const char *ext_list) {
786786
static int should_keep_alive(const struct mg_connection *conn) {
787787
const char *http_version = conn->request_info.http_version;
788788
const char *header = mg_get_header(conn, "Connection");
789-
return (header == NULL && http_version && !strcmp(http_version, "1.1")) ||
790-
(header != NULL && !mg_strcasecmp(header, "keep-alive"));
789+
return (!mg_strcasecmp(conn->ctx->config[ENABLE_KEEP_ALIVE], "yes") &&
790+
(header == NULL && http_version && !strcmp(http_version, "1.1"))) ||
791+
(header != NULL && !mg_strcasecmp(header, "keep-alive"));
791792
}
792793

793794
static const char *suggest_connection_header(const struct mg_connection *conn) {

0 commit comments

Comments
 (0)