commit db45e0e8ff0fa13d0ab466dac6bf7235c0aff975
parent 5315425aa239090655439634651c4ea28c9fdb8a
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Thu, 18 Dec 2025 12:52:14 +0100
GnuTLS backend: added more debug prints
Diffstat:
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/mhd2/tls_gnu_funcs.c b/src/mhd2/tls_gnu_funcs.c
@@ -95,7 +95,17 @@ mhd_tls_gnu_debug_print (int level, const char *msg)
}
-#endif /* mhd_USE_TLS_DEBUG_MESSAGES */
+# define mhd_DBG_PRINT_TLS_INFO_MSG(message) \
+ do { (void) fprintf (stderr, "## GnuTLS info: %s\n", (message)); \
+ (void) fflush (stderr);} while (0)
+# define mhd_DBG_PRINT_TLS_INFO_PARAM1(message,param) \
+ do { (void) fprintf (stderr, "## GnuTLS info: " message "\n", (param)); \
+ (void) fflush (stderr);} while (0)
+#else /* ! mhd_USE_TLS_DEBUG_MESSAGES */
+# define mhd_DBG_PRINT_TLS_ERRS() ERR_clear_error ()
+# define mhd_DBG_PRINT_TLS_INFO_MSG(message) ((void) 0)
+# define mhd_DBG_PRINT_TLS_INFO_PARAM1(message,param) ((void) 0)
+#endif /* ! mhd_USE_TLS_DEBUG_MESSAGES */
#ifdef mhd_TLS_GNU_HAS_ALPN
static const char mhd_alpn_str_http1_0[] = mhd_ALPN_H1_0;
@@ -399,6 +409,11 @@ daemon_init_priorities_cache (struct MHD_Daemon *restrict d,
if (0 == i)
continue; // TODO: support app-defined name for TLS backend profile
+
+ mhd_DBG_PRINT_TLS_INFO_PARAM1 ("Trying '%s' priorities",
+ NULL == tlsgnulib_base_priorities[i].cstr ?
+ "[NULL]" :
+ tlsgnulib_base_priorities[i].cstr);
#if ! defined(mhd_TLS_GNU_TREATS_NULL_AS_DEF_PRIORITY)
if (NULL == tlsgnulib_base_priorities[i].cstr)
{
@@ -415,7 +430,13 @@ daemon_init_priorities_cache (struct MHD_Daemon *restrict d,
tlsgnulib_base_priorities[i].cstr,
NULL);
if (GNUTLS_E_SUCCESS == res)
+ {
+ mhd_DBG_PRINT_TLS_INFO_PARAM1 ("Initialised with '%s' priorities",
+ NULL == tlsgnulib_base_priorities[i].cstr
+ ? "[NULL]" :
+ tlsgnulib_base_priorities[i].cstr);
break;
+ }
if (GNUTLS_E_MEMORY_ERROR == res)
return MHD_SC_DAEMON_MEM_ALLOC_FAILURE;
}