diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index 07af7db27d..bfa5103596 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -509,6 +509,9 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op if (!shr->external_sock) { if ((ret = ff_tls_open_underlying(shr, h, uri, options)) < 0) goto fail; + } else if (!shr->host) { + if ((ret = ff_tls_parse_host(shr, shr->underlying_host, sizeof(shr->underlying_host), NULL, uri)) < 0) + goto fail; } #ifdef MBEDTLS_PSA_CRYPTO_C diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 7596a1a405..55e6e6b628 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -783,6 +783,9 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op if (!c->tls_shared.external_sock) { if ((ret = ff_tls_open_underlying(&c->tls_shared, h, uri, options)) < 0) goto fail; + } else if (!s->host) { + if ((ret = ff_tls_parse_host(s, s->underlying_host, sizeof(s->underlying_host), NULL, uri)) < 0) + goto fail; } // We want to support all versions of TLS >= 1.0, but not the deprecated