Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/boost/http_proto/string_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ namespace http_proto {
@code
serializer sr(ctx);
response res(status::not_found);

std::string body =
"<html>\n"
" <body>\n"
" <h1>404 Not Found</h1>\n"
" <p>Sorry, the page does not exist.</p>\n"
" </body>\n"
"</html>\n";
res.set_payload_size(body.size());
sr.start<string_body>(res, std::move(body));
@endcode

Expand Down
4 changes: 2 additions & 2 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<zlib_filter>(
ctx_, ws_, svc_.cfg.zlib_window_bits + 16);
Expand Down Expand Up @@ -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())
{
Expand Down
10 changes: 9 additions & 1 deletion test/unit/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
};
Expand Down Expand Up @@ -561,6 +565,7 @@ struct zlib_test
class sink_t : public sink
{
std::string body_;
bool done_ = false;

public:
std::string
Expand All @@ -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<const char*>(b.data()),
b.size());
Expand Down
Loading