diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-07-09 14:50:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-09 14:50:12 +0200 |
commit | 7f80c1dca8892cab4f4fe7a2daf6699755024f09 (patch) | |
tree | 0d2cd4984475be69e6153997a3524b1a285ae316 /scene/main/http_request.h | |
parent | 8d6a95347537c5e3084f269bdf98d1128b67b29b (diff) | |
parent | 5fe5c4e8f11b683dc60c6ec992ed89f93e898fba (diff) | |
download | redot-engine-7f80c1dca8892cab4f4fe7a2daf6699755024f09.tar.gz |
Merge pull request #30315 from zaksnet/httprequest-add-timeout
Add optional timeout to HTTPRequest
Diffstat (limited to 'scene/main/http_request.h')
-rw-r--r-- | scene/main/http_request.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scene/main/http_request.h b/scene/main/http_request.h index 2e58d579ba..f1f91235a6 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -35,6 +35,7 @@ #include "core/os/file_access.h" #include "core/os/thread.h" #include "node.h" +#include "scene/main/timer.h" class HTTPRequest : public Node { @@ -53,7 +54,8 @@ public: RESULT_REQUEST_FAILED, RESULT_DOWNLOAD_FILE_CANT_OPEN, RESULT_DOWNLOAD_FILE_WRITE_ERROR, - RESULT_REDIRECT_LIMIT_REACHED + RESULT_REDIRECT_LIMIT_REACHED, + RESULT_TIMEOUT }; @@ -92,6 +94,8 @@ private: int max_redirects; + int timeout; + void _redirect_request(const String &p_new_url); bool _handle_response(bool *ret_value); @@ -128,6 +132,13 @@ public: void set_max_redirects(int p_max); int get_max_redirects() const; + Timer *timer; + + void set_timeout(int p_timeout); + int get_timeout(); + + void _timeout(); + int get_downloaded_bytes() const; int get_body_size() const; |