mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Improved performance of read_content_without_length
This commit is contained in:
parent
2aa35d5f53
commit
bde3fd9f78
1 changed files with 3 additions and 3 deletions
|
@ -896,15 +896,15 @@ inline void skip_content_with_length(Stream &strm, size_t len) {
|
|||
}
|
||||
|
||||
inline bool read_content_without_length(Stream &strm, std::string &out) {
|
||||
char buf[BUFSIZ];
|
||||
for (;;) {
|
||||
char byte;
|
||||
auto n = strm.read(&byte, 1);
|
||||
auto n = strm.read(buf, BUFSIZ);
|
||||
if (n < 0) {
|
||||
return false;
|
||||
} else if (n == 0) {
|
||||
return true;
|
||||
}
|
||||
out += byte;
|
||||
out.append(buf, n);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue