Skip to content
Closed
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
3 changes: 2 additions & 1 deletion include/boost/http_proto/detail/impl/array_of_buffers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_HTTP_PROTO_DETAIL_IMPL_ARRAY_OF_BUFFERS_HPP
#define BOOST_HTTP_PROTO_DETAIL_IMPL_ARRAY_OF_BUFFERS_HPP

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

Expand Down Expand Up @@ -100,7 +101,7 @@ consume(std::size_t n)
{
if(n < p_->size())
{
*p_ += n;
*p_ = buffers::sans_prefix(*p_, n);
return;
}
n -= p_->size();
Expand Down
2 changes: 1 addition & 1 deletion include/boost/http_proto/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class BOOST_SYMBOL_VISIBLE
auto stream = sr.start_stream(req);

std::string_view msg = "Hello, world!";
auto n = buffers::buffer_copy(
auto n = buffers::copy(
stream.prepare(),
buffers::make_buffer(
msg.data(), msg.size()));
Expand Down
3 changes: 2 additions & 1 deletion src/detail/impl/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#ifndef BOOST_HTTP_PROTO_DETAIL_IMPL_FILTER_HPP
#define BOOST_HTTP_PROTO_DETAIL_IMPL_FILTER_HPP

#include <boost/buffers/algorithm.hpp>
#include <boost/buffers/range.hpp>
#include <boost/buffers/sans_prefix.hpp>

namespace boost {
namespace http_proto {
Expand Down
1 change: 0 additions & 1 deletion src/file_body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//

#include <boost/http_proto/file_body.hpp>
#include <boost/buffers/algorithm.hpp>
#include <boost/assert.hpp>

namespace boost {
Expand Down
14 changes: 7 additions & 7 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include <boost/http_proto/service/zlib_service.hpp>

#include <boost/assert.hpp>
#include <boost/buffers/algorithm.hpp>
#include <boost/buffers/buffer_copy.hpp>
#include <boost/buffers/buffer_size.hpp>
#include <boost/buffers/copy.hpp>
#include <boost/buffers/prefix.hpp>
#include <boost/buffers/size.hpp>
#include <boost/buffers/make_buffer.hpp>
#include <boost/url/grammar/ci_string.hpp>
#include <boost/url/grammar/hexdig_chars.hpp>
Expand Down Expand Up @@ -1205,7 +1205,7 @@ parse(
{
case how::in_place:
{
auto copied = buffers::buffer_copy(
auto copied = buffers::copy(
cb1_.prepare(cb1_.capacity()),
chunk);
chunk_remain_ -= copied;
Expand Down Expand Up @@ -1249,7 +1249,7 @@ parse(
st_ = state::reset;
return;
}
buffers::buffer_copy(
buffers::copy(
eb_->prepare(chunk_avail),
chunk);
chunk_remain_ -= chunk_avail;
Expand Down Expand Up @@ -1366,7 +1366,7 @@ parse(
}
// only happens when an elastic body
// is attached in header_done state
buffers::buffer_copy(
buffers::copy(
eb_->prepare(payload_avail),
cb0_.data());
cb0_.consume(payload_avail);
Expand Down Expand Up @@ -1436,7 +1436,7 @@ parse(
error::buffer_overflow);
return;
}
buffers::buffer_copy(
buffers::copy(
eb_->prepare(body_avail_),
body_buf.data());
body_buf.consume(body_avail_);
Expand Down
38 changes: 19 additions & 19 deletions src/serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#include "detail/filter.hpp"

#include <boost/buffers/algorithm.hpp>
#include <boost/buffers/buffer_copy.hpp>
#include <boost/buffers/buffer_size.hpp>
#include <boost/buffers/copy.hpp>
#include <boost/buffers/sans_prefix.hpp>
#include <boost/buffers/size.hpp>
#include <boost/core/ignore_unused.hpp>

#include <stddef.h>
Expand Down Expand Up @@ -108,7 +108,7 @@ consume_buffers(
{
if(bytes < p->size())
{
*p += bytes;
*p = buffers::sans_prefix(*p, bytes);
return;
}
bytes -= p->size();
Expand Down Expand Up @@ -138,22 +138,22 @@ write_chunk_header(
}
buf[16] = '\r';
buf[17] = '\n';
auto n = buffers::buffer_copy(
auto n = buffers::copy(
dest0,
buffers::const_buffer(
buf, sizeof(buf)));
ignore_unused(n);
BOOST_ASSERT(n == 18);
BOOST_ASSERT(
buffers::buffer_size(dest0) == n);
buffers::size(dest0) == n);
}

template<class DynamicBuffer>
void
write_chunk_close(DynamicBuffer& db)
{
db.commit(
buffers::buffer_copy(
buffers::copy(
db.prepare(2),
buffers::const_buffer("\r\n", 2)));
}
Expand All @@ -163,7 +163,7 @@ void
write_last_chunk(DynamicBuffer& db)
{
db.commit(
buffers::buffer_copy(
buffers::copy(
db.prepare(5),
buffers::const_buffer("0\r\n\r\n", 5)));
}
Expand Down Expand Up @@ -246,7 +246,7 @@ prepare() ->

// TODO: This is a temporary solution until we refactor
// the implementation for efficient partial buffer consumption.
if( is_chunked_ && buffers::buffer_size(prepped_) && is_header_done_ )
if( is_chunked_ && buffers::size(prepped_) && is_header_done_ )
return const_buffers_type(
prepped_.data(), prepped_.size());

Expand Down Expand Up @@ -278,7 +278,7 @@ prepare() ->
{
if( st_ == style::buffers )
{
if( buffers::buffer_size(buf_) == 0 )
if( buffers::size(buf_) == 0 )
return {};

auto buf = *(buf_.data());
Expand Down Expand Up @@ -322,7 +322,7 @@ prepare() ->
if( st_ == style::buffers )
{
buf_.consume(n);
if( buffers::buffer_size(buf_) == 0 )
if( buffers::size(buf_) == 0 )
more_ = false;
}
else
Expand Down Expand Up @@ -404,7 +404,7 @@ prepare() ->
auto cbs = const_buffers_type(
prepped_.data(), prepped_.size());

BOOST_ASSERT(buffers::buffer_size(cbs) > 0);
BOOST_ASSERT(buffers::size(cbs) > 0);
return cbs;
}

Expand Down Expand Up @@ -444,7 +444,7 @@ consume(
BOOST_ASSERT(st_ != style::empty);
out_->consume(n);
}
auto is_empty = (buffers::buffer_size(prepped_) == 0);
auto is_empty = (buffers::size(prepped_) == 0);

if( st_ == style::buffers && !filter_ && is_empty )
more_ = false;
Expand Down Expand Up @@ -529,9 +529,9 @@ start_init(
p + chunk_header_len_ + crlf_len_,
last_chunk_len_);

buffers::buffer_copy(
buffers::copy(
chunk_close_, buffers::const_buffer("\r\n", 2));
buffers::buffer_copy(
buffers::copy(
last_chunk_,
buffers::const_buffer("0\r\n\r\n", 5));
}
Expand Down Expand Up @@ -564,7 +564,7 @@ start_empty(

buffers::mutable_buffer dest(
ws_.data(), 5);
buffers::buffer_copy(
buffers::copy(
dest,
buffers::const_buffer(
"0\r\n\r\n", 5));
Expand Down Expand Up @@ -594,13 +594,13 @@ start_buffers(

copy(&prepped_[1], buf_.data(), buf_.size());

more_ = (buffers::buffer_size(buf_) > 0);
more_ = (buffers::size(buf_) > 0);
return;
}

if( !filter_ && is_chunked_ )
{
if( buffers::buffer_size(buf_) == 0 )
if( buffers::size(buf_) == 0 )
{
prepped_ = make_array(
1 + // header
Expand All @@ -614,7 +614,7 @@ start_buffers(
}

write_chunk_header(
chunk_header_, buffers::buffer_size(buf_));
chunk_header_, buffers::size(buf_));

prepped_ = make_array(
1 + // header
Expand Down
36 changes: 18 additions & 18 deletions test/unit/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include <boost/http_proto/request_parser.hpp>
#include <boost/http_proto/response_parser.hpp>
#include <boost/http_proto/service/zlib_service.hpp>
#include <boost/buffers/buffer_copy.hpp>
#include <boost/buffers/buffer_size.hpp>
#include <boost/buffers/copy.hpp>
#include <boost/buffers/size.hpp>
#include <boost/buffers/flat_buffer.hpp>
#include <boost/buffers/make_buffer.hpp>
#include <boost/buffers/string_buffer.hpp>
Expand Down Expand Up @@ -241,7 +241,7 @@ struct parser_test
{
core::string_view& s = in[0];
auto const n =
buffers::buffer_copy(
buffers::copy(
pr.prepare(),
buffers::make_buffer(
s.data(), s.size()));
Expand Down Expand Up @@ -302,7 +302,7 @@ struct parser_test
pr.reset();
pr.start();
auto const n =
buffers::buffer_copy(
buffers::copy(
pr.prepare(),
buffers::make_buffer(
s.data(), s.size()));
Expand Down Expand Up @@ -461,7 +461,7 @@ struct parser_test
BOOST_TEST_NO_THROW(
dest = pr.prepare());
BOOST_TEST_EQ(
buffers::buffer_size(dest), n);
buffers::size(dest), n);
};

//
Expand Down Expand Up @@ -512,7 +512,7 @@ struct parser_test
BOOST_TEST_NO_THROW(
dest = pr.prepare());
BOOST_TEST_EQ(
buffers::buffer_size(dest), n);
buffers::size(dest), n);
};

{
Expand Down Expand Up @@ -590,7 +590,7 @@ struct parser_test
BOOST_TEST_NO_THROW(
dest = pr->prepare());
BOOST_TEST_EQ(
buffers::buffer_size(dest), n);
buffers::size(dest), n);
}

// the parser must be manually reset() to clear its inner workspace
Expand Down Expand Up @@ -685,7 +685,7 @@ struct parser_test
BOOST_TEST(ec == error::need_data);
auto dest = pr.prepare();
BOOST_TEST_LE(
buffers::buffer_size(dest),
buffers::size(dest),
s.capacity());
pr.reset();
}
Expand Down Expand Up @@ -757,7 +757,7 @@ struct parser_test
auto dest = pr.prepare();
BOOST_TEST_THROWS(
pr.commit(
buffers::buffer_size(dest) + 1),
buffers::size(dest) + 1),
std::invalid_argument);
}

Expand Down Expand Up @@ -788,7 +788,7 @@ struct parser_test
pr.start();
auto dest = pr.prepare();
BOOST_TEST_GE(
buffers::buffer_size(dest), 1);
buffers::size(dest), 1);
BOOST_TEST_NO_THROW(
pr.commit(1));
}
Expand All @@ -813,7 +813,7 @@ struct parser_test
auto dest = pr.prepare();
BOOST_TEST_THROWS(
pr.commit(
buffers::buffer_size(dest) + 1),
buffers::size(dest) + 1),
std::invalid_argument);
}

Expand Down Expand Up @@ -1005,7 +1005,7 @@ struct parser_test
ignore_unused(dest);
BOOST_TEST_THROWS(
pr.commit(
buffers::buffer_size(dest) + 1),
buffers::size(dest) + 1),
std::invalid_argument);
}
}
Expand Down Expand Up @@ -1884,7 +1884,7 @@ struct parser_test
octets += std::string(100, 'a');
remaining -= 100;

pr.commit(buffers::buffer_copy(
pr.commit(buffers::copy(
pr.prepare(),
buffers::const_buffer(
octets.data(), octets.size())));
Expand All @@ -1897,7 +1897,7 @@ struct parser_test
BOOST_TEST(!pr.is_complete());

pr.consume_body(
buffers::buffer_size(pr.pull_body())
buffers::size(pr.pull_body())
- 1); // left one byte so the circular buffer doesn't reset

octets.clear();
Expand All @@ -1909,7 +1909,7 @@ struct parser_test
octets += make_header(i % 100);
octets += std::string(i % 100, 'a');

pr.commit(buffers::buffer_copy(
pr.commit(buffers::copy(
pr.prepare(),
buffers::const_buffer(
octets.data(), octets.size())));
Expand Down Expand Up @@ -1988,7 +1988,7 @@ struct parser_test
octets += to_hex(1);
remaining -= 100;

pr.commit(buffers::buffer_copy(
pr.commit(buffers::copy(
pr.prepare(),
buffers::const_buffer(
octets.data(), octets.size())));
Expand All @@ -2001,7 +2001,7 @@ struct parser_test
BOOST_TEST(!pr.is_complete());

pr.consume_body(
buffers::buffer_size(pr.pull_body()));
buffers::size(pr.pull_body()));

octets.clear();
}
Expand All @@ -2014,7 +2014,7 @@ struct parser_test
octets += make_chunk(i % 100 + 1);
octets += make_chunk(0);

pr.commit(buffers::buffer_copy(
pr.commit(buffers::copy(
pr.prepare(),
buffers::const_buffer(
octets.data(), octets.size())));
Expand Down
Loading
Loading