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 8921da91b8
commit 2a8de0fd6b
28 changed files with 1536 additions and 701 deletions

View File

@@ -30,6 +30,14 @@ public:
h.insert(std::to_string(i), i);
}
template<class U, class V>
static
void
self_assign(U& u, V&& v)
{
u = std::forward<V>(v);
}
void testHeaders()
{
bh h1;
@@ -47,12 +55,23 @@ public:
bh h3(std::move(h1));
expect(h3.size() == 2);
expect(h1.size() == 0);
h2 = std::move(h2);
self_assign(h3, std::move(h3));
expect(h3.size() == 2);
expect(h2.erase("Not-Present") == 0);
}
void testRFC2616()
{
bh h;
h.insert("a", "x");
h.insert("a", "y");
expect(h["a"] == "x,y");
}
void run() override
{
testHeaders();
testRFC2616();
}
};