Closed
Description
If the HTTP server the client is requesting from sends a large page, the client will not read all of the response, because there is only one call made to the socket recv() method.
Something like this will fix it:
@@ -508,10 +508,16 @@ bool read_content(Stream& strm, T& x)
{
auto len = get_header_value_int(x.headers, "Content-Length", 0);
if (len) {
x.body.assign(len, 0);
- if (!strm.read(&x.body[0], x.body.size())) {
- return false;
- }
+ auto r = 0;
+ while(r < len){
+ auto r_incr = strm.read(&x.body[r], x.body.size());
+ r += r_incr;
+ if(r_incr <= 0) break;
+ }
+ if (!r) {
+ return false;
+ }
}
return true;
}
Metadata
Metadata
Assignees
Labels
No labels