Add proxy support for HTTPClient and the editor

* Adds proxy related methods for `HTTPClient` and `HTTPRequest`
* Adds `network/http_proxy/{host,port}` editor settings
* Makes AssetLib and Export Template Manager proxy aware
This commit is contained in:
Haoyu Qiu 2021-12-16 18:43:29 +08:00
parent 3f137fb3a9
commit 1cada6bfa9
8 changed files with 186 additions and 12 deletions

View file

@ -463,6 +463,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;
@ -508,6 +516,9 @@ void HTTPRequest::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_download_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);
ClassDB::bind_method(D_METHOD("_timeout"), &HTTPRequest::_timeout);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "download_file", PROPERTY_HINT_FILE), "set_download_file", "get_download_file");