forked from boostorg/beast
serializing file_body is not const
This commit is contained in:
@@ -46,12 +46,16 @@ class write_msg_op
|
||||
//
|
||||
beast::http::message<isRequest, Body, Fields> msg;
|
||||
|
||||
// Serializer for the message
|
||||
beast::http::serializer<isRequest, Body, Fields> sr;
|
||||
|
||||
data(
|
||||
Handler& handler,
|
||||
AsyncWriteStream& stream_,
|
||||
beast::http::message<isRequest, Body, Fields>&& msg_)
|
||||
: stream(stream_)
|
||||
, msg(std::move(msg_))
|
||||
, sr(msg)
|
||||
{
|
||||
boost::ignore_unused(handler);
|
||||
}
|
||||
@@ -96,7 +100,7 @@ public:
|
||||
{
|
||||
auto& d = *d_;
|
||||
beast::http::async_write(
|
||||
d.stream, d.msg, std::move(*this));
|
||||
d.stream, d.sr, std::move(*this));
|
||||
}
|
||||
|
||||
// Completion handler
|
||||
|
||||
@@ -141,11 +141,18 @@ private:
|
||||
auto res = get(full_path, file_ec);
|
||||
|
||||
if(file_ec == beast::errc::no_such_file_or_directory)
|
||||
{
|
||||
http::write(sock_, not_found(), ec);
|
||||
}
|
||||
else if(ec)
|
||||
{
|
||||
http::write(sock_, server_error(file_ec), ec);
|
||||
}
|
||||
else
|
||||
http::write(sock_, std::move(res), ec);
|
||||
{
|
||||
http::serializer<false, decltype(res)::body_type> sr{res};
|
||||
http::write(sock_, sr, ec);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -157,7 +157,8 @@ private:
|
||||
operator()(
|
||||
beast::http::response<Body, Fields>&& res) const
|
||||
{
|
||||
beast::http::write(self_.impl().stream(), res, ec_);
|
||||
beast::http::serializer<false, Body, Fields> sr{res};
|
||||
beast::http::write(self_.impl().stream(), sr, ec_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user