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
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cfg.connect_handler =
{
auto [a, b] = capy::test::make_stream_pair();
// drive b from the test as the "server"; hand a to the client
co_return { {}, capy::any_stream(std::move(a)) };
co_return { std::error_code(), capy::any_stream(std::move(a)) };
};

burl::client client(co_await capy::this_coro::executor, tls_ctx, cfg);
Expand Down
2 changes: 1 addition & 1 deletion example/nlohmann_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tag_invoke(burl::body_to_tag<nlohmann::json>, burl::response& resp)
auto doc = nlohmann::json::parse(sv, nullptr, false);
if(doc.is_discarded())
co_return { make_error_code(std::errc::bad_message), {} };
co_return { {}, std::move(doc) };
co_return { std::error_code(), std::move(doc) };
}
// end::body_to[]

Expand Down
9 changes: 9 additions & 0 deletions include/boost/burl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,30 @@
#include <boost/burl/any_request_body.hpp>
#include <boost/burl/client.hpp>
#include <boost/burl/conversion.hpp>
#include <boost/burl/cookie.hpp>
#include <boost/burl/cookie_jar.hpp>
#include <boost/burl/error.hpp>
#include <boost/burl/fields.hpp>
#include <boost/burl/fields_base.hpp>
#include <boost/burl/file.hpp>
#include <boost/burl/head_parser.hpp>
#include <boost/burl/json.hpp>
#include <boost/burl/message_head_base.hpp>
#include <boost/burl/message_reader.hpp>
#include <boost/burl/message_writer.hpp>
#include <boost/burl/multipart_form.hpp>
#include <boost/burl/parser.hpp>
#include <boost/burl/request.hpp>
#include <boost/burl/request_body.hpp>
#include <boost/burl/request_builder.hpp>
#include <boost/burl/request_head.hpp>
#include <boost/burl/request_head_base.hpp>
#include <boost/burl/request_parser.hpp>
#include <boost/burl/response.hpp>
#include <boost/burl/response_head.hpp>
#include <boost/burl/response_head_base.hpp>
#include <boost/burl/response_parser.hpp>
#include <boost/burl/serializer.hpp>
#include <boost/burl/static_fields.hpp>
#include <boost/burl/static_request_head.hpp>
#include <boost/burl/static_response_head.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/boost/burl/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class client
{
auto [a, b] = capy::test::make_stream_pair();
// drive b from the test; hand a to the client
co_return { {}, capy::any_stream(std::move(a)) };
co_return { std::error_code(), capy::any_stream(std::move(a)) };
};
@endcode
*/
Expand Down
4 changes: 2 additions & 2 deletions include/boost/burl/conversion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ struct body_from_tag
{
auto [ec, sv] = co_await resp.try_as_view();
if(ec)
co_return { ec, {} };
co_return { {}, my_type{ sv } };
co_return { ec, my_type{} };
co_return { std::error_code(), my_type{ sv } };
}
@endcode

Expand Down
60 changes: 60 additions & 0 deletions include/boost/burl/detail/flat_buffer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// Copyright (c) 2026 Mohammad Nejati
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/cppalliance/burl
//

#ifndef BOOST_BURL_DETAIL_FLAT_BUFFER_HPP
#define BOOST_BURL_DETAIL_FLAT_BUFFER_HPP

#include <boost/capy/buffers.hpp>

#include <cstddef>

namespace boost
{
namespace burl
{
namespace detail
{

struct flat_buffer
{
char* ptr = nullptr;
std::size_t cap = 0;
std::size_t pos = 0;
std::size_t len = 0;

bool
empty() const noexcept;

std::size_t
size() const noexcept;

std::size_t
capacity() const noexcept;

capy::const_buffer
data() const noexcept;

capy::mutable_buffer
prepare() const noexcept;

void
commit(std::size_t n) noexcept;

void
consume(std::size_t n) noexcept;

void
clear() noexcept;
};

} // namespace detail
} // namespace burl
} // namespace boost

#endif
8 changes: 4 additions & 4 deletions include/boost/burl/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ enum class error
*/
proxy_unsupported_version,

/** The request body size did not match its content length.
/** The message body size did not match its content length.

The number of bytes produced by the request body
differed from the `Content-Length` declared for the
request.
The number of bytes produced by the message body
differed from the `Content-Length` declared for it,
or a body was supplied for a message that has none.
*/
body_size_mismatch,

Expand Down
4 changes: 2 additions & 2 deletions include/boost/burl/message_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ read_some_(
else if(rec)
co_return { rec, rn };
if(rn != 0)
co_return { {}, rn };
co_return { std::error_code(), rn };
continue;
}

Expand Down Expand Up @@ -361,7 +361,7 @@ read_(
co_return { ec, total };
}

co_return { {}, total };
co_return { std::error_code(), total };
}

template<capy::ReadStream S>
Expand Down
Loading
Loading