mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 21:34:46 +02:00
Add overload for basic_fields::insert() to set error_code
This commit is contained in:
committed by
Mohammad Nejati
parent
848e20680f
commit
2e6d9bb491
@@ -72,6 +72,9 @@ public:
|
||||
|
||||
check("beast.http", error::stale_parser);
|
||||
check("beast.http", error::short_read);
|
||||
|
||||
check("beast.http", error::header_field_name_too_large);
|
||||
check("beast.http", error::header_field_value_too_large);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -445,6 +445,33 @@ public:
|
||||
BEAST_EXPECT(std::next(rng.first, 1)->value() == "4");
|
||||
BEAST_EXPECT(std::next(rng.first, 2)->value() == "6");
|
||||
}
|
||||
|
||||
// max field name and max field value
|
||||
{
|
||||
fields f;
|
||||
error_code ec;
|
||||
auto fit_name = std::string(fields::max_name_size, 'a');
|
||||
auto big_name = std::string(fields::max_name_size + 1, 'a');
|
||||
auto fit_value = std::string(fields::max_value_size, 'a');
|
||||
auto big_value = std::string(fields::max_value_size + 1, 'a');
|
||||
|
||||
f.insert(fit_name, fit_value);
|
||||
f.set(fit_name, fit_value);
|
||||
|
||||
f.insert(field::age, big_name, "", ec);
|
||||
BEAST_EXPECT(ec == error::header_field_name_too_large);
|
||||
f.insert(field::age, "", big_value, ec);
|
||||
BEAST_EXPECT(ec == error::header_field_value_too_large);
|
||||
|
||||
BEAST_THROWS(f.insert(field::age, big_value), boost::system::system_error);
|
||||
BEAST_THROWS(f.insert(field::age, big_name, ""), boost::system::system_error);
|
||||
BEAST_THROWS(f.insert(field::age, "", big_value), boost::system::system_error);
|
||||
BEAST_THROWS(f.insert(big_name, ""), boost::system::system_error);
|
||||
BEAST_THROWS(f.insert("", big_value), boost::system::system_error);
|
||||
BEAST_THROWS(f.set(field::age, big_value), boost::system::system_error);
|
||||
BEAST_THROWS(f.set(big_name, ""), boost::system::system_error);
|
||||
BEAST_THROWS(f.set("", big_value), boost::system::system_error);
|
||||
}
|
||||
}
|
||||
|
||||
struct sized_body
|
||||
|
Reference in New Issue
Block a user