Skip to content

Commit c9f71c2

Browse files
committed
sync with boost.buffers changes
1 parent d970216 commit c9f71c2

23 files changed

Lines changed: 161 additions & 148 deletions

include/boost/http_proto/impl/sink.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef BOOST_HTTP_PROTO_IMPL_SINK_HPP
1111
#define BOOST_HTTP_PROTO_IMPL_SINK_HPP
1212

13-
#include <boost/buffers/mutable_buffer.hpp>
13+
#include <boost/buffers/buffer.hpp>
1414
#include <boost/buffers/range.hpp>
1515
#include <boost/http_proto/detail/except.hpp>
1616
#include <boost/assert.hpp>
@@ -58,11 +58,10 @@ write_impl(
5858
while(
5959
p != tmp_end &&
6060
it != end_);
61-
rv += on_write(
62-
buffers::const_buffer_span(
61+
rv += on_write(boost::span<
62+
buffers::const_buffer const>(
6363
tmp, p - tmp),
64-
it != end_ ||
65-
more);
64+
it != end_ || more);
6665
if(rv.ec.failed())
6766
return rv;
6867
}

include/boost/http_proto/impl/source.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#define BOOST_BUFFERS_IMPL_SOURCE_HPP
1212

1313
#include <boost/http_proto/detail/except.hpp>
14-
#include <boost/buffers/range.hpp>
15-
#include <boost/buffers/type_traits.hpp>
1614
#include <boost/assert.hpp>
1715

1816
namespace boost {
@@ -60,8 +58,8 @@ read_impl(
6058
while(
6159
p != tmp_end &&
6260
it != end_);
63-
rv += on_read(
64-
buffers::mutable_buffer_span(
61+
rv += on_read(boost::span<
62+
buffers::mutable_buffer const>(
6563
tmp, p - tmp));
6664
if(rv.ec.failed())
6765
return rv;

include/boost/http_proto/parser.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
#include <boost/http_proto/header_limits.hpp>
1919
#include <boost/http_proto/sink.hpp>
2020

21-
#include <boost/buffers/any_dynamic_buffer.hpp>
22-
#include <boost/buffers/mutable_buffer_pair.hpp>
23-
#include <boost/buffers/mutable_buffer_span.hpp>
24-
#include <boost/buffers/type_traits.hpp>
21+
#include <boost/buffers/dynamic_buffer.hpp>
22+
#include <boost/buffers/buffer_pair.hpp>
23+
#include <boost/core/span.hpp>
2524
#include <boost/rts/context_fwd.hpp>
2625

2726
#include <cstddef>
@@ -77,12 +76,12 @@ class parser
7776
/** The type of buffer returned from @ref prepare.
7877
*/
7978
using mutable_buffers_type =
80-
buffers::mutable_buffer_span;
79+
boost::span<buffers::mutable_buffer const>;
8180

8281
/** The type of buffer returned from @ref pull_body.
8382
*/
8483
using const_buffers_type =
85-
buffers::const_buffer_span;
84+
boost::span<buffers::const_buffer const>;
8685

8786
//--------------------------------------------
8887
//

include/boost/http_proto/serializer.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
#include <boost/http_proto/detail/workspace.hpp>
1616
#include <boost/http_proto/source.hpp>
1717

18-
#include <boost/buffers/const_buffer_span.hpp>
19-
#include <boost/buffers/mutable_buffer_pair.hpp>
20-
#include <boost/buffers/type_traits.hpp>
18+
#include <boost/buffers/buffer_pair.hpp>
19+
#include <boost/core/span.hpp>
2120
#include <boost/rts/context_fwd.hpp>
2221
#include <boost/system/result.hpp>
2322

@@ -65,7 +64,7 @@ class serializer
6564
area.
6665
*/
6766
using const_buffers_type =
68-
buffers::const_buffer_span;
67+
boost::span<buffers::const_buffer const>;
6968

7069
/** Constructor.
7170

include/boost/http_proto/sink.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#define BOOST_HTTP_PROTO_SINK_HPP
1212

1313
#include <boost/http_proto/detail/config.hpp>
14-
#include <boost/buffers/const_buffer_span.hpp>
15-
#include <boost/buffers/type_traits.hpp>
14+
#include <boost/buffers/buffer.hpp>
15+
#include <boost/core/span.hpp>
1616
#include <boost/system/error_code.hpp>
1717
#include <cstddef>
1818
#include <type_traits>
@@ -192,7 +192,7 @@ struct BOOST_SYMBOL_VISIBLE
192192
virtual
193193
results
194194
on_write(
195-
buffers::const_buffer_span bs,
195+
boost::span<const buffers::const_buffer> bs,
196196
bool more);
197197

198198
private:
@@ -214,7 +214,7 @@ struct BOOST_SYMBOL_VISIBLE
214214

215215
results
216216
write_impl(
217-
buffers::const_buffer_span const& bs,
217+
boost::span<const buffers::const_buffer> const& bs,
218218
bool more)
219219
{
220220
return on_write(bs, more);

include/boost/http_proto/source.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#define BOOST_HTTP_PROTO_SOURCE_HPP
1212

1313
#include <boost/http_proto/detail/config.hpp>
14-
#include <boost/buffers/mutable_buffer_span.hpp>
15-
#include <boost/buffers/type_traits.hpp>
14+
#include <boost/buffers/buffer.hpp>
15+
#include <boost/core/span.hpp>
1616
#include <boost/system/error_code.hpp>
1717
#include <cstddef>
1818
#include <type_traits>
@@ -195,7 +195,7 @@ struct BOOST_SYMBOL_VISIBLE
195195
virtual
196196
results
197197
on_read(
198-
buffers::mutable_buffer_span bs);
198+
boost::span<buffers::mutable_buffer const> bs);
199199

200200
private:
201201
results
@@ -207,7 +207,7 @@ struct BOOST_SYMBOL_VISIBLE
207207

208208
results
209209
read_impl(
210-
buffers::mutable_buffer_span const& bs)
210+
boost::span<buffers::mutable_buffer const> const& bs)
211211
{
212212
return on_read(bs);
213213
}

include/boost/http_proto/string_body.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define BOOST_HTTP_PROTO_STRING_BODY_HPP
1212

1313
#include <boost/http_proto/detail/config.hpp>
14-
#include <boost/buffers/const_buffer.hpp>
14+
#include <boost/buffers/buffer.hpp>
1515
#include <string>
1616
#include <utility>
1717

src/detail/array_of_const_buffers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

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

15-
#include <boost/buffers/sans_prefix.hpp>
15+
#include <boost/buffers/slice.hpp>
1616

1717
namespace boost {
1818
namespace http_proto {
@@ -38,7 +38,7 @@ consume(std::size_t n)
3838
auto* p = base_ + pos_;
3939
if(n < p->size())
4040
{
41-
*p = buffers::sans_prefix(*p, n);
41+
buffers::trim_front(*p, n);
4242
return;
4343
}
4444
n -= p->size();

src/detail/array_of_const_buffers.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#ifndef BOOST_HTTP_PROTO_DETAIL_ARRAY_OF_BUFFERS_HPP
1212
#define BOOST_HTTP_PROTO_DETAIL_ARRAY_OF_BUFFERS_HPP
1313

14-
#include <boost/buffers/const_buffer.hpp>
14+
#include <boost/assert.hpp>
15+
#include <boost/buffers/buffer.hpp>
1516

1617
#include <cstdint>
1718

src/detail/buffer_utils.hpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// Copyright (c) 2025 Mohammad Nejati
3+
//
4+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
//
7+
// Official repository: https://github.com/cppalliance/http_proto
8+
//
9+
10+
#ifndef BOOST_HTTP_PROTO_DETAIL_BUFFER_UTILS_HPP
11+
#define BOOST_HTTP_PROTO_DETAIL_BUFFER_UTILS_HPP
12+
13+
#include <boost/buffers/buffer.hpp>
14+
#include <boost/buffers/slice.hpp>
15+
#include <boost/core/span.hpp>
16+
17+
namespace boost {
18+
namespace http_proto {
19+
namespace detail {
20+
21+
template<
22+
typename BufferSequence,
23+
typename Buffer = typename BufferSequence::value_type>
24+
boost::span<Buffer const>
25+
make_span(BufferSequence const& mbp)
26+
{
27+
return { mbp.begin(), mbp.end() };
28+
}
29+
30+
template<typename BufferSequence>
31+
BufferSequence
32+
prefix(
33+
BufferSequence cbp,
34+
std::size_t n)
35+
{
36+
buffers::keep_front(cbp, n);
37+
return cbp;
38+
}
39+
40+
} // detail
41+
} // http_proto
42+
} // boost
43+
44+
#endif

0 commit comments

Comments
 (0)