From 238b8357a313dcb90c86f95a0d52c99dee444875 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 18 May 2023 19:22:23 +0200 Subject: [TLS] Fix crashes trying to use TLS when not available. If no StreamPeerTLS implementation is available, HTTPClient and WebSocketPeer will now correctly refuse to connect using TLS returning ERR_UNAVAILABLE. Similarly, ENetConnection will refuse to setup DTLS when PacketPeerDTLS is not available. (cherry picked from commit eeac6f8c7f070a9f4674bfa51ec35c57516311c0) --- core/io/http_client_tcp.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'core') diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp index 3788fa501e..2f45238951 100644 --- a/core/io/http_client_tcp.cpp +++ b/core/io/http_client_tcp.cpp @@ -60,6 +60,7 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, Refis_server(), ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V_MSG(tls_options.is_valid() && !StreamPeerTLS::is_available(), ERR_UNAVAILABLE, "HTTPS is not available in this build."); ERR_FAIL_COND_V(conn_host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER); if (conn_port < 0) { -- cgit v1.2.3