summaryrefslogtreecommitdiff
path: root/scene/main/http_request.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/http_request.h')
-rw-r--r--scene/main/http_request.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index 7659d9e6d6..8dd433982b 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -1,9 +1,38 @@
+/*************************************************************************/
+/* http_request.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef HTTPREQUEST_H
#define HTTPREQUEST_H
#include "node.h"
#include "io/http_client.h"
#include "os/file_access.h"
+#include "os/thread.h"
class HTTPRequest : public Node {
@@ -41,7 +70,7 @@ private:
bool request_sent;
Ref<HTTPClient> client;
ByteArray body;
- bool use_threads;
+ volatile bool use_threads;
bool got_response;
int response_code;
@@ -52,7 +81,7 @@ private:
FileAccess *file;
int body_len;
- int downloaded;
+ volatile int downloaded;
int body_size_limit;
int redirections;
@@ -65,11 +94,19 @@ private:
void _redirect_request(const String& p_new_url);
+
bool _handle_response(bool *ret_value);
Error _parse_url(const String& p_url);
Error _request();
+ volatile bool thread_done;
+ volatile bool thread_request_quit;
+
+ Thread *thread;
+
+ void _request_done(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data);
+ static void _thread_func(void *p_userdata);
protected: