Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ client::execute_impl(
http::response_parser parser(
http::make_parser_config(parser_cfg));

detail::serializer sr({});

auto url = request.url;
auto trusted = true;
auto followlocation = request.options.followlocation.value_or(config_.followlocation);
Expand Down Expand Up @@ -264,24 +266,17 @@ client::execute_impl(

// TODO: expect100timeout

capy::any_write_stream ws(&conn);
sr.reset(&ws, &headers);
if(request.body.has_value())
{
capy::any_write_stream ws(&conn);
detail::serializer sr(ws, headers);
capy::any_buffer_sink sink(&sr);
if(auto [wec] = co_await request.body.write(sink); wec)
co_return { wec, {} };
if(!sr.is_done())
{
if(auto [wec] = co_await sr.write_eof(); wec)
co_return { wec, {} };
}
}
else
if(!sr.is_done())
{
auto [wec, n] =
co_await capy::write(conn, capy::make_buffer(headers.buffer()));
if(wec)
if(auto [wec] = co_await sr.write_eof(); wec)
co_return { wec, {} };
}

Expand Down
Loading
Loading