http: Skip processing response body for void.

No need to decompress or copy between buffers.
This commit is contained in:
Unknown W. Brackets committed 2021-05-01 11:20:05 -07:00
1 parent 20443571bd
commit 1459c16fb8
4 files changed
+29 -18

No files matched your search

+17 -15
View File
@@ -432,23 +432,25 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
}
// output now contains the rest of the reply. Dechunk it.
if (chunked) {
DeChunk(readbuf, output, contentLength, &progress->progress);
} else {
output->Append(*readbuf);
}
if (!output->IsVoid()) {
if (chunked) {
DeChunk(readbuf, output, contentLength, &progress->progress);
} else {
output->Append(*readbuf);
}
// If it's gzipped, we decompress it and put it back in the buffer.
if (gzip) {
std::string compressed, decompressed;
output->TakeAll(&compressed);
bool result = decompress_string(compressed, &decompressed);
if (!result) {
ERROR_LOG(IO, "Error decompressing using zlib");
progress->progress = 0.0f;
return -1;
// If it's gzipped, we decompress it and put it back in the buffer.
if (gzip) {
std::string compressed, decompressed;
output->TakeAll(&compressed);
bool result = decompress_string(compressed, &decompressed);
if (!result) {
ERROR_LOG(IO, "Error decompressing using zlib");
progress->progress = 0.0f;
return -1;
}
output->Append(decompressed);
}
output->Append(decompressed);
}
progress->progress = 1.0f;