From e2bbca543715c0d16e82be3f9a861af0f17c11c5 Mon Sep 17 00:00:00 2001 From: "AD001\\z0048zxj" Date: Wed, 27 Nov 2024 12:12:09 +0530 Subject: [PATCH] sslkeylog: added api in lws to start or stop logging ssl keys as per user input bool flag for respective wsi --- lib/core-net/close.c | 4 ---- lib/plat/windows/windows-init.c | 8 +++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/core-net/close.c b/lib/core-net/close.c index fe1af3c51..736002348 100644 --- a/lib/core-net/close.c +++ b/lib/core-net/close.c @@ -1076,10 +1076,6 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason, const char *ca { struct lws_context *cx = wsi->a.context; struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi]; - - /* if the user sets the sniffing flag, populate the key log file */ - lws_set_keylog_file(wsi); - /* if the user sets the sniffing flag, populate the key log file */ lws_set_keylog_file(wsi); diff --git a/lib/plat/windows/windows-init.c b/lib/plat/windows/windows-init.c index 381ce75be..9b114b5fc 100644 --- a/lib/plat/windows/windows-init.c +++ b/lib/plat/windows/windows-init.c @@ -106,10 +106,12 @@ lws_plat_init(struct lws_context *context, #if defined(LWS_HAVE_SSL_CTX_set_keylog_callback) && \ defined(LWS_WITH_TLS) && defined(LWS_WITH_CLIENT) - { + { char *klf_env = getenv("SSLKEYLOGFILE"); - if(klf_env) - lws_strncpy(context->keylog_file, klf_env, sizeof(context->keylog_file)); + + if (klf_env) + lws_strncpy(context->keylog_file, klf_env, + sizeof(context->keylog_file)); } #endif