Parser concept, fixes:

A new concept Parser is introduced with routines to read from a stream
into the parser. This solves a problem with the old read interface where
messages must be default constructible and move assignable.

Parser fixes:

* Fix detect invalid reason-phrase octets
* Fix write_eof to set the 'complete' state on success
* Fix consider parse complete if eof received on empty body

WebSocket:

* Increase coverage
This commit is contained in:
Vinnie Falco
2016-04-30 10:29:39 -04:00
parent b62d1b2164
commit 4f1b9089b8
28 changed files with 1536 additions and 701 deletions
+9 -8
View File
@@ -33,20 +33,20 @@ public:
return s;
}
void testBuffers()
template<class BufferType>
void testMatrix()
{
using boost::asio::buffer_size;
using boost::asio::const_buffer;
std::string const s = "Hello, world";
std::string s = "Hello, world";
expect(s.size() == 12);
for(std::size_t x = 1; x < 4; ++x) {
for(std::size_t y = 1; y < 4; ++y) {
std::size_t z = s.size() - (x + y);
{
std::array<const_buffer, 3> bs{{
const_buffer{&s[0], x},
const_buffer{&s[x], y},
const_buffer{&s[x+y], z}}};
std::array<BufferType, 3> bs{{
BufferType{&s[0], x},
BufferType{&s[x], y},
BufferType{&s[x+y], z}}};
for(std::size_t i = 0; i <= s.size() + 1; ++i)
{
auto pb = prepare_buffers(i, bs);
@@ -104,7 +104,8 @@ public:
void run() override
{
testBuffers();
testMatrix<boost::asio::const_buffer>();
testMatrix<boost::asio::mutable_buffer>();
testNullBuffers();
testIterator();
}