You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
[Net] Fix HTTPRquest store_buffer error.
HTTPRquest no longer call store_buffer/append_array when the chunk size
is 0.
(cherry picked from commit 507a9beca1)
This commit is contained in:
committed by
Rémi Verschelde
parent
0f780084f9
commit
b6a5f8422a
@@ -322,17 +322,19 @@ bool HTTPRequest::_update_connection() {
|
||||
}
|
||||
|
||||
PoolByteArray chunk = client->read_response_body_chunk();
|
||||
downloaded.add(chunk.size());
|
||||
|
||||
if (file) {
|
||||
PoolByteArray::Read r = chunk.read();
|
||||
file->store_buffer(r.ptr(), chunk.size());
|
||||
if (file->get_error() != OK) {
|
||||
call_deferred("_request_done", RESULT_DOWNLOAD_FILE_WRITE_ERROR, response_code, response_headers, PoolByteArray());
|
||||
return true;
|
||||
if (chunk.size()) {
|
||||
downloaded.add(chunk.size());
|
||||
if (file) {
|
||||
PoolByteArray::Read r = chunk.read();
|
||||
file->store_buffer(r.ptr(), chunk.size());
|
||||
if (file->get_error() != OK) {
|
||||
call_deferred("_request_done", RESULT_DOWNLOAD_FILE_WRITE_ERROR, response_code, response_headers, PoolByteArray());
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
body.append_array(chunk);
|
||||
}
|
||||
} else {
|
||||
body.append_array(chunk);
|
||||
}
|
||||
|
||||
if (body_size_limit >= 0 && downloaded.get() > body_size_limit) {
|
||||
|
||||
Reference in New Issue
Block a user