New BodyReader and BodyWriter constructors (API Change):

fix #884

* BodyReader and BodyWriter constructors now require the header and
  body elements to be passed as distinct header and value_type objects.

This enables the composition of body types, for example:

    http::response<compressed_body<http::string_body>> res;

* The previous single-argument constructors are deprecated and will be
  removed in a subsequent version.

Actions Required:

* Change user-defined instances of BodyReader or BodyWriter constructor
  signatures to the two-argument form.

OR

* Define the macro BOOST_BEAST_ALLOW_DEPRECATED in the project (which
  will accept both the new and the deprecated signatures).
This commit is contained in:
Damian Jarek
2017-11-13 23:34:14 +01:00
committed by Vinnie Falco
parent d796319476
commit b76ab4450a
24 changed files with 358 additions and 107 deletions
+10 -8
View File
@@ -57,11 +57,12 @@ public:
/** Construct the writer.
@param msg The message whose body is to be serialized.
@param h The header for the message being serialized
@param body The body being serialized
*/
template<bool isRequest, class Body, class Fields>
explicit
BodyWriter(message<isRequest, Body, Fields> const& msg);
template<bool isRequest, class Fields>
BodyWriter(header<isRequest, Fields> const& h, value_type const& body);
/** Initialize the writer.
@@ -120,11 +121,12 @@ struct BodyReader
{
/** Construct the reader.
@param msg The message whose body is to be parsed.
@param h The header for the message being parsed
@param body The body to store the parsed results into
*/
template<bool isRequest, class Body, class Fields>
explicit
BodyReader(message<isRequest, Body, Fields>& msg);
template<bool isRequest, class Fields>
BodyReader(header<isRequest, Fields>& h, value_type& body);
/** Initialize the reader.