async_read works with dynamic_buffer v2.

This commit is contained in:
Klemens authored and Klemens Morgenstern committed 2022-10-14 17:20:15 +08:00
1 parent 73922b72f9
commit 606d776ebb
2 files changed
+43

No files matched your search

+19
View File
@@ -692,6 +692,25 @@ public:
BEAST_EXPECTS(bt == 0, std::to_string(0));
}
{
// bytes_transferred returns length of header
request_parser<string_body> p;
test::stream s(ioc);
s.append(string_view(hdr));
s.append(string_view(body));
std::string res ;
auto fb = asio::dynamic_buffer(res);
error_code ec;
auto bt = read_header(s, fb, p, ec);
BEAST_EXPECTS(!ec, ec.message());
BEAST_EXPECT(bt == hdr.size());
// next read should be zero-size, success
bt = read_header(s, fb, p, ec);
BEAST_EXPECTS(!ec, ec.message());
BEAST_EXPECTS(bt == 0, std::to_string(0));
}
{
// incomplete header consumes all parsable header bytes
request_parser<string_body> p;