mirror of
https://github.com/godotengine/godot
synced 2024-09-05 08:48:54 +00:00
[Net] Rename StreamPeerSSL to StreamPeerTLS.
SSL has been deprectated almost 10 years ago.
This commit is contained in:
parent
432c4c40a9
commit
528e791a5f
|
@ -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() {
|
||||
|
@ -104,8 +104,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) {
|
||||
|
@ -354,10 +354,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) {
|
||||
|
@ -369,7 +369,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;
|
||||
|
@ -379,13 +379,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;
|
||||
|
@ -418,9 +418,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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
@ -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
|
|
@ -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>();
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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.
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -1466,6 +1466,7 @@ static const char *class_renames[][2] = {
|
|||
{ "StreamCubemap", "CompressedCubemap" },
|
||||
{ "StreamCubemapArray", "CompressedCubemapArray" },
|
||||
{ "StreamPeerGDNative", "StreamPeerExtension" },
|
||||
{ "StreamPeerSSL", "StreamPeerTLS" },
|
||||
{ "StreamTexture", "CompressedTexture2D" },
|
||||
{ "StreamTexture2D", "CompressedTexture2D" },
|
||||
{ "StreamTexture2DArray", "CompressedTexture2DArray" },
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -302,7 +302,7 @@ Ref<StreamPeer> StreamPeerMbedTLS::get_stream() const {
|
|||
return base;
|
||||
}
|
||||
|
||||
StreamPeerSSL *StreamPeerMbedTLS::_create_func() {
|
||||
StreamPeerTLS *StreamPeerMbedTLS::_create_func() {
|
||||
return memnew(StreamPeerMbedTLS);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue