From bde3fd9f78831fa19b1ba0828eb1d5c4e7e10670 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 29 Jun 2019 20:25:16 -0400 Subject: [PATCH] Improved performance of read_content_without_length --- httplib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httplib.h b/httplib.h index 1215ab2..0b918f9 100644 --- a/httplib.h +++ b/httplib.h @@ -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;