mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
parser uses basic_fields::insert() with error_code overload
This commit is contained in:
committed by
Mohammad Nejati
parent
2e6d9bb491
commit
a9c4a19f26
@ -430,9 +430,9 @@ private:
|
||||
field name,
|
||||
string_view name_string,
|
||||
string_view value,
|
||||
error_code&) override
|
||||
error_code& ec) override
|
||||
{
|
||||
m_.insert(name, name_string, value);
|
||||
m_.insert(name, name_string, value, ec);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -326,6 +326,40 @@ public:
|
||||
BEAST_EXPECT(used == 0);
|
||||
}
|
||||
|
||||
void
|
||||
testHeaderFieldLimits()
|
||||
{
|
||||
auto big_field_name = std::string(fields::max_name_size + 1, 'a');
|
||||
auto big_field_value = std::string(fields::max_value_size + 1, 'a');
|
||||
|
||||
{
|
||||
parser_type<false> p;
|
||||
p.header_limit((std::numeric_limits<std::uint32_t>::max)());
|
||||
error_code ec;
|
||||
flat_buffer b;
|
||||
ostream(b) <<
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
<< big_field_name
|
||||
<<": value\r\n"
|
||||
"\r\n";
|
||||
put(b.data(), p, ec);
|
||||
BEAST_EXPECT(ec == error::header_field_name_too_large);
|
||||
}
|
||||
{
|
||||
parser_type<false> p;
|
||||
p.header_limit((std::numeric_limits<std::uint32_t>::max)());
|
||||
error_code ec;
|
||||
flat_buffer b;
|
||||
ostream(b) <<
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
<< "name: "
|
||||
<< big_field_value << "\r\n"
|
||||
<< "\r\n";
|
||||
put(b.data(), p, ec);
|
||||
BEAST_EXPECT(ec == error::header_field_value_too_large);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testIssue818()
|
||||
{
|
||||
@ -457,6 +491,7 @@ public:
|
||||
testParse();
|
||||
testNeedMore<flat_buffer>();
|
||||
testNeedMore<multi_buffer>();
|
||||
testHeaderFieldLimits();
|
||||
testGotSome();
|
||||
testIssue818();
|
||||
testIssue1187();
|
||||
|
Reference in New Issue
Block a user