diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-02-12 23:18:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-12 23:18:59 +0100 |
commit | 70fff42df5f1079cc5061f2a9a24c28890415b74 (patch) | |
tree | 12c03d794b81fc57bdc7a40cb98acae794652e7c /core | |
parent | 458bd83dfc95d8efbcf4f860d5bc10fa19b5164e (diff) | |
parent | 833994b2949cbdd191dfdb095bb96913a7b3b03a (diff) |
Merge pull request #7749 from Faless/fix_7697
HTTPClient properly handle partial data in non-blocking mode
Diffstat (limited to 'core')
-rw-r--r-- | core/io/http_client.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 63c8abbbad..fd06d27c1f 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -566,11 +566,13 @@ PoolByteArray HTTPClient::read_response_body_chunk() { int to_read = MIN(body_left,read_chunk_size); PoolByteArray ret; ret.resize(to_read); - PoolByteArray::Write w = ret.write(); int _offset = 0; while (to_read > 0) { int rec=0; - err = _get_http_data(w.ptr()+_offset,to_read,rec); + { + PoolByteArray::Write w = ret.write(); + err = _get_http_data(w.ptr()+_offset,to_read,rec); + } if (rec>0) { body_left-=rec; to_read-=rec; |