diff --git a/include/boost/http_proto/string_body.hpp b/include/boost/http_proto/string_body.hpp
index b7ae5c2c..6dac063e 100644
--- a/include/boost/http_proto/string_body.hpp
+++ b/include/boost/http_proto/string_body.hpp
@@ -28,7 +28,6 @@ namespace http_proto {
@code
serializer sr(ctx);
response res(status::not_found);
-
std::string body =
"\n"
"
\n"
@@ -36,6 +35,7 @@ namespace http_proto {
" Sorry, the page does not exist.
\n"
" \n"
"\n";
+ res.set_payload_size(body.size());
sr.start(res, std::move(body));
@endcode
diff --git a/src/parser.cpp b/src/parser.cpp
index 2ad6ce49..201acdfd 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1116,7 +1116,7 @@ parse(
break;
case content_coding::gzip:
- if(!svc_.cfg.apply_deflate_decoder)
+ if(!svc_.cfg.apply_gzip_decoder)
goto no_filter;
filter_ = &ws_.emplace(
ctx_, ws_, svc_.cfg.zlib_window_bits + 16);
@@ -1735,7 +1735,7 @@ apply_filter(
{
cb1_.commit(f_rs.out_bytes);
auto sink_rs = sink_->write(
- cb1_.data(), !f_rs.finished);
+ cb1_.data(), !f_rs.finished || more);
cb1_.consume(sink_rs.bytes);
if(sink_rs.ec.failed())
{
diff --git a/test/unit/compression.cpp b/test/unit/compression.cpp
index 2f9f00df..643e8186 100644
--- a/test/unit/compression.cpp
+++ b/test/unit/compression.cpp
@@ -246,6 +246,7 @@ struct zlib_test
class source_t : public source
{
buffers::const_buffer body_;
+ bool done_ = false;
public:
source_t(buffers::const_buffer body)
@@ -256,11 +257,14 @@ struct zlib_test
results
on_read(buffers::mutable_buffer b)
{
+ BOOST_TEST_NOT(done_);
+
results rs;
auto n = buffers::copy(b, body_);
body_ = buffers::sans_prefix(body_, n);
rs.bytes = n;
rs.finished = (body_.size() == 0);
+ done_ = rs.finished;
return rs;
}
};
@@ -561,6 +565,7 @@ struct zlib_test
class sink_t : public sink
{
std::string body_;
+ bool done_ = false;
public:
std::string
@@ -572,8 +577,11 @@ struct zlib_test
results
on_write(
buffers::const_buffer b,
- bool) override
+ bool more) override
{
+ BOOST_TEST_NOT(done_);
+ done_ = !more;
+
body_.append(
static_cast(b.data()),
b.size());