Fix javascript build error and improve #14604

This commit is contained in:
Fabio Alessandrelli 2017-12-15 15:32:44 +01:00
parent 433cb6f490
commit 206275f3e7
2 changed files with 5 additions and 5 deletions

View file

@ -56,11 +56,11 @@ Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,
String host_lower = conn_host.to_lower(); String host_lower = conn_host.to_lower();
if (host_lower.begins_with("http://")) { if (host_lower.begins_with("http://")) {
conn_host = conn_host.replace_first("http://", ""); conn_host = conn_host.substr(7, conn_host.length() - 7);
} else if (host_lower.begins_with("https://")) { } else if (host_lower.begins_with("https://")) {
ssl = true; ssl = true;
conn_host = conn_host.replace_first("https://", ""); conn_host = conn_host.substr(8, conn_host.length() - 8);
} }
ERR_FAIL_COND_V(conn_host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(conn_host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER);

View file

@ -42,12 +42,12 @@ Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,
host = p_host; host = p_host;
String host_lower = conn_host.to_lower(); String host_lower = host.to_lower();
if (host_lower.begins_with("http://")) { if (host_lower.begins_with("http://")) {
host.replace_first("http://", ""); host = host.substr(7, host.length() - 7);
} else if (host_lower.begins_with("https://")) { } else if (host_lower.begins_with("https://")) {
use_tls = true; use_tls = true;
host.replace_first("https://", ""); host = host.substr(8, host.length() - 8);
} }
ERR_FAIL_COND_V(host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER);