Skip to content

Commit

Permalink
chunked and multipart also clean out buf (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Aug 12, 2024
1 parent 9fb50b7 commit 5d2f3f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/ylt/standalone/cinatra/coro_http_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1733,11 +1733,14 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
co_return data;
}

bool is_out_buf = false;

bool is_ranges = parser_.is_resp_ranges();
if (is_ranges) {
is_keep_alive = true;
}
if (parser_.is_chunked()) {
out_buf_ = {};
is_keep_alive = true;
if (head_buf_.size() > 0) {
const char *data_ptr =
Expand All @@ -1750,6 +1753,7 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
}

if (parser_.is_multipart()) {
out_buf_ = {};
is_keep_alive = true;
if (head_buf_.size() > 0) {
const char *data_ptr =
Expand Down Expand Up @@ -1786,7 +1790,7 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
total_len_ = parser_.total_len();
#endif

bool is_out_buf = !out_buf_.empty();
is_out_buf = !out_buf_.empty();
if (is_out_buf) {
if (content_len > 0 && out_buf_.size() < content_len) {
out_buf_ = {};
Expand Down

0 comments on commit 5d2f3f9

Please sign in to comment.