From 70c39737db18619a9ac37264ab0f9187871e7907 Mon Sep 17 00:00:00 2001 From: Zak Date: Fri, 17 Jan 2020 20:21:49 +0200 Subject: [PATCH 1/2] Disconnect while downloading Previously if a disconnect occured while downloading a non recoverable error was displayed. This PR attempts to fix this by making sure `request_completed` signal is emitted with an `STATUS_CONNECTION_ERROR` response code. --- scene/main/http_request.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 3c890698164..e89000f21b9 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -349,6 +349,8 @@ bool HTTPRequest::_update_connection() { } client->poll(); + if (client->get_status() != HTTPClient::STATUS_BODY) + break; // State changed after this poll, will check at next iteration. PoolByteArray chunk = client->read_response_body_chunk(); downloaded += chunk.size(); From bc8fe786b2fa4ad4bfb10daeb9bfe38eddfc2496 Mon Sep 17 00:00:00 2001 From: Zak Stam Date: Sat, 27 Feb 2021 18:01:40 +0100 Subject: [PATCH 2/2] Update scene/main/http_request.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: RĂ©mi Verschelde --- scene/main/http_request.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index e89000f21b9..a391ac47772 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -349,8 +349,9 @@ bool HTTPRequest::_update_connection() { } client->poll(); - if (client->get_status() != HTTPClient::STATUS_BODY) - break; // State changed after this poll, will check at next iteration. + if (client->get_status() != HTTPClient::STATUS_BODY) { + return false; + } PoolByteArray chunk = client->read_response_body_chunk(); downloaded += chunk.size();