10 #ifndef BOOST_BEAST_HTTP_MESSAGE_HPP 11 #define BOOST_BEAST_HTTP_MESSAGE_HPP 20 #include <boost/optional.hpp> 21 #include <boost/throw_exception.hpp> 46 #if BOOST_BEAST_DOXYGEN 47 template<
bool isRequest,
class Fields = fields>
48 struct header : Fields
51 template<bool isRequest, class Fields = fields>
54 template<class Fields>
59 "Fields requirements not met");
62 #if BOOST_BEAST_DOXYGEN 63 using is_request = std::integral_constant<bool, isRequest>;
133 method_string()
const;
177 #if BOOST_BEAST_DOXYGEN 178 template<
class... Args>
183 template<
class Arg1,
class... ArgN,
184 class =
typename std::enable_if<
185 ! std::is_convertible<
typename 186 std::decay<Arg1>::type,
header>::value &&
187 ! std::is_convertible<
typename 188 std::decay<Arg1>::type,
verb>::value &&
189 ! std::is_convertible<
typename 190 std::decay<Arg1>::type,
header>::value
193 header(Arg1&& arg1, ArgN&&... argn);
196 template<
bool,
class,
class>
204 template<
class... FieldsArgs>
209 FieldsArgs&&... fields_args)
210 : Fields(
std::forward<FieldsArgs>(fields_args)...)
224 template<
class Fields>
228 "Fields requirements not met");
275 template<
class Arg1,
class... ArgN,
276 class =
typename std::enable_if<
277 ! std::is_convertible<
typename 278 std::decay<Arg1>::type,
status>::value &&
279 ! std::is_convertible<
typename 280 std::decay<Arg1>::type,
header>::value
283 header(Arg1&& arg1, ArgN&&... argn);
362 #if ! BOOST_BEAST_DOXYGEN 363 template<
bool,
class,
class>
371 template<
class... FieldsArgs>
375 FieldsArgs&&... fields_args)
376 : Fields(
std::forward<FieldsArgs>(fields_args)...)
387 template<
class Fields = fields>
391 template<
class Fields = fields>
423 template<
bool isRequest,
class Body,
class Fields = fields>
436 typename Body::value_type
body;
460 template<
class... BodyArgs>
471 template<
class... BodyArgs>
485 #if BOOST_BEAST_DOXYGEN 488 template<
class Version,
489 class =
typename std::enable_if<isRequest &&
490 std::is_convertible<Version, unsigned>::value>::type>
506 #if BOOST_BEAST_DOXYGEN 507 template<
class BodyArg>
509 unsigned version, BodyArg&& body_arg);
511 template<
class Version,
class BodyArg,
512 class =
typename std::enable_if<isRequest &&
513 std::is_convertible<Version, unsigned>::value>::type>
515 Version
version, BodyArg&& body_arg);
532 #if BOOST_BEAST_DOXYGEN 533 template<
class BodyArg,
class FieldsArg>
535 BodyArg&& body_arg, FieldsArg&& fields_arg);
537 template<
class Version,
class BodyArg,
class FieldsArg,
538 class =
typename std::enable_if<isRequest &&
539 std::is_convertible<Version, unsigned>::value>::type>
541 BodyArg&& body_arg, FieldsArg&& fields_arg);
552 #if BOOST_BEAST_DOXYGEN 555 template<
class Version,
556 class =
typename std::enable_if<! isRequest &&
557 std::is_convertible<Version, unsigned>::value>::type>
571 #if BOOST_BEAST_DOXYGEN 572 template<
class BodyArg>
575 template<
class Version,
class BodyArg,
576 class =
typename std::enable_if<! isRequest &&
577 std::is_convertible<Version, unsigned>::value>::type>
593 #if BOOST_BEAST_DOXYGEN 594 template<
class BodyArg,
class FieldsArg>
596 BodyArg&& body_arg, FieldsArg&& fields_arg);
598 template<
class Version,
class BodyArg,
class FieldsArg,
599 class =
typename std::enable_if<! isRequest &&
600 std::is_convertible<Version, unsigned>::value>::type>
602 BodyArg&& body_arg, FieldsArg&& fields_arg);
610 message(std::piecewise_construct_t);
617 template<
class... BodyArgs>
618 message(std::piecewise_construct_t,
619 std::tuple<BodyArgs...> body_args);
629 template<
class... BodyArgs,
class... FieldsArgs>
630 message(std::piecewise_construct_t,
631 std::tuple<BodyArgs...> body_args,
632 std::tuple<FieldsArgs...> fields_args);
652 return this->get_chunked_impl();
695 return this->get_keep_alive_impl(this->
version);
711 this->set_keep_alive_impl(this->
version, value);
726 boost::optional<std::uint64_t>
727 payload_size()
const;
746 prepare_payload(
typename header_type::is_request{});
751 "Body requirements not met");
755 std::size_t... IBodyArgs>
757 std::piecewise_construct_t,
758 std::tuple<BodyArgs...>& body_args,
760 :
body(std::forward<BodyArgs>(
761 std::get<IBodyArgs>(body_args))...)
763 boost::ignore_unused(body_args);
769 std::size_t... IBodyArgs,
770 std::size_t... IFieldsArgs>
772 std::piecewise_construct_t,
773 std::tuple<BodyArgs...>& body_args,
774 std::tuple<FieldsArgs...>& fields_args,
778 std::get<IFieldsArgs>(fields_args))...)
779 ,
body(std::forward<BodyArgs>(
780 std::get<IBodyArgs>(body_args))...)
782 boost::ignore_unused(body_args);
783 boost::ignore_unused(fields_args);
786 boost::optional<std::uint64_t>
787 payload_size(std::true_type)
const 789 return Body::size(body);
792 boost::optional<std::uint64_t>
793 payload_size(std::false_type)
const 799 prepare_payload(std::true_type);
802 prepare_payload(std::false_type);
806 template<
class Body,
class Fields = fields>
810 template<
class Body,
class Fields = fields>
815 #if BOOST_BEAST_DOXYGEN 821 template<
bool isRequest,
class Fields>
833 template<
bool isRequest,
class Body,
class Fields>
void swap(basic_fields< Allocator > &lhs, basic_fields< Allocator > &rhs)
Definition: fields.ipp:654
Definition: async_result.hpp:20
header_type const & base() const
Returns the header portion of the message.
Definition: message.hpp:636
Definition: type_traits.hpp:25
void keep_alive(bool value)
Definition: message.hpp:709
Body::value_type body
A value representing the body.
Definition: message.hpp:436
verb
Definition: verb.hpp:26
Definition: beast_common.hpp:6
Definition: type_traits.hpp:73
Definition: integer_sequence.hpp:23
boost::string_ref string_view
The type of string view used by the library.
Definition: string.hpp:36
Body body_type
Definition: message.hpp:433
typename detail::is_fields_helper< T >::type is_fields
Definition: type_traits.hpp:178
bool chunked() const
Returns true if the chunked Transfer-Encoding is specified.
Definition: message.hpp:650
bool keep_alive() const
Definition: message.hpp:693
void prepare_payload()
Definition: message.hpp:744
header_type & base()
Returns the header portion of the message.
Definition: message.hpp:643
status
Definition: status.hpp:21