summaryrefslogtreecommitdiffstats
path: root/core/io/http_client_tcp.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-05-12 19:55:58 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-05-12 20:08:10 +0200
commiteeac6f8c7f070a9f4674bfa51ec35c57516311c0 (patch)
treeb060293d6c34c9b72dccbb1b76ec5a02a5cf452b /core/io/http_client_tcp.cpp
parent20ed51a9129f97bb8d001262155fb3ccfc1e3c89 (diff)
downloadredot-engine-eeac6f8c7f070a9f4674bfa51ec35c57516311c0.tar.gz
[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.
Diffstat (limited to 'core/io/http_client_tcp.cpp')
-rw-r--r--core/io/http_client_tcp.cpp1
1 files changed, 1 insertions, 0 deletions
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, Ref<TLSOp
}
ERR_FAIL_COND_V(tls_options.is_valid() && tls_options->is_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) {