diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2021-07-03 13:11:59 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2021-11-24 14:36:42 +0800 |
commit | c09ea8d45acdf02df30b658408137f2ca7be2533 (patch) | |
tree | 63d4352a3101286da56d57bd39ccd14e9e73eaeb /core/io/http_client_tcp.h | |
parent | c5ab537617d9461964e67bb135bb0818efe21d58 (diff) |
Adds proxy support for HTTPClient
Also fixed a potential infinite loop when connecting to server.
Diffstat (limited to 'core/io/http_client_tcp.h')
-rw-r--r-- | core/io/http_client_tcp.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/io/http_client_tcp.h b/core/io/http_client_tcp.h index 170afb551c..40a962925e 100644 --- a/core/io/http_client_tcp.h +++ b/core/io/http_client_tcp.h @@ -38,8 +38,14 @@ private: Status status = STATUS_DISCONNECTED; IP::ResolverID resolving = IP::RESOLVER_INVALID_ID; Array ip_candidates; - int conn_port = -1; + int conn_port = -1; // Server to make requests to String conn_host; + int server_port = -1; // Server to connect to (might be a proxy server) + String server_host; + int http_proxy_port = -1; // Proxy server for http requests + 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 blocking = false; @@ -58,6 +64,7 @@ private: Ref<StreamPeerTCP> tcp_connection; Ref<StreamPeer> connection; + Ref<HTTPClientTCP> proxy_client; // Negotiate with proxy server int response_num = 0; Vector<String> response_headers; @@ -87,6 +94,8 @@ public: void set_read_chunk_size(int p_size) override; int get_read_chunk_size() const override; Error poll() override; + void set_http_proxy(const String &p_host, int p_port) override; + void set_https_proxy(const String &p_host, int p_port) override; HTTPClientTCP(); }; |