mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
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:
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user