summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-12-16 10:06:14 +0100
committerGitHub <noreply@github.com>2021-12-16 10:06:14 +0100
commit75ed3d74e81b26dc07dba39982429e6d2ce00628 (patch)
treeb27b0260501b741067dc55e6768435025b07285f /scene/main
parentedd3ca45016a4ee8cc5f7c1108e1c71bfa2a86ab (diff)
parent5912dd296487242b528836efc9dd045356ec3593 (diff)
Merge pull request #55747 from timothyqiu/editor-proxy
Add proxy support for the editor
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/http_request.cpp11
-rw-r--r--scene/main/http_request.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 4797729871..2dbfb43ad3 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -554,6 +554,14 @@ int HTTPRequest::get_body_size() const {
return body_len;
}
+void HTTPRequest::set_http_proxy(const String &p_host, int p_port) {
+ client->set_http_proxy(p_host, p_port);
+}
+
+void HTTPRequest::set_https_proxy(const String &p_host, int p_port) {
+ client->set_https_proxy(p_host, p_port);
+}
+
void HTTPRequest::set_timeout(int p_timeout) {
ERR_FAIL_COND(p_timeout < 0);
timeout = p_timeout;
@@ -602,6 +610,9 @@ void HTTPRequest::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_download_chunk_size", "chunk_size"), &HTTPRequest::set_download_chunk_size);
ClassDB::bind_method(D_METHOD("get_download_chunk_size"), &HTTPRequest::get_download_chunk_size);
+ ClassDB::bind_method(D_METHOD("set_http_proxy", "host", "port"), &HTTPRequest::set_http_proxy);
+ ClassDB::bind_method(D_METHOD("set_https_proxy", "host", "port"), &HTTPRequest::set_https_proxy);
+
ADD_PROPERTY(PropertyInfo(Variant::STRING, "download_file", PROPERTY_HINT_FILE), "set_download_file", "get_download_file");
ADD_PROPERTY(PropertyInfo(Variant::INT, "download_chunk_size", PROPERTY_HINT_RANGE, "256,16777216"), "set_download_chunk_size", "get_download_chunk_size");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_threads"), "set_use_threads", "is_using_threads");
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index 673cf3a740..38c2f704ec 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -154,6 +154,9 @@ public:
int get_downloaded_bytes() const;
int get_body_size() const;
+ void set_http_proxy(const String &p_host, int p_port);
+ void set_https_proxy(const String &p_host, int p_port);
+
HTTPRequest();
~HTTPRequest();
};