mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 22:34:32 +02:00
Throw on invalid argument
This condition is a programmer error, so reporting it as a regular error is confusing. Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
committed by
Vinnie Falco
parent
11ee655f97
commit
610a2681e4
@@ -360,7 +360,10 @@ doWrite(z_params& zs, boost::optional<Flush> flush, error_code& ec)
|
||||
{
|
||||
maybe_init();
|
||||
|
||||
if(zs.next_out == 0 || (zs.next_in == 0 && zs.avail_in != 0) ||
|
||||
if(zs.next_in == nullptr && zs.avail_in != 0)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument{"invalid input"});
|
||||
|
||||
if(zs.next_out == nullptr ||
|
||||
(status_ == FINISH_STATE && flush != Flush::finish))
|
||||
{
|
||||
ec = error::stream_error;
|
||||
|
@@ -328,6 +328,17 @@ public:
|
||||
deflate_stream ds;
|
||||
ds.reset(compression::default_size, 15, -1, Strategy::normal);
|
||||
});
|
||||
except<std::invalid_argument>(
|
||||
[]()
|
||||
{
|
||||
deflate_stream ds;
|
||||
ds.reset();
|
||||
z_params zp{};
|
||||
zp.avail_in = 1;
|
||||
zp.next_in = nullptr;
|
||||
error_code ec;
|
||||
ds.write(zp, Flush::full, ec);
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user