10 #ifndef BOOST_BEAST_HTTP_PARSER_HPP 11 #define BOOST_BEAST_HTTP_PARSER_HPP 17 #include <boost/optional.hpp> 18 #include <boost/throw_exception.hpp> 21 #include <type_traits> 48 class Allocator = std::allocator<char>>
50 :
public basic_parser<isRequest,
51 parser<isRequest, Body, Allocator>>
53 static_assert(is_body<Body>::value,
54 "Body requirements not met");
57 "BodyWriter requirements not met");
59 template<
bool,
class,
class>
66 typename Body::writer wr_;
67 bool wr_inited_ =
false;
74 std::function<std::size_t(
112 #if BOOST_BEAST_DOXYGEN 113 template<
class... Args>
117 template<
class Arg1,
class... ArgN,
118 class =
typename std::enable_if<
120 std::decay<Arg1>::type>::value>::type>
122 parser(Arg1&& arg1, ArgN&&... argn);
156 #if BOOST_BEAST_DOXYGEN 157 template<
class OtherBody,
class... Args>
159 template<
class OtherBody,
class... Args,
160 class =
typename std::enable_if<
161 ! std::is_same<Body, OtherBody>::value>::type>
165 Allocator>&&
parser, Args&&... args);
202 static_assert(std::is_move_constructible<decltype(m_)>::value,
203 "MoveConstructible requirements not met");
241 template<
class Callback>
247 BOOST_STATIC_ASSERT(! std::is_const<Callback>::value);
250 BOOST_ASSERT(! wr_inited_);
252 cb_h_ = std::ref(cb);
289 template<
class Callback>
295 BOOST_STATIC_ASSERT(! std::is_const<Callback>::value);
298 BOOST_ASSERT(! wr_inited_);
300 cb_b_ = std::ref(cb);
320 m_.method_string(method_str);
321 ec.assign(0, ec.category());
342 ec.assign(0, ec.category());
359 m_.insert(name, name_string, value);
360 ec.assign(0, ec.category());
371 ec.assign(0, ec.category());
379 wr_.init(content_length, ec);
388 return wr_.put(boost::asio::buffer(
389 body.data(), body.size()), ec);
393 on_chunk_header_impl(
399 return cb_h_(size, extensions, ec);
400 ec.assign(0, ec.category());
405 std::uint64_t remain,
410 return cb_b_(remain, body, ec);
411 return wr_.put(boost::asio::buffer(
412 body.data(), body.size()), ec);
423 template<
class Body,
class Allocator = std::allocator<
char>>
427 template<
class Body,
class Allocator = std::allocator<
char>>
Definition: async_result.hpp:20
field
Definition: field.hpp:21
Definition: type_traits.hpp:25
void on_chunk_header(Callback &cb)
Definition: parser.hpp:243
verb
Definition: verb.hpp:26
Definition: beast_common.hpp:6
Definition: type_traits.hpp:125
boost::system::error_code error_code
The type of error code used by the library.
Definition: error.hpp:21
Definition: type_traits.hpp:47
parser()
Constructor.
Definition: parser.ipp:22
parser & operator=(parser const &)=delete
Assignment.
boost::optional< std::uint64_t > content_length() const
~parser()=default
Destructor.
Definition: type_traits.hpp:28
boost::string_ref string_view
The type of string view used by the library.
Definition: string.hpp:36
void on_chunk_body(Callback &cb)
Definition: parser.hpp:291
Definition: basic_parser.hpp:172
value_type release()
Definition: parser.hpp:200