Refine message class hierarchy:

Two new objects, request_headers and response_headers,
represent the portion of HTTP messages excluding the body.
This commit is contained in:
Vinnie Falco
2017-07-20 08:12:13 -07:00
parent 056d6b94c2
commit a4d8a154b1
31 changed files with 569 additions and 487 deletions
+18 -18
View File
@@ -222,7 +222,7 @@ public:
template<bool isRequest, class Body, class Headers>
std::string
str(message_v1<isRequest, Body, Headers> const& m)
str(message<isRequest, Body, Headers> const& m)
{
string_write_stream ss(ios_);
write(ss, m);
@@ -233,7 +233,7 @@ public:
testAsyncWrite(yield_context do_yield)
{
{
message_v1<false, string_body, headers> m;
message<false, string_body, headers> m;
m.version = 10;
m.status = 200;
m.reason = "OK";
@@ -252,7 +252,7 @@ public:
"*****");
}
{
message_v1<false, string_body, headers> m;
message<false, string_body, headers> m;
m.version = 11;
m.status = 200;
m.reason = "OK";
@@ -285,7 +285,7 @@ public:
test::fail_counter fc(n);
test::fail_stream<
string_write_stream> fs(fc, ios_);
message_v1<true, fail_body, headers> m(
message<true, fail_body, headers> m(
std::piecewise_construct,
std::forward_as_tuple(fc, ios_));
m.method = "GET";
@@ -318,7 +318,7 @@ public:
test::fail_counter fc(n);
test::fail_stream<
string_write_stream> fs(fc, ios_);
message_v1<true, fail_body, headers> m(
message<true, fail_body, headers> m(
std::piecewise_construct,
std::forward_as_tuple(fc, ios_));
m.method = "GET";
@@ -353,7 +353,7 @@ public:
test::fail_counter fc(n);
test::fail_stream<
string_write_stream> fs(fc, ios_);
message_v1<true, fail_body, headers> m(
message<true, fail_body, headers> m(
std::piecewise_construct,
std::forward_as_tuple(fc, ios_));
m.method = "GET";
@@ -388,7 +388,7 @@ public:
test::fail_counter fc(n);
test::fail_stream<
string_write_stream> fs(fc, ios_);
message_v1<true, fail_body, headers> m(
message<true, fail_body, headers> m(
std::piecewise_construct,
std::forward_as_tuple(fc, ios_));
m.method = "GET";
@@ -418,7 +418,7 @@ public:
test::fail_counter fc(n);
test::fail_stream<
string_write_stream> fs(fc, ios_);
message_v1<true, fail_body, headers> m(
message<true, fail_body, headers> m(
std::piecewise_construct,
std::forward_as_tuple(fc, ios_));
m.method = "GET";
@@ -449,7 +449,7 @@ public:
{
// auto content-length HTTP/1.0
{
message_v1<true, string_body, headers> m;
message<true, string_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 10;
@@ -466,7 +466,7 @@ public:
}
// keep-alive HTTP/1.0
{
message_v1<true, string_body, headers> m;
message<true, string_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 10;
@@ -484,7 +484,7 @@ public:
}
// upgrade HTTP/1.0
{
message_v1<true, string_body, headers> m;
message<true, string_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 10;
@@ -502,7 +502,7 @@ public:
}
// no content-length HTTP/1.0
{
message_v1<true, unsized_body, headers> m;
message<true, unsized_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 10;
@@ -522,7 +522,7 @@ public:
}
// auto content-length HTTP/1.1
{
message_v1<true, string_body, headers> m;
message<true, string_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 11;
@@ -539,7 +539,7 @@ public:
}
// close HTTP/1.1
{
message_v1<true, string_body, headers> m;
message<true, string_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 11;
@@ -561,7 +561,7 @@ public:
}
// upgrade HTTP/1.1
{
message_v1<true, empty_body, headers> m;
message<true, empty_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 11;
@@ -576,7 +576,7 @@ public:
}
// no content-length HTTP/1.1
{
message_v1<true, unsized_body, headers> m;
message<true, unsized_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 11;
@@ -600,7 +600,7 @@ public:
void testConvert()
{
message_v1<true, string_body, headers> m;
message<true, string_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 11;
@@ -613,7 +613,7 @@ public:
void testOstream()
{
message_v1<true, string_body, headers> m;
message<true, string_body, headers> m;
m.method = "GET";
m.url = "/";
m.version = 11;