forked from boostorg/beast
Refactor message and message_headers declarations:
message_headers is now a set of partial class template specializations instead of a template class alias. This solves a problem where template functions taking message_headers as a parameter could not deduce argument types, since std::conditional obscured the deduced context. Both classes are refactored to share declarations using an #ifdef, to eliminate an ugly set of extra declarations needed when building the documentation. Copy and move class special members are added. A new function message::base() is provided which returns the message_headers portion of a message.
This commit is contained in:
1 parent
9fd8aede3d
commit
f6dd744fd1
8 files changed
+349
-228
No files matched your search
@@ -168,13 +168,13 @@ public:
|
||||
void testHeaders()
|
||||
{
|
||||
{
|
||||
using req_type = request_headers<headers>;
|
||||
using req_type = request_headers;
|
||||
static_assert(std::is_copy_constructible<req_type>::value, "");
|
||||
static_assert(std::is_move_constructible<req_type>::value, "");
|
||||
static_assert(std::is_copy_assignable<req_type>::value, "");
|
||||
static_assert(std::is_move_assignable<req_type>::value, "");
|
||||
|
||||
using res_type = response_headers<headers>;
|
||||
using res_type = response_headers;
|
||||
static_assert(std::is_copy_constructible<res_type>::value, "");
|
||||
static_assert(std::is_move_constructible<res_type>::value, "");
|
||||
static_assert(std::is_copy_assignable<res_type>::value, "");
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
|
||||
{
|
||||
MoveHeaders h;
|
||||
request_headers<MoveHeaders> r{std::move(h)};
|
||||
message_headers<true, MoveHeaders> r{std::move(h)};
|
||||
BEAST_EXPECT(h.moved_from);
|
||||
BEAST_EXPECT(r.headers.moved_to);
|
||||
request<string_body, MoveHeaders> m{std::move(r)};
|
||||
|
||||
@@ -818,7 +818,8 @@ private:
|
||||
{
|
||||
return on_request(method, url,
|
||||
major, minor, keep_alive, upgrade,
|
||||
typename message_type::is_request{});
|
||||
std::integral_constant<
|
||||
bool, message_type::is_request>{});
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -847,7 +848,7 @@ private:
|
||||
{
|
||||
return on_response(
|
||||
status, reason, major, minor, keep_alive, upgrade,
|
||||
std::integral_constant<bool, ! message_type::is_request::value>{});
|
||||
std::integral_constant<bool, ! message_type::is_request>{});
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
streambuf rb;
|
||||
headers_parser_v1<true, headers> p0;
|
||||
parse(ss, rb, p0);
|
||||
request_headers<headers> const& reqh = p0.get();
|
||||
request_headers const& reqh = p0.get();
|
||||
BEAST_EXPECT(reqh.method == "GET");
|
||||
BEAST_EXPECT(reqh.url == "/");
|
||||
BEAST_EXPECT(reqh.version == 11);
|
||||
|
||||
Reference in new issue
Block a user