diff --git a/include/crow/http_connection.h b/include/crow/http_connection.h index 5671d5f0b..c059ce8d9 100644 --- a/include/crow/http_connection.h +++ b/include/crow/http_connection.h @@ -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()); @@ -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_) @@ -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_{};