Rename to http::dynamic_body, consolidate header:

fix #284

* streambuf_body is renamed to dynamic_body
* basic_dynabuf_body is renamed to basic_dynamic_body
This commit is contained in:
Vinnie Falco
2017-05-05 21:00:56 -07:00
parent 45a2d73993
commit 21ef97d220
17 changed files with 40 additions and 73 deletions
+1 -2
View File
@@ -47,10 +47,10 @@ unit-test core-tests :
unit-test http-tests :
../extras/beast/unit_test/main.cpp
http/basic_dynabuf_body.cpp
http/basic_parser.cpp
http/concepts.cpp
http/design.cpp
http/dynamic_body.cpp
http/error.cpp
http/fields.cpp
http/header_parser.cpp
@@ -59,7 +59,6 @@ unit-test http-tests :
http/read.cpp
http/reason.cpp
http/rfc7230.cpp
http/streambuf_body.cpp
http/string_body.cpp
http/write.cpp
http/chunk_encode.cpp
+1 -2
View File
@@ -10,10 +10,10 @@ add_executable (http-tests
message_fuzz.hpp
test_parser.hpp
../../extras/beast/unit_test/main.cpp
basic_dynabuf_body.cpp
basic_parser.cpp
concepts.cpp
design.cpp
dynamic_body.cpp
error.cpp
fields.cpp
header_parser.cpp
@@ -22,7 +22,6 @@ add_executable (http-tests
read.cpp
reason.cpp
rfc7230.cpp
streambuf_body.cpp
string_body.cpp
write.cpp
chunk_encode.cpp
-9
View File
@@ -1,9 +0,0 @@
//
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test that header file is self-contained.
#include <beast/http/basic_dynabuf_body.hpp>
@@ -6,7 +6,7 @@
//
// Test that header file is self-contained.
#include <beast/http/streambuf_body.hpp>
#include <beast/http/dynamic_body.hpp>
#include <beast/core/to_string.hpp>
#include <beast/http/fields.hpp>
@@ -20,7 +20,7 @@
namespace beast {
namespace http {
class streambuf_body_test : public beast::unit_test::suite
class dynamic_body_test : public beast::unit_test::suite
{
boost::asio::io_service ios_;
@@ -34,7 +34,7 @@ public:
"\r\n"
"xyz";
test::string_istream ss(ios_, s);
message_parser<false, streambuf_body, fields> p;
message_parser<false, dynamic_body, fields> p;
streambuf sb;
read(ss, sb, p);
auto const& m = p.get();
@@ -43,7 +43,7 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(streambuf_body,http,beast);
BEAST_DEFINE_TESTSUITE(dynamic_body,http,beast);
} // http
} // beast
+4 -4
View File
@@ -239,20 +239,20 @@ public:
[&]
{
testParser1<nodejs_parser<
true, streambuf_body, fields>>(
true, dynamic_body, fields>>(
Repeat, creq_);
testParser1<nodejs_parser<
false, streambuf_body, fields>>(
false, dynamic_body, fields>>(
Repeat, cres_);
});
timedTest(Trials, "http::basic_parser",
[&]
{
testParser2<bench_parser<
true, streambuf_body, fields> >(
true, dynamic_body, fields> >(
Repeat, creq_);
testParser2<bench_parser<
false, streambuf_body, fields>>(
false, dynamic_body, fields>>(
Repeat, cres_);
});
pass();
+9 -9
View File
@@ -11,8 +11,8 @@
#include "test_parser.hpp"
#include <beast/http/fields.hpp>
#include <beast/http/dynamic_body.hpp>
#include <beast/http/header_parser.hpp>
#include <beast/http/streambuf_body.hpp>
#include <beast/http/string_body.hpp>
#include <beast/test/fail_stream.hpp>
#include <beast/test/string_istream.hpp>
@@ -108,7 +108,7 @@ public:
{
streambuf sb;
test::string_istream ss(ios_, "GET / X");
message_parser<true, streambuf_body, fields> p;
message_parser<true, dynamic_body, fields> p;
read(ss, sb, p);
fail();
}
@@ -194,7 +194,7 @@ public:
"Content-Length: 0\r\n"
"\r\n"
);
request<streambuf_body> m;
request<dynamic_body> m;
try
{
streambuf sb;
@@ -216,7 +216,7 @@ public:
"Content-Length: 0\r\n"
"\r\n"
);
request<streambuf_body> m;
request<dynamic_body> m;
error_code ec;
streambuf sb;
read(fs, sb, m, ec);
@@ -234,7 +234,7 @@ public:
"Content-Length: 0\r\n"
"\r\n"
);
request<streambuf_body> m;
request<dynamic_body> m;
error_code ec;
streambuf sb;
async_read(fs, sb, m, do_yield[ec]);
@@ -250,7 +250,7 @@ public:
{
streambuf sb;
test::string_istream ss(ios_, "");
message_parser<true, streambuf_body, fields> p;
message_parser<true, dynamic_body, fields> p;
error_code ec;
read(ss, sb, p, ec);
BEAST_EXPECT(ec == boost::asio::error::eof);
@@ -258,7 +258,7 @@ public:
{
streambuf sb;
test::string_istream ss(ios_, "");
message_parser<true, streambuf_body, fields> p;
message_parser<true, dynamic_body, fields> p;
error_code ec;
async_read(ss, sb, p, do_yield[ec]);
BEAST_EXPECT(ec == boost::asio::error::eof);
@@ -287,7 +287,7 @@ public:
"GET / HTTP/1.1\r\n\r\n"};
BEAST_EXPECT(handler::count() == 0);
streambuf sb;
message<true, streambuf_body, fields> m;
message<true, dynamic_body, fields> m;
async_read(is, sb, m, handler{});
BEAST_EXPECT(handler::count() > 0);
ios.stop();
@@ -306,7 +306,7 @@ public:
"GET / HTTP/1.1\r\n\r\n"};
BEAST_EXPECT(handler::count() == 0);
streambuf sb;
message<true, streambuf_body, fields> m;
message<true, dynamic_body, fields> m;
async_read(is, sb, m, handler{});
BEAST_EXPECT(handler::count() > 0);
}