From 206275f3e70187252c4b80ec0ba33f390e47f2ec Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Fri, 15 Dec 2017 15:32:44 +0100 Subject: [PATCH] Fix javascript build error and improve #14604 --- core/io/http_client.cpp | 4 ++-- platform/javascript/http_client_javascript.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index c865ce4669d..e457a4ac1eb 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -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(); 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://")) { 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); diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index 9ce27c9a042..b170ba6f35c 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -42,12 +42,12 @@ Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl, host = p_host; - String host_lower = conn_host.to_lower(); + String host_lower = host.to_lower(); if (host_lower.begins_with("http://")) { - host.replace_first("http://", ""); + host = host.substr(7, host.length() - 7); } else if (host_lower.begins_with("https://")) { 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);