mirror of
https://github.com/godotengine/godot
synced 2024-09-05 09:48:26 +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 "http_client_tcp.h"
|
||||||
|
|
||||||
#include "core/io/stream_peer_ssl.h"
|
#include "core/io/stream_peer_tls.h"
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
|
|
||||||
HTTPClient *HTTPClientTCP::_create_func() {
|
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.");
|
ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object.");
|
||||||
|
|
||||||
if (ssl) {
|
if (ssl) {
|
||||||
ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerSSL>(p_connection.ptr()),
|
ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerTLS>(p_connection.ptr()),
|
||||||
"Connection is not a reference to a valid StreamPeerSSL object.");
|
"Connection is not a reference to a valid StreamPeerTLS object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection == p_connection) {
|
if (connection == p_connection) {
|
||||||
|
@ -354,10 +354,10 @@ Error HTTPClientTCP::poll() {
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
} else if (ssl) {
|
} else if (ssl) {
|
||||||
Ref<StreamPeerSSL> ssl;
|
Ref<StreamPeerTLS> ssl;
|
||||||
if (!handshaking) {
|
if (!handshaking) {
|
||||||
// Connect the StreamPeerSSL and start handshaking.
|
// Connect the StreamPeerTLS and start handshaking.
|
||||||
ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create());
|
ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create());
|
||||||
ssl->set_blocking_handshake_enabled(false);
|
ssl->set_blocking_handshake_enabled(false);
|
||||||
Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, conn_host);
|
Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, conn_host);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
|
@ -369,7 +369,7 @@ Error HTTPClientTCP::poll() {
|
||||||
handshaking = true;
|
handshaking = true;
|
||||||
} else {
|
} else {
|
||||||
// We are already handshaking, which means we can use your already active SSL connection.
|
// 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()) {
|
if (ssl.is_null()) {
|
||||||
close();
|
close();
|
||||||
status = STATUS_SSL_HANDSHAKE_ERROR;
|
status = STATUS_SSL_HANDSHAKE_ERROR;
|
||||||
|
@ -379,13 +379,13 @@ Error HTTPClientTCP::poll() {
|
||||||
ssl->poll(); // Try to finish the handshake.
|
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.
|
// Handshake has been successful.
|
||||||
handshaking = false;
|
handshaking = false;
|
||||||
ip_candidates.clear();
|
ip_candidates.clear();
|
||||||
status = STATUS_CONNECTED;
|
status = STATUS_CONNECTED;
|
||||||
return OK;
|
return OK;
|
||||||
} else if (ssl->get_status() != StreamPeerSSL::STATUS_HANDSHAKING) {
|
} else if (ssl->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) {
|
||||||
// Handshake has failed.
|
// Handshake has failed.
|
||||||
close();
|
close();
|
||||||
status = STATUS_SSL_HANDSHAKE_ERROR;
|
status = STATUS_SSL_HANDSHAKE_ERROR;
|
||||||
|
@ -418,9 +418,9 @@ Error HTTPClientTCP::poll() {
|
||||||
case STATUS_CONNECTED: {
|
case STATUS_CONNECTED: {
|
||||||
// Check if we are still connected.
|
// Check if we are still connected.
|
||||||
if (ssl) {
|
if (ssl) {
|
||||||
Ref<StreamPeerSSL> tmp = connection;
|
Ref<StreamPeerTLS> tmp = connection;
|
||||||
tmp->poll();
|
tmp->poll();
|
||||||
if (tmp->get_status() != StreamPeerSSL::STATUS_CONNECTED) {
|
if (tmp->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
|
||||||
status = STATUS_CONNECTION_ERROR;
|
status = STATUS_CONNECTION_ERROR;
|
||||||
return ERR_CONNECTION_ERROR;
|
return ERR_CONNECTION_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* stream_peer_ssl.cpp */
|
/* stream_peer_tls.cpp */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
|
@ -28,42 +28,42 @@
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* 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"
|
#include "core/config/engine.h"
|
||||||
|
|
||||||
StreamPeerSSL *(*StreamPeerSSL::_create)() = nullptr;
|
StreamPeerTLS *(*StreamPeerTLS::_create)() = nullptr;
|
||||||
|
|
||||||
StreamPeerSSL *StreamPeerSSL::create() {
|
StreamPeerTLS *StreamPeerTLS::create() {
|
||||||
if (_create) {
|
if (_create) {
|
||||||
return _create();
|
return _create();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StreamPeerSSL::available = false;
|
bool StreamPeerTLS::available = false;
|
||||||
|
|
||||||
bool StreamPeerSSL::is_available() {
|
bool StreamPeerTLS::is_available() {
|
||||||
return 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;
|
blocking_handshake = p_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StreamPeerSSL::is_blocking_handshake_enabled() const {
|
bool StreamPeerTLS::is_blocking_handshake_enabled() const {
|
||||||
return blocking_handshake;
|
return blocking_handshake;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamPeerSSL::_bind_methods() {
|
void StreamPeerTLS::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSSL::poll);
|
ClassDB::bind_method(D_METHOD("poll"), &StreamPeerTLS::poll);
|
||||||
ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerSSL::accept_stream, DEFVAL(Ref<X509Certificate>()));
|
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"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()), 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"), &StreamPeerSSL::get_status);
|
ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerTLS::get_status);
|
||||||
ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerSSL::get_stream);
|
ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerTLS::get_stream);
|
||||||
ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerSSL::disconnect_from_stream);
|
ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerTLS::disconnect_from_stream);
|
||||||
ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerSSL::set_blocking_handshake_enabled);
|
ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerTLS::set_blocking_handshake_enabled);
|
||||||
ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerSSL::is_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");
|
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: */
|
/* This file is part of: */
|
||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
|
@ -28,17 +28,17 @@
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef STREAM_PEER_SSL_H
|
#ifndef STREAM_PEER_TLS_H
|
||||||
#define STREAM_PEER_SSL_H
|
#define STREAM_PEER_TLS_H
|
||||||
|
|
||||||
#include "core/crypto/crypto.h"
|
#include "core/crypto/crypto.h"
|
||||||
#include "core/io/stream_peer.h"
|
#include "core/io/stream_peer.h"
|
||||||
|
|
||||||
class StreamPeerSSL : public StreamPeer {
|
class StreamPeerTLS : public StreamPeer {
|
||||||
GDCLASS(StreamPeerSSL, StreamPeer);
|
GDCLASS(StreamPeerTLS, StreamPeer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static StreamPeerSSL *(*_create)();
|
static StreamPeerTLS *(*_create)();
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
static bool available;
|
static bool available;
|
||||||
|
@ -65,13 +65,13 @@ public:
|
||||||
|
|
||||||
virtual void disconnect_from_stream() = 0;
|
virtual void disconnect_from_stream() = 0;
|
||||||
|
|
||||||
static StreamPeerSSL *create();
|
static StreamPeerTLS *create();
|
||||||
|
|
||||||
static bool is_available();
|
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_format_binary.h"
|
||||||
#include "core/io/resource_importer.h"
|
#include "core/io/resource_importer.h"
|
||||||
#include "core/io/resource_uid.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/tcp_server.h"
|
||||||
#include "core/io/translation_loader_po.h"
|
#include "core/io/translation_loader_po.h"
|
||||||
#include "core/io/udp_server.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<CryptoKey>();
|
||||||
ClassDB::register_custom_instance_class<HMACContext>();
|
ClassDB::register_custom_instance_class<HMACContext>();
|
||||||
ClassDB::register_custom_instance_class<Crypto>();
|
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<PacketPeerDTLS>();
|
||||||
ClassDB::register_custom_instance_class<DTLSServer>();
|
ClassDB::register_custom_instance_class<DTLSServer>();
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
<return type="CryptoKey" />
|
<return type="CryptoKey" />
|
||||||
<param index="0" name="size" type="int" />
|
<param index="0" name="size" type="int" />
|
||||||
<description>
|
<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>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="generate_self_signed_certificate">
|
<method name="generate_self_signed_certificate">
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other [Resource].
|
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>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?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>
|
<brief_description>
|
||||||
SSL stream peer.
|
SSL stream peer.
|
||||||
</brief_description>
|
</brief_description>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<param index="2" name="for_hostname" type="String" default="""" />
|
<param index="2" name="for_hostname" type="String" default="""" />
|
||||||
<param index="3" name="valid_certificate" type="X509Certificate" default="null" />
|
<param index="3" name="valid_certificate" type="X509Certificate" default="null" />
|
||||||
<description>
|
<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.
|
[b]Note:[/b] Specifying a custom [param valid_certificate] is not supported in Web exports due to browsers restrictions.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_status" qualifiers="const">
|
<method name="get_status" qualifiers="const">
|
||||||
<return type="int" enum="StreamPeerSSL.Status" />
|
<return type="int" enum="StreamPeerTLS.Status" />
|
||||||
<description>
|
<description>
|
||||||
Returns the status of the connection. See [enum Status] for values.
|
Returns the status of the connection. See [enum Status] for values.
|
||||||
</description>
|
</description>
|
||||||
|
@ -63,16 +63,16 @@
|
||||||
</members>
|
</members>
|
||||||
<constants>
|
<constants>
|
||||||
<constant name="STATUS_DISCONNECTED" value="0" enum="Status">
|
<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>
|
||||||
<constant name="STATUS_HANDSHAKING" value="1" enum="Status">
|
<constant name="STATUS_HANDSHAKING" value="1" enum="Status">
|
||||||
A status representing a [StreamPeerSSL] during handshaking.
|
A status representing a [StreamPeerTLS] during handshaking.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="STATUS_CONNECTED" value="2" enum="Status">
|
<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>
|
||||||
<constant name="STATUS_ERROR" value="3" enum="Status">
|
<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>
|
||||||
<constant name="STATUS_ERROR_HOSTNAME_MISMATCH" value="4" enum="Status">
|
<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.
|
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>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
The X509Certificate class represents an X509 certificate. Certificates can be loaded and saved like any other [Resource].
|
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>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "core/io/image_loader.h"
|
#include "core/io/image_loader.h"
|
||||||
#include "core/io/resource_loader.h"
|
#include "core/io/resource_loader.h"
|
||||||
#include "core/io/resource_saver.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/class_db.h"
|
||||||
#include "core/object/message_queue.h"
|
#include "core/object/message_queue.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "core/input/input.h"
|
#include "core/input/input.h"
|
||||||
#include "core/io/json.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/os/keyboard.h"
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
#include "editor/editor_file_dialog.h"
|
#include "editor/editor_file_dialog.h"
|
||||||
|
@ -1602,7 +1602,7 @@ bool AssetLibraryEditorPlugin::is_available() {
|
||||||
// directly from GitHub which does not set CORS.
|
// directly from GitHub which does not set CORS.
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
return StreamPeerSSL::is_available();
|
return StreamPeerTLS::is_available();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1466,6 +1466,7 @@ static const char *class_renames[][2] = {
|
||||||
{ "StreamCubemap", "CompressedCubemap" },
|
{ "StreamCubemap", "CompressedCubemap" },
|
||||||
{ "StreamCubemapArray", "CompressedCubemapArray" },
|
{ "StreamCubemapArray", "CompressedCubemapArray" },
|
||||||
{ "StreamPeerGDNative", "StreamPeerExtension" },
|
{ "StreamPeerGDNative", "StreamPeerExtension" },
|
||||||
|
{ "StreamPeerSSL", "StreamPeerTLS" },
|
||||||
{ "StreamTexture", "CompressedTexture2D" },
|
{ "StreamTexture", "CompressedTexture2D" },
|
||||||
{ "StreamTexture2D", "CompressedTexture2D" },
|
{ "StreamTexture2D", "CompressedTexture2D" },
|
||||||
{ "StreamTexture2DArray", "CompressedTexture2DArray" },
|
{ "StreamTexture2DArray", "CompressedTexture2DArray" },
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "core/io/dir_access.h"
|
#include "core/io/dir_access.h"
|
||||||
#include "core/io/file_access.h"
|
#include "core/io/file_access.h"
|
||||||
#include "core/io/resource_saver.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/io/zip_io.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
|
|
||||||
#include "core/io/file_access.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) {
|
int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
|
||||||
if (buf == nullptr || len == 0) {
|
if (buf == nullptr || len == 0) {
|
||||||
|
|
|
@ -302,7 +302,7 @@ Ref<StreamPeer> StreamPeerMbedTLS::get_stream() const {
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamPeerSSL *StreamPeerMbedTLS::_create_func() {
|
StreamPeerTLS *StreamPeerMbedTLS::_create_func() {
|
||||||
return memnew(StreamPeerMbedTLS);
|
return memnew(StreamPeerMbedTLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,17 +31,17 @@
|
||||||
#ifndef STREAM_PEER_MBEDTLS_H
|
#ifndef STREAM_PEER_MBEDTLS_H
|
||||||
#define 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"
|
#include "ssl_context_mbedtls.h"
|
||||||
|
|
||||||
class StreamPeerMbedTLS : public StreamPeerSSL {
|
class StreamPeerMbedTLS : public StreamPeerTLS {
|
||||||
private:
|
private:
|
||||||
Status status = STATUS_DISCONNECTED;
|
Status status = STATUS_DISCONNECTED;
|
||||||
String hostname;
|
String hostname;
|
||||||
|
|
||||||
Ref<StreamPeer> base;
|
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_recv(void *ctx, unsigned char *buf, size_t len);
|
||||||
static int bio_send(void *ctx, const 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;
|
break;
|
||||||
case StreamPeerTCP::STATUS_CONNECTED: {
|
case StreamPeerTCP::STATUS_CONNECTED: {
|
||||||
_ip_candidates.clear();
|
_ip_candidates.clear();
|
||||||
Ref<StreamPeerSSL> ssl;
|
Ref<StreamPeerTLS> ssl;
|
||||||
if (_use_ssl) {
|
if (_use_ssl) {
|
||||||
if (_connection == _tcp) {
|
if (_connection == _tcp) {
|
||||||
// Start SSL handshake
|
// 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.");
|
ERR_FAIL_COND_MSG(ssl.is_null(), "SSL is not available in this build.");
|
||||||
ssl->set_blocking_handshake_enabled(false);
|
ssl->set_blocking_handshake_enabled(false);
|
||||||
if (ssl->connect_to_stream(_tcp, verify_ssl, _host, ssl_cert) != OK) {
|
if (ssl->connect_to_stream(_tcp, verify_ssl, _host, ssl_cert) != OK) {
|
||||||
|
@ -302,13 +302,13 @@ void WSLClient::poll() {
|
||||||
}
|
}
|
||||||
_connection = ssl;
|
_connection = ssl;
|
||||||
} else {
|
} else {
|
||||||
ssl = static_cast<Ref<StreamPeerSSL>>(_connection);
|
ssl = static_cast<Ref<StreamPeerTLS>>(_connection);
|
||||||
ERR_FAIL_COND(ssl.is_null()); // Bug?
|
ERR_FAIL_COND(ssl.is_null()); // Bug?
|
||||||
ssl->poll();
|
ssl->poll();
|
||||||
}
|
}
|
||||||
if (ssl->get_status() == StreamPeerSSL::STATUS_HANDSHAKING) {
|
if (ssl->get_status() == StreamPeerTLS::STATUS_HANDSHAKING) {
|
||||||
return; // Need more polling.
|
return; // Need more polling.
|
||||||
} else if (ssl->get_status() != StreamPeerSSL::STATUS_CONNECTED) {
|
} else if (ssl->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
|
||||||
disconnect_from_host();
|
disconnect_from_host();
|
||||||
_on_error();
|
_on_error();
|
||||||
return; // Error.
|
return; // Error.
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
#ifndef WEB_ENABLED
|
#ifndef WEB_ENABLED
|
||||||
|
|
||||||
#include "core/error/error_list.h"
|
#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_tcp.h"
|
||||||
|
#include "core/io/stream_peer_tls.h"
|
||||||
#include "websocket_client.h"
|
#include "websocket_client.h"
|
||||||
#include "wsl_peer.h"
|
#include "wsl_peer.h"
|
||||||
#include "wslay/wslay.h"
|
#include "wslay/wslay.h"
|
||||||
|
|
|
@ -103,15 +103,15 @@ Error WSLServer::PendingPeer::do_handshake(const Vector<String> p_protocols, uin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_ssl) {
|
if (use_ssl) {
|
||||||
Ref<StreamPeerSSL> ssl = static_cast<Ref<StreamPeerSSL>>(connection);
|
Ref<StreamPeerTLS> ssl = static_cast<Ref<StreamPeerTLS>>(connection);
|
||||||
if (ssl.is_null()) {
|
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();
|
ssl->poll();
|
||||||
if (ssl->get_status() == StreamPeerSSL::STATUS_HANDSHAKING) {
|
if (ssl->get_status() == StreamPeerTLS::STATUS_HANDSHAKING) {
|
||||||
return ERR_BUSY;
|
return ERR_BUSY;
|
||||||
} else if (ssl->get_status() != StreamPeerSSL::STATUS_CONNECTED) {
|
} else if (ssl->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
|
||||||
print_verbose(vformat("WebSocket SSL connection error during handshake (StreamPeerSSL status code %d).", ssl->get_status()));
|
print_verbose(vformat("WebSocket SSL connection error during handshake (StreamPeerTLS status code %d).", ssl->get_status()));
|
||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ void WSLServer::poll() {
|
||||||
|
|
||||||
Ref<PendingPeer> peer = memnew(PendingPeer);
|
Ref<PendingPeer> peer = memnew(PendingPeer);
|
||||||
if (private_key.is_valid() && ssl_cert.is_valid()) {
|
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->set_blocking_handshake_enabled(false);
|
||||||
ssl->accept_stream(conn, private_key, ssl_cert, ca_chain);
|
ssl->accept_stream(conn, private_key, ssl_cert, ca_chain);
|
||||||
peer->connection = ssl;
|
peer->connection = ssl;
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
#include "websocket_server.h"
|
#include "websocket_server.h"
|
||||||
#include "wsl_peer.h"
|
#include "wsl_peer.h"
|
||||||
|
|
||||||
#include "core/io/stream_peer_ssl.h"
|
|
||||||
#include "core/io/stream_peer_tcp.h"
|
#include "core/io/stream_peer_tcp.h"
|
||||||
|
#include "core/io/stream_peer_tls.h"
|
||||||
#include "core/io/tcp_server.h"
|
#include "core/io/tcp_server.h"
|
||||||
|
|
||||||
class WSLServer : public WebSocketServer {
|
class WSLServer : public WebSocketServer {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#define WEB_EDITOR_HTTP_SERVER_H
|
#define WEB_EDITOR_HTTP_SERVER_H
|
||||||
|
|
||||||
#include "core/io/image_loader.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/tcp_server.h"
|
||||||
#include "core/io/zip_io.h"
|
#include "core/io/zip_io.h"
|
||||||
#include "editor/editor_paths.h"
|
#include "editor/editor_paths.h"
|
||||||
|
@ -42,7 +42,7 @@ private:
|
||||||
Ref<TCPServer> server;
|
Ref<TCPServer> server;
|
||||||
HashMap<String, String> mimes;
|
HashMap<String, String> mimes;
|
||||||
Ref<StreamPeerTCP> tcp;
|
Ref<StreamPeerTCP> tcp;
|
||||||
Ref<StreamPeerSSL> ssl;
|
Ref<StreamPeerTLS> ssl;
|
||||||
Ref<StreamPeer> peer;
|
Ref<StreamPeer> peer;
|
||||||
Ref<CryptoKey> key;
|
Ref<CryptoKey> key;
|
||||||
Ref<X509Certificate> cert;
|
Ref<X509Certificate> cert;
|
||||||
|
@ -53,7 +53,7 @@ private:
|
||||||
|
|
||||||
void _clear_client() {
|
void _clear_client() {
|
||||||
peer = Ref<StreamPeer>();
|
peer = Ref<StreamPeer>();
|
||||||
ssl = Ref<StreamPeerSSL>();
|
ssl = Ref<StreamPeerTLS>();
|
||||||
tcp = Ref<StreamPeerTCP>();
|
tcp = Ref<StreamPeerTCP>();
|
||||||
memset(req_buf, 0, sizeof(req_buf));
|
memset(req_buf, 0, sizeof(req_buf));
|
||||||
time = 0;
|
time = 0;
|
||||||
|
@ -203,7 +203,7 @@ public:
|
||||||
|
|
||||||
if (use_ssl) {
|
if (use_ssl) {
|
||||||
if (ssl.is_null()) {
|
if (ssl.is_null()) {
|
||||||
ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create());
|
ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create());
|
||||||
peer = ssl;
|
peer = ssl;
|
||||||
ssl->set_blocking_handshake_enabled(false);
|
ssl->set_blocking_handshake_enabled(false);
|
||||||
if (ssl->accept_stream(tcp, key, cert) != OK) {
|
if (ssl->accept_stream(tcp, key, cert) != OK) {
|
||||||
|
@ -212,11 +212,11 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ssl->poll();
|
ssl->poll();
|
||||||
if (ssl->get_status() == StreamPeerSSL::STATUS_HANDSHAKING) {
|
if (ssl->get_status() == StreamPeerTLS::STATUS_HANDSHAKING) {
|
||||||
// Still handshaking, keep waiting.
|
// Still handshaking, keep waiting.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ssl->get_status() != StreamPeerSSL::STATUS_CONNECTED) {
|
if (ssl->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
|
||||||
_clear_client();
|
_clear_client();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
#include "core/io/image_loader.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/tcp_server.h"
|
||||||
#include "core/io/zip_io.h"
|
#include "core/io/zip_io.h"
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
|
|
Loading…
Reference in a new issue