2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
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)
8 #ifndef BEAST_HTTP_BASIC_DYNABUF_BODY_HPP
9 #define BEAST_HTTP_BASIC_DYNABUF_BODY_HPP
11 #include <beast/config.hpp>
12 #include <beast/core/error.hpp>
13 #include <beast/http/message.hpp>
14 #include <beast/core/detail/type_traits.hpp>
15 #include <boost/asio/buffer.hpp>
20 /** A message body represented by a @b `DynamicBuffer`
22 Meets the requirements of @b `Body`.
24 template<class DynamicBuffer>
25 struct basic_dynabuf_body
27 /// The type of the `message::body` member
28 using value_type = DynamicBuffer;
39 static bool constexpr is_direct = true;
41 using mutable_buffers_type =
42 typename DynamicBuffer::mutable_buffers_type;
44 template<bool isRequest, class Fields>
46 reader(message<isRequest,
47 basic_dynabuf_body, Fields>& msg)
58 init(std::uint64_t content_length)
63 prepare(std::size_t n)
65 return body_.prepare(n);
82 DynamicBuffer const& body_;
85 template<bool isRequest, class Fields>
88 isRequest, basic_dynabuf_body, Fields> const& m) noexcept
94 init(error_code& ec) noexcept
96 beast::detail::ignore_unused(ec);
100 content_length() const noexcept
105 template<class WriteFunction>
107 write(error_code&, WriteFunction&& wf) noexcept