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
11 changes: 6 additions & 5 deletions include/boost/http_proto/impl/sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef BOOST_HTTP_PROTO_IMPL_SINK_HPP
#define BOOST_HTTP_PROTO_IMPL_SINK_HPP

#include <boost/buffers/mutable_buffer.hpp>
#include <boost/buffers/buffer.hpp>
#include <boost/buffers/range.hpp>
#include <boost/http_proto/detail/except.hpp>
#include <boost/assert.hpp>
Expand Down Expand Up @@ -59,10 +59,11 @@ write_impl(
p != tmp_end &&
it != end_);
rv += on_write(
buffers::const_buffer_span(
tmp, p - tmp),
it != end_ ||
more);
true,
boost::span<
buffers::const_buffer const>(
tmp, p - tmp),
it != end_ || more);
if(rv.ec.failed())
return rv;
}
Expand Down
8 changes: 4 additions & 4 deletions include/boost/http_proto/impl/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#define BOOST_BUFFERS_IMPL_SOURCE_HPP

#include <boost/http_proto/detail/except.hpp>
#include <boost/buffers/range.hpp>
#include <boost/buffers/type_traits.hpp>
#include <boost/assert.hpp>

namespace boost {
Expand Down Expand Up @@ -61,8 +59,10 @@ read_impl(
p != tmp_end &&
it != end_);
rv += on_read(
buffers::mutable_buffer_span(
tmp, p - tmp));
true,
boost::span<
buffers::mutable_buffer const>(
tmp, p - tmp));
if(rv.ec.failed())
return rv;
if(rv.finished)
Expand Down
11 changes: 5 additions & 6 deletions include/boost/http_proto/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
#include <boost/http_proto/header_limits.hpp>
#include <boost/http_proto/sink.hpp>

#include <boost/buffers/any_dynamic_buffer.hpp>
#include <boost/buffers/mutable_buffer_pair.hpp>
#include <boost/buffers/mutable_buffer_span.hpp>
#include <boost/buffers/type_traits.hpp>
#include <boost/buffers/dynamic_buffer.hpp>
#include <boost/buffers/buffer_pair.hpp>
#include <boost/core/span.hpp>
#include <boost/rts/context_fwd.hpp>

#include <cstddef>
Expand Down Expand Up @@ -77,12 +76,12 @@ class parser
/** The type of buffer returned from @ref prepare.
*/
using mutable_buffers_type =
buffers::mutable_buffer_span;
boost::span<buffers::mutable_buffer const>;

/** The type of buffer returned from @ref pull_body.
*/
using const_buffers_type =
buffers::const_buffer_span;
boost::span<buffers::const_buffer const>;

//--------------------------------------------
//
Expand Down
7 changes: 3 additions & 4 deletions include/boost/http_proto/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
#include <boost/http_proto/detail/workspace.hpp>
#include <boost/http_proto/source.hpp>

#include <boost/buffers/const_buffer_span.hpp>
#include <boost/buffers/mutable_buffer_pair.hpp>
#include <boost/buffers/type_traits.hpp>
#include <boost/buffers/buffer_pair.hpp>
#include <boost/core/span.hpp>
#include <boost/rts/context_fwd.hpp>
#include <boost/system/result.hpp>

Expand Down Expand Up @@ -65,7 +64,7 @@ class serializer
area.
*/
using const_buffers_type =
buffers::const_buffer_span;
boost::span<buffers::const_buffer const>;

/** Constructor.

Expand Down
21 changes: 11 additions & 10 deletions include/boost/http_proto/sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#define BOOST_HTTP_PROTO_SINK_HPP

#include <boost/http_proto/detail/config.hpp>
#include <boost/buffers/const_buffer_span.hpp>
#include <boost/buffers/type_traits.hpp>
#include <boost/buffers/buffer.hpp>
#include <boost/core/span.hpp>
#include <boost/system/error_code.hpp>
#include <cstddef>
#include <type_traits>
Expand Down Expand Up @@ -192,7 +192,8 @@ struct BOOST_SYMBOL_VISIBLE
virtual
results
on_write(
buffers::const_buffer_span bs,
bool boost_span_issue_202_workaround,
boost::span<const buffers::const_buffer> bs,
bool more);

private:
Expand All @@ -212,13 +213,13 @@ struct BOOST_SYMBOL_VISIBLE
return on_write(b, more);
}

results
write_impl(
buffers::const_buffer_span const& bs,
bool more)
{
return on_write(bs, more);
}
// results
// write_impl(
// boost::span<const buffers::const_buffer> const& bs,
// bool more)
// {
// return on_write(bs, more);
// }

template<class T>
results
Expand Down
19 changes: 10 additions & 9 deletions include/boost/http_proto/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#define BOOST_HTTP_PROTO_SOURCE_HPP

#include <boost/http_proto/detail/config.hpp>
#include <boost/buffers/mutable_buffer_span.hpp>
#include <boost/buffers/type_traits.hpp>
#include <boost/buffers/buffer.hpp>
#include <boost/core/span.hpp>
#include <boost/system/error_code.hpp>
#include <cstddef>
#include <type_traits>
Expand Down Expand Up @@ -195,7 +195,8 @@ struct BOOST_SYMBOL_VISIBLE
virtual
results
on_read(
buffers::mutable_buffer_span bs);
bool boost_span_issue_202_workaround,
boost::span<buffers::mutable_buffer const> bs);

private:
results
Expand All @@ -205,12 +206,12 @@ struct BOOST_SYMBOL_VISIBLE
return on_read(b);
}

results
read_impl(
buffers::mutable_buffer_span const& bs)
{
return on_read(bs);
}
// results
// read_impl(
// boost::span<buffers::mutable_buffer const> const& bs)
// {
// return on_read(bs);
// }

template<class T>
results
Expand Down
2 changes: 1 addition & 1 deletion include/boost/http_proto/string_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define BOOST_HTTP_PROTO_STRING_BODY_HPP

#include <boost/http_proto/detail/config.hpp>
#include <boost/buffers/const_buffer.hpp>
#include <boost/buffers/buffer.hpp>
#include <string>
#include <utility>

Expand Down
4 changes: 2 additions & 2 deletions src/detail/array_of_const_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <boost/http_proto/detail/except.hpp>

#include <boost/buffers/sans_prefix.hpp>
#include <boost/buffers/slice.hpp>

namespace boost {
namespace http_proto {
Expand All @@ -38,7 +38,7 @@ consume(std::size_t n)
auto* p = base_ + pos_;
if(n < p->size())
{
*p = buffers::sans_prefix(*p, n);
buffers::trim_front(*p, n);
return;
}
n -= p->size();
Expand Down
3 changes: 2 additions & 1 deletion src/detail/array_of_const_buffers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#ifndef BOOST_HTTP_PROTO_DETAIL_ARRAY_OF_BUFFERS_HPP
#define BOOST_HTTP_PROTO_DETAIL_ARRAY_OF_BUFFERS_HPP

#include <boost/buffers/const_buffer.hpp>
#include <boost/assert.hpp>
#include <boost/buffers/buffer.hpp>

#include <cstdint>

Expand Down
44 changes: 44 additions & 0 deletions src/detail/buffer_utils.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright (c) 2025 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/http_proto
//

#ifndef BOOST_HTTP_PROTO_DETAIL_BUFFER_UTILS_HPP
#define BOOST_HTTP_PROTO_DETAIL_BUFFER_UTILS_HPP

#include <boost/buffers/buffer.hpp>
#include <boost/buffers/slice.hpp>
#include <boost/core/span.hpp>

namespace boost {
namespace http_proto {
namespace detail {

template<
typename BufferSequence,
typename Buffer = typename BufferSequence::value_type>
boost::span<Buffer const>
make_span(BufferSequence const& mbp)
{
return { mbp.begin(), mbp.end() };
}

template<typename BufferSequence>
BufferSequence
prefix(
BufferSequence cbp,
std::size_t n)
{
buffers::keep_front(cbp, n);
return cbp;
}

} // detail
} // http_proto
} // boost

#endif
9 changes: 4 additions & 5 deletions src/detail/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "src/detail/filter.hpp"

#include <boost/buffers/front.hpp>
#include <boost/buffers/sans_prefix.hpp>
#include <boost/buffers/size.hpp>

namespace boost {
namespace http_proto {
Expand All @@ -21,7 +19,8 @@ namespace detail {
auto
filter::
process(
buffers::mutable_buffer_subspan out,
buffers::slice_of<
boost::span<const buffers::mutable_buffer>> out,
buffers::const_buffer_pair in,
bool more) -> results
{
Expand Down Expand Up @@ -58,8 +57,8 @@ process(
return rv;
}

out = buffers::sans_prefix(out, rs.out_bytes);
in = buffers::sans_prefix(in, rs.in_bytes);
buffers::trim_front(out, rs.out_bytes);
buffers::trim_front(in, rs.in_bytes);

if(buffers::size(out) == 0)
return rv;
Expand Down
8 changes: 5 additions & 3 deletions src/detail/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
#ifndef BOOST_HTTP_PROTO_DETAIL_FILTER_HPP
#define BOOST_HTTP_PROTO_DETAIL_FILTER_HPP

#include <boost/buffers/const_buffer_pair.hpp>
#include <boost/buffers/mutable_buffer_subspan.hpp>
#include <boost/buffers/buffer_pair.hpp>
#include <boost/buffers/slice.hpp>
#include <boost/core/span.hpp>
#include <boost/system/error_code.hpp>

namespace boost {
Expand Down Expand Up @@ -62,7 +63,8 @@ class filter

results
process(
buffers::mutable_buffer_subspan out,
buffers::slice_of<
boost::span<const buffers::mutable_buffer>> out,
buffers::const_buffer_pair in,
bool more);

Expand Down
Loading
Loading