forked from boostorg/beast
Refactor chunked parsing (API Change):
* parser now has a callback feature for intercepting chunk headers and chunk bodies * The names for basic_parser derived class callbacks have been refactored * basic_parser offers an additional callback for distinguishing chunk body data. Actions Required: * Adjust signatures for required members of user-defined subclasses of basic_parser * Use the new basic_parser chunk callbacks for accessing chunk extensions and chunk bodies.
This commit is contained in:
@@ -328,49 +328,6 @@ public:
|
||||
BEAST_EXPECT(used == 0);
|
||||
}
|
||||
|
||||
void
|
||||
testCallback()
|
||||
{
|
||||
{
|
||||
multi_buffer b;
|
||||
ostream(b) <<
|
||||
"POST / HTTP/1.1\r\n"
|
||||
"Content-Length: 2\r\n"
|
||||
"\r\n"
|
||||
"**";
|
||||
error_code ec;
|
||||
parser<true, string_body> p;
|
||||
p.eager(true);
|
||||
p.put(b.data(), ec);
|
||||
p.on_header(
|
||||
[this](parser<true, string_body>& p, error_code& ec)
|
||||
{
|
||||
BEAST_EXPECT(p.is_header_done());
|
||||
ec.assign(0, ec.category());
|
||||
});
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
}
|
||||
{
|
||||
multi_buffer b;
|
||||
ostream(b) <<
|
||||
"POST / HTTP/1.1\r\n"
|
||||
"Content-Length: 2\r\n"
|
||||
"\r\n"
|
||||
"**";
|
||||
error_code ec;
|
||||
parser<true, string_body> p;
|
||||
p.eager(true);
|
||||
p.put(b.data(), ec);
|
||||
p.on_header(
|
||||
[this](parser<true, string_body>&, error_code& ec)
|
||||
{
|
||||
ec.assign(errc::bad_message,
|
||||
generic_category());
|
||||
});
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@@ -378,7 +335,6 @@ public:
|
||||
testNeedMore<flat_buffer>();
|
||||
testNeedMore<multi_buffer>();
|
||||
testGotSome();
|
||||
testCallback();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user