From 102bc96bad4da890eb3b00e14d1450fbf05a3f34 Mon Sep 17 00:00:00 2001 From: Stepan Rabotkin Date: Wed, 2 Sep 2026 15:08:13 +0300 Subject: [PATCH] fix(cli): create an http context when serving plain HTTP http_ctx was assigned only in the TLS branch, so on plain HTTP it stayed NULL and http_init() segfaulted on the first accepted connection. Signed-off-by: Stepan Rabotkin --- src/cmd/cli_serve.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cmd/cli_serve.cpp b/src/cmd/cli_serve.cpp index 971a19a9..fed57577 100644 --- a/src/cmd/cli_serve.cpp +++ b/src/cmd/cli_serve.cpp @@ -151,6 +151,17 @@ struct cli_serve_t } } } + else + { + std::string error; + http_ctx = http_context_init(parent->epmgr->tfd, "", "", "", false, error); + if (error != "") + { + result = (cli_result_t){ .err = EINVAL, .text = error }; + state = 100; + return; + } + } if (use_perms && client_ca == "") { result = (cli_result_t){ .err = EINVAL, .text = "use_perms requires client_ca" }; -- 2.47.3