From 7afe1167e5d57fe28e91744d93f1ceebba12c0f3 Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Thu, 17 Jul 2025 07:38:54 +0800 Subject: [PATCH] avformat/tls_openssl: set tlsext host name after init ssl Signed-off-by: Jack Lau Signed-off-by: Timo Rothenpieler --- libavformat/tls_openssl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 07d1af40d8..8200c644a9 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -837,9 +837,6 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary ** if (c->verify) SSL_CTX_set_verify(p->ctx, SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL); - if (!c->listen && !c->numerichost) - SSL_set_tlsext_host_name(p->ssl, c->host); - /* Setup the SRTP context */ if (SSL_CTX_set_tlsext_use_srtp(p->ctx, profiles)) { av_log(p, AV_LOG_ERROR, "TLS: Init SSL_CTX_set_tlsext_use_srtp failed, profiles=%s, %s\n", @@ -855,6 +852,9 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary ** goto fail; } + if (!c->listen && !c->numerichost) + SSL_set_tlsext_host_name(p->ssl, c->host); + /* Setup the callback for logging. */ SSL_set_ex_data(p->ssl, 0, p); SSL_CTX_set_info_callback(p->ctx, openssl_info_callback);