Skip to content

Commit

Permalink
Update coro_http_client.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
helintongh committed Jun 24, 2024
1 parent ad4bee5 commit 6179757
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions include/cinatra/coro_http_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1568,41 +1568,35 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
data.resp_body = unziped_str;
else
data.resp_body = reply;

head_buf_.consume(content_len);
data.eof = (head_buf_.size() == 0);
co_return;
}

if (encoding_type_ == content_encoding::deflate) {
else if (encoding_type_ == content_encoding::deflate) {
std::string inflate_str;
bool r = gzip_codec::inflate(reply, inflate_str);
if (r)
data.resp_body = inflate_str;
else
data.resp_body = reply;

head_buf_.consume(content_len);
data.eof = (head_buf_.size() == 0);
co_return;
}
#endif

#if defined(CINATRA_ENABLE_BROTLI) && defined(CINATRA_ENABLE_GZIP)
else if (encoding_type_ == content_encoding::br)
#endif
#if defined(CINATRA_ENABLE_BROTLI) && !defined(CINATRA_ENABLE_GZIP)
if (encoding_type_ == content_encoding::br)
#endif
#ifdef CINATRA_ENABLE_BROTLI
if (encoding_type_ == content_encoding::br) {
bool r = br_codec::brotli_decompress(reply, unbr_str_);
if (r)
data.resp_body = unbr_str_;
{
bool r = br_codec::brotli_decompress(reply, unbr_str_);
if (r)
data.resp_body = unbr_str_;
else
data.resp_body = reply;
}
#endif
#if defined(CINATRA_ENABLE_BROTLI) || defined(CINATRA_ENABLE_GZIP)
else
data.resp_body = reply;

head_buf_.consume(content_len);
data.eof = (head_buf_.size() == 0);
co_return;
}
#endif

data.resp_body = reply;
data.resp_body = reply;

head_buf_.consume(content_len);
}
Expand Down

0 comments on commit 6179757

Please sign in to comment.