New constructors for message:

The message class now behaves like a pair with respect to the construction
of the body and headers. Additional constructors allow construction of
just the body portion from a tuple, leaving the headers default
constructed.

Previous constructors are removed as they were a notational convenience
for assembling HTTP/1 requests and responses. They are not necessary
as this library aims at library writers and not end users.
This commit is contained in:
Vinnie Falco
2016-05-07 15:18:22 -04:00
parent e0956c36c1
commit 2b69831f49
13 changed files with 334 additions and 144 deletions

View File

@@ -15,24 +15,6 @@
namespace beast {
namespace http {
#if ! GENERATING_DOCS
struct request_params
{
std::string method;
std::string url;
int version;
};
struct response_params
{
int status;
std::string reason;
int version;
};
#endif
/** A HTTP/1 message.
A message can be a request or response, depending on the `isRequest`
@@ -54,15 +36,18 @@ struct message_v1 : message<isRequest, Body, Headers>
/// HTTP/1 version (10 or 11)
int version;
/// Default constructor
message_v1() = default;
/// Construct a HTTP/1 request.
/// Constructor
template<class Arg1, class... Argn>
explicit
message_v1(request_params params);
/// Construct a HTTP/1 response.
explicit
message_v1(response_params params);
message_v1(Arg1& arg1, Argn&&... argn)
: message<isRequest, Body, Headers>(
std::forward<Arg1>(arg1),
std::forward<Argn>(argn)...)
{
}
};
#if ! GENERATING_DOCS