diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-07 09:19:46 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-07 09:19:46 +0200 |
commit | 61644f1dbe5389ed02a13f0940b05699db645919 (patch) | |
tree | 67a8522e138becd70a11ba4ebccf41991c4e780e | |
parent | 94361494fd45cfd1c51f80765e83566f589c5642 (diff) | |
parent | 528e791a5fa0032f335c6410d3e961851e29b325 (diff) |
Merge pull request #65447 from Faless/net/4.x_ssl_to_tls
[Net] Rename StreamPeerSSL to StreamPeerTLS.
21 files changed, 80 insertions, 79 deletions
diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp index 4aa1f2ed8c..7afab9ea09 100644 --- a/core/io/http_client_tcp.cpp +++ b/core/io/http_client_tcp.cpp @@ -32,7 +32,7 @@ #include "http_client_tcp.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/version.h" HTTPClient *HTTPClientTCP::_create_func() { @@ -108,8 +108,8 @@ void HTTPClientTCP::set_connection(const Ref<StreamPeer> &p_connection) { ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object."); if (ssl) { - ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerSSL>(p_connection.ptr()), - "Connection is not a reference to a valid StreamPeerSSL object."); + ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerTLS>(p_connection.ptr()), + "Connection is not a reference to a valid StreamPeerTLS object."); } if (connection == p_connection) { @@ -358,10 +358,10 @@ Error HTTPClientTCP::poll() { } break; } } else if (ssl) { - Ref<StreamPeerSSL> ssl; + Ref<StreamPeerTLS> ssl; if (!handshaking) { - // Connect the StreamPeerSSL and start handshaking. - ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create()); + // Connect the StreamPeerTLS and start handshaking. + ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create()); ssl->set_blocking_handshake_enabled(false); Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, conn_host); if (err != OK) { @@ -373,7 +373,7 @@ Error HTTPClientTCP::poll() { handshaking = true; } else { // We are already handshaking, which means we can use your already active SSL connection. - ssl = static_cast<Ref<StreamPeerSSL>>(connection); + ssl = static_cast<Ref<StreamPeerTLS>>(connection); if (ssl.is_null()) { close(); status = STATUS_SSL_HANDSHAKE_ERROR; @@ -383,13 +383,13 @@ Error HTTPClientTCP::poll() { ssl->poll(); // Try to finish the handshake. } - if (ssl->get_status() == StreamPeerSSL::STATUS_CONNECTED) { + if (ssl->get_status() == StreamPeerTLS::STATUS_CONNECTED) { // Handshake has been successful. handshaking = false; ip_candidates.clear(); status = STATUS_CONNECTED; return OK; - } else if (ssl->get_status() != StreamPeerSSL::STATUS_HANDSHAKING) { + } else if (ssl->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) { // Handshake has failed. close(); status = STATUS_SSL_HANDSHAKE_ERROR; @@ -422,9 +422,9 @@ Error HTTPClientTCP::poll() { case STATUS_CONNECTED: { // Check if we are still connected. if (ssl) { - Ref<StreamPeerSSL> tmp = connection; + Ref<StreamPeerTLS> tmp = connection; tmp->poll(); - if (tmp->get_status() != StreamPeerSSL::STATUS_CONNECTED) { + if (tmp->get_status() != StreamPeerTLS::STATUS_CONNECTED) { status = STATUS_CONNECTION_ERROR; return ERR_CONNECTION_ERROR; } diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_tls.cpp index 5b90fb52a6..b1adde018a 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_tls.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* stream_peer_ssl.cpp */ +/* stream_peer_tls.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,42 +28,42 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "stream_peer_ssl.h" +#include "stream_peer_tls.h" #include "core/config/engine.h" -StreamPeerSSL *(*StreamPeerSSL::_create)() = nullptr; +StreamPeerTLS *(*StreamPeerTLS::_create)() = nullptr; -StreamPeerSSL *StreamPeerSSL::create() { +StreamPeerTLS *StreamPeerTLS::create() { if (_create) { return _create(); } return nullptr; } -bool StreamPeerSSL::available = false; +bool StreamPeerTLS::available = false; -bool StreamPeerSSL::is_available() { +bool StreamPeerTLS::is_available() { return available; } -void StreamPeerSSL::set_blocking_handshake_enabled(bool p_enabled) { +void StreamPeerTLS::set_blocking_handshake_enabled(bool p_enabled) { blocking_handshake = p_enabled; } -bool StreamPeerSSL::is_blocking_handshake_enabled() const { +bool StreamPeerTLS::is_blocking_handshake_enabled() const { return blocking_handshake; } -void StreamPeerSSL::_bind_methods() { - ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSSL::poll); - ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerSSL::accept_stream, DEFVAL(Ref<X509Certificate>())); - ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>())); - ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status); - ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerSSL::get_stream); - ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerSSL::disconnect_from_stream); - ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerSSL::set_blocking_handshake_enabled); - ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerSSL::is_blocking_handshake_enabled); +void StreamPeerTLS::_bind_methods() { + ClassDB::bind_method(D_METHOD("poll"), &StreamPeerTLS::poll); + ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerTLS::accept_stream, DEFVAL(Ref<X509Certificate>())); + ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerTLS::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>())); + ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerTLS::get_status); + ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerTLS::get_stream); + ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerTLS::disconnect_from_stream); + ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerTLS::set_blocking_handshake_enabled); + ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerTLS::is_blocking_handshake_enabled); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blocking_handshake"), "set_blocking_handshake_enabled", "is_blocking_handshake_enabled"); diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_tls.h index fe68667adc..ed7334fab3 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_tls.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* stream_peer_ssl.h */ +/* stream_peer_tls.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,17 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef STREAM_PEER_SSL_H -#define STREAM_PEER_SSL_H +#ifndef STREAM_PEER_TLS_H +#define STREAM_PEER_TLS_H #include "core/crypto/crypto.h" #include "core/io/stream_peer.h" -class StreamPeerSSL : public StreamPeer { - GDCLASS(StreamPeerSSL, StreamPeer); +class StreamPeerTLS : public StreamPeer { + GDCLASS(StreamPeerTLS, StreamPeer); protected: - static StreamPeerSSL *(*_create)(); + static StreamPeerTLS *(*_create)(); static void _bind_methods(); static bool available; @@ -65,13 +65,13 @@ public: virtual void disconnect_from_stream() = 0; - static StreamPeerSSL *create(); + static StreamPeerTLS *create(); static bool is_available(); - StreamPeerSSL() {} + StreamPeerTLS() {} }; -VARIANT_ENUM_CAST(StreamPeerSSL::Status); +VARIANT_ENUM_CAST(StreamPeerTLS::Status); -#endif // STREAM_PEER_SSL_H +#endif // STREAM_PEER_TLS_H diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 7f734201e7..1b3f11ffab 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -58,7 +58,7 @@ #include "core/io/resource_format_binary.h" #include "core/io/resource_importer.h" #include "core/io/resource_uid.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/io/tcp_server.h" #include "core/io/translation_loader_po.h" #include "core/io/udp_server.h" @@ -202,7 +202,7 @@ void register_core_types() { ClassDB::register_custom_instance_class<CryptoKey>(); ClassDB::register_custom_instance_class<HMACContext>(); ClassDB::register_custom_instance_class<Crypto>(); - ClassDB::register_custom_instance_class<StreamPeerSSL>(); + ClassDB::register_custom_instance_class<StreamPeerTLS>(); ClassDB::register_custom_instance_class<PacketPeerDTLS>(); ClassDB::register_custom_instance_class<DTLSServer>(); diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml index dab2a77584..ade63225dc 100644 --- a/doc/classes/Crypto.xml +++ b/doc/classes/Crypto.xml @@ -110,7 +110,7 @@ <return type="CryptoKey" /> <param index="0" name="size" type="int" /> <description> - Generates an RSA [CryptoKey] that can be used for creating self-signed certificates and passed to [method StreamPeerSSL.accept_stream]. + Generates an RSA [CryptoKey] that can be used for creating self-signed certificates and passed to [method StreamPeerTLS.accept_stream]. </description> </method> <method name="generate_self_signed_certificate"> diff --git a/doc/classes/CryptoKey.xml b/doc/classes/CryptoKey.xml index 1f502846b4..7db810177f 100644 --- a/doc/classes/CryptoKey.xml +++ b/doc/classes/CryptoKey.xml @@ -5,7 +5,7 @@ </brief_description> <description> The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other [Resource]. - They can be used to generate a self-signed [X509Certificate] via [method Crypto.generate_self_signed_certificate] and as private key in [method StreamPeerSSL.accept_stream] along with the appropriate certificate. + They can be used to generate a self-signed [X509Certificate] via [method Crypto.generate_self_signed_certificate] and as private key in [method StreamPeerTLS.accept_stream] along with the appropriate certificate. </description> <tutorials> </tutorials> diff --git a/doc/classes/StreamPeerSSL.xml b/doc/classes/StreamPeerTLS.xml index 9d21b91416..f26c635aaa 100644 --- a/doc/classes/StreamPeerSSL.xml +++ b/doc/classes/StreamPeerTLS.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamPeerSSL" inherits="StreamPeer" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> +<class name="StreamPeerTLS" inherits="StreamPeer" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> SSL stream peer. </brief_description> @@ -28,7 +28,7 @@ <param index="2" name="for_hostname" type="String" default="""" /> <param index="3" name="valid_certificate" type="X509Certificate" default="null" /> <description> - Connects to a peer using an underlying [StreamPeer] [param stream]. If [param validate_certs] is [code]true[/code], [StreamPeerSSL] will validate that the certificate presented by the peer matches the [param for_hostname]. + Connects to a peer using an underlying [StreamPeer] [param stream]. If [param validate_certs] is [code]true[/code], [StreamPeerTLS] will validate that the certificate presented by the peer matches the [param for_hostname]. [b]Note:[/b] Specifying a custom [param valid_certificate] is not supported in Web exports due to browsers restrictions. </description> </method> @@ -39,7 +39,7 @@ </description> </method> <method name="get_status" qualifiers="const"> - <return type="int" enum="StreamPeerSSL.Status" /> + <return type="int" enum="StreamPeerTLS.Status" /> <description> Returns the status of the connection. See [enum Status] for values. </description> @@ -63,16 +63,16 @@ </members> <constants> <constant name="STATUS_DISCONNECTED" value="0" enum="Status"> - A status representing a [StreamPeerSSL] that is disconnected. + A status representing a [StreamPeerTLS] that is disconnected. </constant> <constant name="STATUS_HANDSHAKING" value="1" enum="Status"> - A status representing a [StreamPeerSSL] during handshaking. + A status representing a [StreamPeerTLS] during handshaking. </constant> <constant name="STATUS_CONNECTED" value="2" enum="Status"> - A status representing a [StreamPeerSSL] that is connected to a host. + A status representing a [StreamPeerTLS] that is connected to a host. </constant> <constant name="STATUS_ERROR" value="3" enum="Status"> - A status representing a [StreamPeerSSL] in error state. + A status representing a [StreamPeerTLS] in error state. </constant> <constant name="STATUS_ERROR_HOSTNAME_MISMATCH" value="4" enum="Status"> An error status that shows a mismatch in the SSL certificate domain presented by the host and the domain requested for validation. diff --git a/doc/classes/X509Certificate.xml b/doc/classes/X509Certificate.xml index d8f54d0ec5..94784583ad 100644 --- a/doc/classes/X509Certificate.xml +++ b/doc/classes/X509Certificate.xml @@ -5,7 +5,7 @@ </brief_description> <description> The X509Certificate class represents an X509 certificate. Certificates can be loaded and saved like any other [Resource]. - They can be used as the server certificate in [method StreamPeerSSL.accept_stream] (along with the proper [CryptoKey]), and to specify the only certificate that should be accepted when connecting to an SSL server via [method StreamPeerSSL.connect_to_stream]. + They can be used as the server certificate in [method StreamPeerTLS.accept_stream] (along with the proper [CryptoKey]), and to specify the only certificate that should be accepted when connecting to an SSL server via [method StreamPeerTLS.connect_to_stream]. </description> <tutorials> </tutorials> diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dc0235491f..96b229b7ee 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -37,7 +37,7 @@ #include "core/io/image_loader.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/object/class_db.h" #include "core/object/message_queue.h" #include "core/os/keyboard.h" diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 39762c0744..1231ac10ab 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -32,7 +32,7 @@ #include "core/input/input.h" #include "core/io/json.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/os/keyboard.h" #include "core/version.h" #include "editor/editor_file_dialog.h" @@ -1602,7 +1602,7 @@ bool AssetLibraryEditorPlugin::is_available() { // directly from GitHub which does not set CORS. return false; #else - return StreamPeerSSL::is_available(); + return StreamPeerTLS::is_available(); #endif } diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 7736717fcb..ad08629cf2 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -1478,6 +1478,7 @@ static const char *class_renames[][2] = { { "StreamCubemap", "CompressedCubemap" }, { "StreamCubemapArray", "CompressedCubemapArray" }, { "StreamPeerGDNative", "StreamPeerExtension" }, + { "StreamPeerSSL", "StreamPeerTLS" }, { "StreamTexture", "CompressedTexture2D" }, { "StreamTexture2D", "CompressedTexture2D" }, { "StreamTexture2DArray", "CompressedTexture2DArray" }, diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index b790199021..2b0d6f740a 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -35,7 +35,7 @@ #include "core/io/dir_access.h" #include "core/io/file_access.h" #include "core/io/resource_saver.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/io/zip_io.h" #include "core/os/keyboard.h" #include "core/os/os.h" diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp index 1296a4587c..78a06ff4a1 100644 --- a/modules/mbedtls/packet_peer_mbed_dtls.cpp +++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp @@ -32,7 +32,7 @@ #include "mbedtls/platform_util.h" #include "core/io/file_access.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) { if (buf == nullptr || len == 0) { diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp index 92590fbcf6..0bf4ca7032 100644 --- a/modules/mbedtls/stream_peer_mbedtls.cpp +++ b/modules/mbedtls/stream_peer_mbedtls.cpp @@ -302,7 +302,7 @@ Ref<StreamPeer> StreamPeerMbedTLS::get_stream() const { return base; } -StreamPeerSSL *StreamPeerMbedTLS::_create_func() { +StreamPeerTLS *StreamPeerMbedTLS::_create_func() { return memnew(StreamPeerMbedTLS); } diff --git a/modules/mbedtls/stream_peer_mbedtls.h b/modules/mbedtls/stream_peer_mbedtls.h index 68b07feea9..12d06d05ed 100644 --- a/modules/mbedtls/stream_peer_mbedtls.h +++ b/modules/mbedtls/stream_peer_mbedtls.h @@ -31,17 +31,17 @@ #ifndef STREAM_PEER_MBEDTLS_H #define STREAM_PEER_MBEDTLS_H -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "ssl_context_mbedtls.h" -class StreamPeerMbedTLS : public StreamPeerSSL { +class StreamPeerMbedTLS : public StreamPeerTLS { private: Status status = STATUS_DISCONNECTED; String hostname; Ref<StreamPeer> base; - static StreamPeerSSL *_create_func(); + static StreamPeerTLS *_create_func(); static int bio_recv(void *ctx, unsigned char *buf, size_t len); static int bio_send(void *ctx, const unsigned char *buf, size_t len); diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp index 2bb57226ea..290108706b 100644 --- a/modules/websocket/wsl_client.cpp +++ b/modules/websocket/wsl_client.cpp @@ -288,11 +288,11 @@ void WSLClient::poll() { break; case StreamPeerTCP::STATUS_CONNECTED: { _ip_candidates.clear(); - Ref<StreamPeerSSL> ssl; + Ref<StreamPeerTLS> ssl; if (_use_ssl) { if (_connection == _tcp) { // Start SSL handshake - ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create()); + ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create()); ERR_FAIL_COND_MSG(ssl.is_null(), "SSL is not available in this build."); ssl->set_blocking_handshake_enabled(false); if (ssl->connect_to_stream(_tcp, verify_ssl, _host, ssl_cert) != OK) { @@ -302,13 +302,13 @@ void WSLClient::poll() { } _connection = ssl; } else { - ssl = static_cast<Ref<StreamPeerSSL>>(_connection); + ssl = static_cast<Ref<StreamPeerTLS>>(_connection); ERR_FAIL_COND(ssl.is_null()); // Bug? ssl->poll(); } - if (ssl->get_status() == StreamPeerSSL::STATUS_HANDSHAKING) { + if (ssl->get_status() == StreamPeerTLS::STATUS_HANDSHAKING) { return; // Need more polling. - } else if (ssl->get_status() != StreamPeerSSL::STATUS_CONNECTED) { + } else if (ssl->get_status() != StreamPeerTLS::STATUS_CONNECTED) { disconnect_from_host(); _on_error(); return; // Error. diff --git a/modules/websocket/wsl_client.h b/modules/websocket/wsl_client.h index 5d90bc4034..dc4397f04a 100644 --- a/modules/websocket/wsl_client.h +++ b/modules/websocket/wsl_client.h @@ -34,8 +34,8 @@ #ifndef WEB_ENABLED #include "core/error/error_list.h" -#include "core/io/stream_peer_ssl.h" #include "core/io/stream_peer_tcp.h" +#include "core/io/stream_peer_tls.h" #include "websocket_client.h" #include "wsl_peer.h" #include "wslay/wslay.h" diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp index 7457ac7087..ddef360cf5 100644 --- a/modules/websocket/wsl_server.cpp +++ b/modules/websocket/wsl_server.cpp @@ -103,15 +103,15 @@ Error WSLServer::PendingPeer::do_handshake(const Vector<String> p_protocols, uin } if (use_ssl) { - Ref<StreamPeerSSL> ssl = static_cast<Ref<StreamPeerSSL>>(connection); + Ref<StreamPeerTLS> ssl = static_cast<Ref<StreamPeerTLS>>(connection); if (ssl.is_null()) { - ERR_FAIL_V_MSG(ERR_BUG, "Couldn't get StreamPeerSSL for WebSocket handshake."); + ERR_FAIL_V_MSG(ERR_BUG, "Couldn't get StreamPeerTLS for WebSocket handshake."); } ssl->poll(); - if (ssl->get_status() == StreamPeerSSL::STATUS_HANDSHAKING) { + if (ssl->get_status() == StreamPeerTLS::STATUS_HANDSHAKING) { return ERR_BUSY; - } else if (ssl->get_status() != StreamPeerSSL::STATUS_CONNECTED) { - print_verbose(vformat("WebSocket SSL connection error during handshake (StreamPeerSSL status code %d).", ssl->get_status())); + } else if (ssl->get_status() != StreamPeerTLS::STATUS_CONNECTED) { + print_verbose(vformat("WebSocket SSL connection error during handshake (StreamPeerTLS status code %d).", ssl->get_status())); return FAILED; } } @@ -248,7 +248,7 @@ void WSLServer::poll() { Ref<PendingPeer> peer = memnew(PendingPeer); if (private_key.is_valid() && ssl_cert.is_valid()) { - Ref<StreamPeerSSL> ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create()); + Ref<StreamPeerTLS> ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create()); ssl->set_blocking_handshake_enabled(false); ssl->accept_stream(conn, private_key, ssl_cert, ca_chain); peer->connection = ssl; diff --git a/modules/websocket/wsl_server.h b/modules/websocket/wsl_server.h index b0b7a6a5c9..ce91cfe888 100644 --- a/modules/websocket/wsl_server.h +++ b/modules/websocket/wsl_server.h @@ -36,8 +36,8 @@ #include "websocket_server.h" #include "wsl_peer.h" -#include "core/io/stream_peer_ssl.h" #include "core/io/stream_peer_tcp.h" +#include "core/io/stream_peer_tls.h" #include "core/io/tcp_server.h" class WSLServer : public WebSocketServer { diff --git a/platform/web/export/editor_http_server.h b/platform/web/export/editor_http_server.h index 38b9a66d7e..d0e23b1a77 100644 --- a/platform/web/export/editor_http_server.h +++ b/platform/web/export/editor_http_server.h @@ -32,7 +32,7 @@ #define WEB_EDITOR_HTTP_SERVER_H #include "core/io/image_loader.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/io/tcp_server.h" #include "core/io/zip_io.h" #include "editor/editor_paths.h" @@ -42,7 +42,7 @@ private: Ref<TCPServer> server; HashMap<String, String> mimes; Ref<StreamPeerTCP> tcp; - Ref<StreamPeerSSL> ssl; + Ref<StreamPeerTLS> ssl; Ref<StreamPeer> peer; Ref<CryptoKey> key; Ref<X509Certificate> cert; @@ -53,7 +53,7 @@ private: void _clear_client() { peer = Ref<StreamPeer>(); - ssl = Ref<StreamPeerSSL>(); + ssl = Ref<StreamPeerTLS>(); tcp = Ref<StreamPeerTCP>(); memset(req_buf, 0, sizeof(req_buf)); time = 0; @@ -203,7 +203,7 @@ public: if (use_ssl) { if (ssl.is_null()) { - ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create()); + ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create()); peer = ssl; ssl->set_blocking_handshake_enabled(false); if (ssl->accept_stream(tcp, key, cert) != OK) { @@ -212,11 +212,11 @@ public: } } ssl->poll(); - if (ssl->get_status() == StreamPeerSSL::STATUS_HANDSHAKING) { + if (ssl->get_status() == StreamPeerTLS::STATUS_HANDSHAKING) { // Still handshaking, keep waiting. return; } - if (ssl->get_status() != StreamPeerSSL::STATUS_CONNECTED) { + if (ssl->get_status() != StreamPeerTLS::STATUS_CONNECTED) { _clear_client(); return; } diff --git a/platform/web/export/export_plugin.h b/platform/web/export/export_plugin.h index 5b7ce5f708..f11e38df09 100644 --- a/platform/web/export/export_plugin.h +++ b/platform/web/export/export_plugin.h @@ -33,7 +33,7 @@ #include "core/config/project_settings.h" #include "core/io/image_loader.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/io/tcp_server.h" #include "core/io/zip_io.h" #include "editor/editor_node.h" |