From 85a895c59fa5d268176a9ca243c6c515f54c7f24 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 11 Feb 2026 02:35:02 +0100 Subject: [PATCH] cli_hx_download: add Schannel support Fixes: ``` $ wine libtests.exe cli_hx_download https://curl.se/ [...] Assertion failed: t->checked_ssl, file .../curl/tests/libtest/cli_hx_download.c, line 563 ``` into: ``` [t-0] info Schannel TLS version 0x00000800 ``` Refs: https://learn.microsoft.com/windows/win32/secauthn/querycontextattributes--general https://learn.microsoft.com/windows/win32/api/schannel/ns-schannel-secpkgcontext_connectioninfo Ref: c220674ac451231e05df1686bd3da473e5c37252 #20564 Follow-up to ba9ddb935794a9fdd6906f043102a0d3e5795113 #18066 Closes #20556 --- tests/libtest/cli_hx_download.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/libtest/cli_hx_download.c b/tests/libtest/cli_hx_download.c index 5a37fcbab3..5daac8364e 100644 --- a/tests/libtest/cli_hx_download.c +++ b/tests/libtest/cli_hx_download.c @@ -42,6 +42,11 @@ #ifdef USE_RUSTLS #include #endif +#ifdef USE_SCHANNEL +#include /* for CtxtHandle, QueryContextAttributes() */ +#include /* for SecPkgContext_ConnectionInfo, + SECPKG_ATTR_CONNECTION_INFO */ +#endif static int verbose_d = 1; @@ -133,7 +138,8 @@ static int my_progress_d_cb(void *userdata, } #if defined(USE_QUICHE) || defined(USE_OPENSSL) || defined(USE_WOLFSSL) || \ - defined(USE_GNUTLS) || defined(USE_MBEDTLS) || defined(USE_RUSTLS) + defined(USE_GNUTLS) || defined(USE_MBEDTLS) || defined(USE_RUSTLS) || \ + defined(USE_SCHANNEL) if(!t->checked_ssl && dlnow > 0) { struct curl_tlssessioninfo *tls; CURLcode result; @@ -196,6 +202,21 @@ static int my_progress_d_cb(void *userdata, t->idx, v); break; } +#endif +#ifdef USE_SCHANNEL + case CURLSSLBACKEND_SCHANNEL: { + CtxtHandle *ctxt_handle = (CtxtHandle *)tls->internals; + SecPkgContext_ConnectionInfo info; + SECURITY_STATUS sspi_status; + sspi_status = QueryContextAttributes(ctxt_handle, + SECPKG_ATTR_CONNECTION_INFO, + &info); + assert(sspi_status == SEC_E_OK); + (void)sspi_status; + curl_mfprintf(stderr, "[t-%zu] info Schannel TLS version 0x%08lx\n", + t->idx, info.dwProtocol); + break; + } #endif default: curl_mfprintf(stderr, "[t-%zu] info SSL_PTR backend=%d, ptr=%p\n",