From 3f36ca73235defd8ec09cbe758218b4214806f2d Mon Sep 17 00:00:00 2001 From: Zak Date: Fri, 17 Jan 2020 20:21:49 +0200 Subject: [PATCH] HTTPRequest: Improve response when disconnecting 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. (cherry picked from commit 70c39737db18619a9ac37264ab0f9187871e7907) --- scene/main/http_request.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 8a5ccce375b..ec49689acaa 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -347,6 +347,9 @@ bool HTTPRequest::_update_connection() { } client->poll(); + if (client->get_status() != HTTPClient::STATUS_BODY) { + return false; + } PoolByteArray chunk = client->read_response_body_chunk(); downloaded.add(chunk.size());