summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-09-07 08:25:47 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-09-08 03:24:23 +0200
commita95d7924204c26b5ff64a82c24579a8cdf58dac2 (patch)
tree2145a843f8382a6da1689382f2a0c77125a89aec /core/io
parentfffdbb38e390a11d0dc0672ce1755148deee3e90 (diff)
[Net] Rename "ssl" references to "tls" in methods and members.
Diffstat (limited to 'core/io')
-rw-r--r--core/io/http_client.cpp4
-rw-r--r--core/io/http_client.h4
-rw-r--r--core/io/http_client_tcp.cpp56
-rw-r--r--core/io/http_client_tcp.h6
4 files changed, 35 insertions, 35 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 52b1120b2a..93a310e83b 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -138,7 +138,7 @@ PackedStringArray HTTPClient::_get_response_headers() {
}
void HTTPClient::_bind_methods() {
- ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "use_ssl", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(-1), DEFVAL(false), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "use_tls", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(-1), DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("set_connection", "connection"), &HTTPClient::set_connection);
ClassDB::bind_method(D_METHOD("get_connection"), &HTTPClient::get_connection);
ClassDB::bind_method(D_METHOD("request_raw", "method", "url", "headers", "body"), &HTTPClient::_request_raw);
@@ -190,7 +190,7 @@ void HTTPClient::_bind_methods() {
BIND_ENUM_CONSTANT(STATUS_REQUESTING); // Request in progress
BIND_ENUM_CONSTANT(STATUS_BODY); // Request resulted in body which must be read
BIND_ENUM_CONSTANT(STATUS_CONNECTION_ERROR);
- BIND_ENUM_CONSTANT(STATUS_SSL_HANDSHAKE_ERROR);
+ BIND_ENUM_CONSTANT(STATUS_TLS_HANDSHAKE_ERROR);
BIND_ENUM_CONSTANT(RESPONSE_CONTINUE);
BIND_ENUM_CONSTANT(RESPONSE_SWITCHING_PROTOCOLS);
diff --git a/core/io/http_client.h b/core/io/http_client.h
index de6045f647..0524b010f4 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -138,7 +138,7 @@ public:
STATUS_REQUESTING, // Request in progress
STATUS_BODY, // Request resulted in body, which must be read
STATUS_CONNECTION_ERROR,
- STATUS_SSL_HANDSHAKE_ERROR,
+ STATUS_TLS_HANDSHAKE_ERROR,
};
@@ -168,7 +168,7 @@ public:
Error verify_headers(const Vector<String> &p_headers);
virtual Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_size) = 0;
- virtual Error connect_to_host(const String &p_host, int p_port = -1, bool p_ssl = false, bool p_verify_host = true) = 0;
+ virtual Error connect_to_host(const String &p_host, int p_port = -1, bool p_tls = false, bool p_verify_host = true) = 0;
virtual void set_connection(const Ref<StreamPeer> &p_connection) = 0;
virtual Ref<StreamPeer> get_connection() const = 0;
diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp
index 7afab9ea09..5c1d00a330 100644
--- a/core/io/http_client_tcp.cpp
+++ b/core/io/http_client_tcp.cpp
@@ -39,7 +39,7 @@ HTTPClient *HTTPClientTCP::_create_func() {
return memnew(HTTPClientTCP);
}
-Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) {
+Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_tls, bool p_verify_host) {
close();
conn_port = p_port;
@@ -47,21 +47,21 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ss
ip_candidates.clear();
- ssl = p_ssl;
- ssl_verify_host = p_verify_host;
+ tls = p_tls;
+ tls_verify_host = p_verify_host;
String host_lower = conn_host.to_lower();
if (host_lower.begins_with("http://")) {
conn_host = conn_host.substr(7, conn_host.length() - 7);
} else if (host_lower.begins_with("https://")) {
- ssl = true;
+ tls = true;
conn_host = conn_host.substr(8, conn_host.length() - 8);
}
ERR_FAIL_COND_V(conn_host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER);
if (conn_port < 0) {
- if (ssl) {
+ if (tls) {
conn_port = PORT_HTTPS;
} else {
conn_port = PORT_HTTP;
@@ -70,11 +70,11 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ss
connection = tcp_connection;
- if (ssl && https_proxy_port != -1) {
+ if (tls && https_proxy_port != -1) {
proxy_client.instantiate(); // Needs proxy negotiation.
server_host = https_proxy_host;
server_port = https_proxy_port;
- } else if (!ssl && http_proxy_port != -1) {
+ } else if (!tls && http_proxy_port != -1) {
server_host = http_proxy_host;
server_port = http_proxy_port;
} else {
@@ -107,7 +107,7 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ss
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) {
+ if (tls) {
ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerTLS>(p_connection.ptr()),
"Connection is not a reference to a valid StreamPeerTLS object.");
}
@@ -156,7 +156,7 @@ Error HTTPClientTCP::request(Method p_method, const String &p_url, const Vector<
}
String uri = p_url;
- if (!ssl && http_proxy_port != -1) {
+ if (!tls && http_proxy_port != -1) {
uri = vformat("http://%s:%d%s", conn_host, conn_port, p_url);
}
@@ -181,7 +181,7 @@ Error HTTPClientTCP::request(Method p_method, const String &p_url, const Vector<
}
}
if (add_host) {
- if ((ssl && conn_port == PORT_HTTPS) || (!ssl && conn_port == PORT_HTTP)) {
+ if ((tls && conn_port == PORT_HTTPS) || (!tls && conn_port == PORT_HTTP)) {
// Don't append the standard ports.
request += "Host: " + conn_host + "\r\n";
} else {
@@ -316,7 +316,7 @@ Error HTTPClientTCP::poll() {
return OK;
} break;
case StreamPeerTCP::STATUS_CONNECTED: {
- if (ssl && proxy_client.is_valid()) {
+ if (tls && proxy_client.is_valid()) {
Error err = proxy_client->poll();
if (err == ERR_UNCONFIGURED) {
proxy_client->set_connection(tcp_connection);
@@ -357,42 +357,42 @@ Error HTTPClientTCP::poll() {
return ERR_CANT_CONNECT;
} break;
}
- } else if (ssl) {
- Ref<StreamPeerTLS> ssl;
+ } else if (tls) {
+ Ref<StreamPeerTLS> tls;
if (!handshaking) {
// 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);
+ tls = Ref<StreamPeerTLS>(StreamPeerTLS::create());
+ tls->set_blocking_handshake_enabled(false);
+ Error err = tls->connect_to_stream(tcp_connection, tls_verify_host, conn_host);
if (err != OK) {
close();
- status = STATUS_SSL_HANDSHAKE_ERROR;
+ status = STATUS_TLS_HANDSHAKE_ERROR;
return ERR_CANT_CONNECT;
}
- connection = ssl;
+ connection = tls;
handshaking = true;
} else {
- // We are already handshaking, which means we can use your already active SSL connection.
- ssl = static_cast<Ref<StreamPeerTLS>>(connection);
- if (ssl.is_null()) {
+ // We are already handshaking, which means we can use your already active TLS connection.
+ tls = static_cast<Ref<StreamPeerTLS>>(connection);
+ if (tls.is_null()) {
close();
- status = STATUS_SSL_HANDSHAKE_ERROR;
+ status = STATUS_TLS_HANDSHAKE_ERROR;
return ERR_CANT_CONNECT;
}
- ssl->poll(); // Try to finish the handshake.
+ tls->poll(); // Try to finish the handshake.
}
- if (ssl->get_status() == StreamPeerTLS::STATUS_CONNECTED) {
+ if (tls->get_status() == StreamPeerTLS::STATUS_CONNECTED) {
// Handshake has been successful.
handshaking = false;
ip_candidates.clear();
status = STATUS_CONNECTED;
return OK;
- } else if (ssl->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) {
+ } else if (tls->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) {
// Handshake has failed.
close();
- status = STATUS_SSL_HANDSHAKE_ERROR;
+ status = STATUS_TLS_HANDSHAKE_ERROR;
return ERR_CANT_CONNECT;
}
// ... we will need to poll more for handshake to finish.
@@ -421,7 +421,7 @@ Error HTTPClientTCP::poll() {
case STATUS_BODY:
case STATUS_CONNECTED: {
// Check if we are still connected.
- if (ssl) {
+ if (tls) {
Ref<StreamPeerTLS> tmp = connection;
tmp->poll();
if (tmp->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
@@ -548,7 +548,7 @@ Error HTTPClientTCP::poll() {
return ERR_UNCONFIGURED;
} break;
case STATUS_CONNECTION_ERROR:
- case STATUS_SSL_HANDSHAKE_ERROR: {
+ case STATUS_TLS_HANDSHAKE_ERROR: {
return ERR_CONNECTION_ERROR;
} break;
case STATUS_CANT_CONNECT: {
diff --git a/core/io/http_client_tcp.h b/core/io/http_client_tcp.h
index c10e0b1eca..744c15f7ab 100644
--- a/core/io/http_client_tcp.h
+++ b/core/io/http_client_tcp.h
@@ -46,8 +46,8 @@ private:
String http_proxy_host;
int https_proxy_port = -1; // Proxy server for https requests.
String https_proxy_host;
- bool ssl = false;
- bool ssl_verify_host = false;
+ bool tls = false;
+ bool tls_verify_host = false;
bool blocking = false;
bool handshaking = false;
bool head_request = false;
@@ -79,7 +79,7 @@ public:
Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_size) override;
- Error connect_to_host(const String &p_host, int p_port = -1, bool p_ssl = false, bool p_verify_host = true) override;
+ Error connect_to_host(const String &p_host, int p_port = -1, bool p_tls = false, bool p_verify_host = true) override;
void set_connection(const Ref<StreamPeer> &p_connection) override;
Ref<StreamPeer> get_connection() const override;
void close() override;