From bc2caa85044fc002cbc8911bc0b021b2a0fe1dda Mon Sep 17 00:00:00 2001 From: Michael Saxl Date: Thu, 20 Jul 2023 14:54:22 +0200 Subject: [PATCH] [util,http] set sni on the ssl connection --- libfreerdp/utils/http.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libfreerdp/utils/http.c b/libfreerdp/utils/http.c index e87295080..d2f242ce9 100644 --- a/libfreerdp/utils/http.c +++ b/libfreerdp/utils/http.c @@ -84,6 +84,7 @@ BOOL freerdp_http_request(const char* url, const char* body, long* status_code, char buffer[1024] = { 0 }; BIO* bio = NULL; SSL_CTX* ssl_ctx = NULL; + SSL* ssl = NULL; WINPR_ASSERT(status_code); WINPR_ASSERT(response); @@ -149,6 +150,19 @@ BOOL freerdp_http_request(const char* url, const char* body, long* status_code, goto out; } + BIO_get_ssl(bio, &ssl); + if (!ssl) + { + log_errors("could not get ssl"); + goto out; + } + + if (!SSL_set_tlsext_host_name(ssl, hostname)) + { + log_errors("could not set sni hostname"); + goto out; + } + WLog_DBG(TAG, "headers:\n%s", headers); ERR_clear_error(); if (BIO_write(bio, headers, strlen(headers)) < 0)