Skip to content

Commit

Permalink
update out buf logic (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Jul 8, 2024
1 parent c49edcd commit 20a36af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)
project(yaLanTingLibs
VERSION 0.3.4
VERSION 0.3.5
DESCRIPTION "yaLanTingLibs"
HOMEPAGE_URL "https://github.com/alibaba/yalantinglibs"
LANGUAGES CXX
Expand Down
7 changes: 4 additions & 3 deletions include/ylt/standalone/cinatra/coro_http_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,8 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
async_download(std::move(uri), std::move(filename), std::move(range)));
}

bool is_body_in_out_buf() const { return !out_buf_.empty(); }

void reset() {
if (!has_closed())
close_socket(*socket_);
Expand Down Expand Up @@ -1780,9 +1782,8 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
bool is_out_buf = !out_buf_.empty();
if (is_out_buf) {
if (content_len > 0 && out_buf_.size() < content_len) {
data.status = 404;
data.net_err = std::make_error_code(std::errc::no_buffer_space);
co_return data;
out_buf_ = {};
is_out_buf = false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion include/ylt/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
// YLT_VERSION % 100 is the sub-minor version
// YLT_VERSION / 100 % 1000 is the minor version
// YLT_VERSION / 100000 is the major version
#define YLT_VERSION 304 // 0.3.4
#define YLT_VERSION 305 // 0.3.5

0 comments on commit 20a36af

Please sign in to comment.