Refactor HTTP serialization and parsing (API Change):

fix #404

Parsing and serialization interfaces have been fine tuned and unified.

For parsing these stream operations are defined:

* read
* read_header
* read_some
* async_read
* async_read_header
* async_read_some

For serialization these stream operations are defined:

* write
* write_header
* write_some
* async_write
* async_write_header
* async_write_some
This commit is contained in:
Vinnie Falco
2017-07-20 08:12:17 -07:00
parent b76eb2864e
commit 02d5aedc29
44 changed files with 3655 additions and 3250 deletions
+10 -3
View File
@@ -22,6 +22,13 @@ class header_parser_test
, public test::enable_yield_to
{
public:
static
boost::asio::const_buffers_1
buf(string_view s)
{
return {s.data(), s.size()};
}
void
testParse()
{
@@ -34,7 +41,7 @@ public:
flat_buffer db{1024};
header_parser<true, fields> p;
read_some(is, db, p);
BEAST_EXPECT(p.is_complete());
BEAST_EXPECT(p.is_header_done());
}
{
test::string_istream is{ios_,
@@ -47,8 +54,8 @@ public:
flat_buffer db{1024};
header_parser<true, fields> p;
read_some(is, db, p);
BEAST_EXPECT(! p.is_complete());
BEAST_EXPECT(p.state() == parse_state::body);
BEAST_EXPECT(p.is_header_done());
BEAST_EXPECT(! p.is_done());
}
}