Merge pull request #49226 from Faless/net/4.x_empty_chunk_fix
[Net] Fix HTTPRquest store_buffer error.
This commit is contained in:
commit
ff648e2504
@ -375,8 +375,9 @@ bool HTTPRequest::_update_connection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PackedByteArray chunk = client->read_response_body_chunk();
|
PackedByteArray chunk = client->read_response_body_chunk();
|
||||||
downloaded.add(chunk.size());
|
|
||||||
|
|
||||||
|
if (chunk.size()) {
|
||||||
|
downloaded.add(chunk.size());
|
||||||
if (file) {
|
if (file) {
|
||||||
const uint8_t *r = chunk.ptr();
|
const uint8_t *r = chunk.ptr();
|
||||||
file->store_buffer(r, chunk.size());
|
file->store_buffer(r, chunk.size());
|
||||||
@ -387,6 +388,7 @@ bool HTTPRequest::_update_connection() {
|
|||||||
} else {
|
} else {
|
||||||
body.append_array(chunk);
|
body.append_array(chunk);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (body_size_limit >= 0 && downloaded.get() > body_size_limit) {
|
if (body_size_limit >= 0 && downloaded.get() > body_size_limit) {
|
||||||
call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray());
|
call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user