10 #ifndef BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP 11 #define BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP 17 #include <boost/optional.hpp> 32 template<
class DynamicBuffer>
36 "DynamicBuffer requirements not met");
62 #if BOOST_BEAST_DOXYGEN 63 using reader = implementation_defined;
67 DynamicBuffer
const& body_;
71 typename DynamicBuffer::const_buffers_type;
73 template<
bool isRequest,
class Fields>
84 ec.assign(0, ec.category());
87 boost::optional<std::pair<const_buffers_type, bool>>
90 ec.assign(0, ec.category());
91 return {{body_.data(),
false}};
100 #if BOOST_BEAST_DOXYGEN 101 using writer = implementation_defined;
108 template<
bool isRequest,
class Fields>
120 ec.assign(0, ec.category());
123 template<
class ConstBufferSequence>
128 using boost::asio::buffer_copy;
129 using boost::asio::buffer_size;
130 auto const n = buffer_size(buffers);
131 if(body_.size() > body_.max_size() - n)
137 DynamicBuffer::mutable_buffers_type> b;
140 b.emplace(body_.prepare((std::min)(n,
141 body_.max_size() - body_.size())));
143 catch(std::length_error
const&)
148 ec.assign(0, ec.category());
149 auto const bytes_transferred =
150 buffer_copy(*b, buffers);
151 body_.commit(bytes_transferred);
152 return bytes_transferred;
158 ec.assign(0, ec.category());
BufferSequence< boost::asio::const_buffer > ConstBufferSequence
Definition: type_traits.hpp:280
std::size_t put(ConstBufferSequence const &buffers, error_code &ec)
Definition: basic_dynamic_body.hpp:125
reader(message< isRequest, basic_dynamic_body, Fields > const &m)
Definition: basic_dynamic_body.hpp:75
Definition: basic_dynamic_body.hpp:33
Definition: async_result.hpp:20
writer(message< isRequest, basic_dynamic_body, Fields > &msg)
Definition: basic_dynamic_body.hpp:110
Definition: type_traits.hpp:25
detail::buffers_helper< ConstBufferSequence > buffers(ConstBufferSequence const &b)
Definition: ostream.hpp:50
DynamicBuffer value_type
Definition: basic_dynamic_body.hpp:43
Definition: beast_common.hpp:6
Definition: basic_dynamic_body.hpp:65
static std::uint64_t size(value_type const &v)
Definition: basic_dynamic_body.hpp:53
Definition: basic_dynamic_body.hpp:103
void init(error_code &ec)
Definition: basic_dynamic_body.hpp:82
boost::system::error_code error_code
The type of error code used by the library.
Definition: error.hpp:21
void finish(error_code &ec)
Definition: basic_dynamic_body.hpp:156
Definition: type_traits.hpp:134
typename DynamicBuffer::const_buffers_type const_buffers_type
Definition: basic_dynamic_body.hpp:71
void init(boost::optional< std::uint64_t > const &, error_code &ec)
Definition: basic_dynamic_body.hpp:117