Skip to content

Commit

Permalink
fix #626
Browse files Browse the repository at this point in the history
  • Loading branch information
bruvey authored and gittiver committed Jan 9, 2024
1 parent 17034ad commit 78d1d2b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions include/crow/http_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace crow
// HTTP 1.1 Expect: 100-continue
if (req_.http_ver_major == 1 && req_.http_ver_minor == 1 && get_header_value(req_.headers, "expect") == "100-continue")
{
continue_requested = true;
buffers_.clear();
static std::string expect_100_continue = "HTTP/1.1 100 Continue\r\n\r\n";
buffers_.emplace_back(expect_100_continue.data(), expect_100_continue.size());
Expand Down Expand Up @@ -512,8 +513,16 @@ namespace crow
adaptor_.socket(), buffers_,
[self](const asio::error_code& ec, std::size_t /*bytes_transferred*/) {
self->res.clear();
self->res_body_copy_.clear();
self->parser_.clear();
self->res_body_copy_.clear();
if (!self->continue_requested)
{
self->parser_.clear();
}
else
{
self->continue_requested = false;
}

if (!ec)
{
if (self->close_connection_)
Expand Down Expand Up @@ -591,6 +600,7 @@ namespace crow

detail::task_timer::identifier_type task_id_{};

bool continue_requested{};
bool need_to_call_after_handlers_{};
bool need_to_start_read_after_complete_{};
bool add_keep_alive_{};
Expand Down

0 comments on commit 78d1d2b

Please sign in to comment.