forked from boostorg/beast
message::body is a member function (API Change):
fix #778 * The body data member is replaced with accessor member functions. Actions Required: * Call member function message::body instead of accessing the data member at call sites.
This commit is contained in:
@@ -119,7 +119,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -132,7 +132,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -145,7 +145,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -115,7 +115,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -128,7 +128,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -141,7 +141,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -131,7 +131,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -144,7 +144,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -114,7 +114,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -127,7 +127,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -140,7 +140,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -212,7 +212,7 @@ private:
|
||||
string_response_->set(http::field::server, "Beast");
|
||||
string_response_->set(http::field::connection, "close");
|
||||
string_response_->set(http::field::content_type, "text/plain");
|
||||
string_response_->body = error;
|
||||
string_response_->body() = error;
|
||||
string_response_->prepare_payload();
|
||||
|
||||
string_serializer_.emplace(*string_response_);
|
||||
@@ -268,7 +268,7 @@ private:
|
||||
file_response_->set(http::field::server, "Beast");
|
||||
file_response_->set(http::field::connection, "close");
|
||||
file_response_->set(http::field::content_type, mime_type(target.to_string()));
|
||||
file_response_->body = std::move(file);
|
||||
file_response_->body() = std::move(file);
|
||||
file_response_->prepare_payload();
|
||||
|
||||
file_serializer_.emplace(*file_response_);
|
||||
|
||||
@@ -119,7 +119,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -132,7 +132,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -145,7 +145,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
// we do not recognize the request method.
|
||||
response_.result(http::status::bad_request);
|
||||
response_.set(http::field::content_type, "text/plain");
|
||||
boost::beast::ostream(response_.body)
|
||||
boost::beast::ostream(response_.body())
|
||||
<< "Invalid request-method '"
|
||||
<< request_.method_string().to_string()
|
||||
<< "'";
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
if(request_.target() == "/count")
|
||||
{
|
||||
response_.set(http::field::content_type, "text/html");
|
||||
boost::beast::ostream(response_.body)
|
||||
boost::beast::ostream(response_.body())
|
||||
<< "<html>\n"
|
||||
<< "<head><title>Request count</title></head>\n"
|
||||
<< "<body>\n"
|
||||
@@ -147,7 +147,7 @@ private:
|
||||
else if(request_.target() == "/time")
|
||||
{
|
||||
response_.set(http::field::content_type, "text/html");
|
||||
boost::beast::ostream(response_.body)
|
||||
boost::beast::ostream(response_.body())
|
||||
<< "<html>\n"
|
||||
<< "<head><title>Current time</title></head>\n"
|
||||
<< "<body>\n"
|
||||
@@ -162,7 +162,7 @@ private:
|
||||
{
|
||||
response_.result(http::status::not_found);
|
||||
response_.set(http::field::content_type, "text/plain");
|
||||
boost::beast::ostream(response_.body) << "File not found\r\n";
|
||||
boost::beast::ostream(response_.body()) << "File not found\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ private:
|
||||
{
|
||||
auto self = shared_from_this();
|
||||
|
||||
response_.set(http::field::content_length, response_.body.size());
|
||||
response_.set(http::field::content_length, response_.body().size());
|
||||
|
||||
http::async_write(
|
||||
socket_,
|
||||
|
||||
@@ -120,7 +120,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -133,7 +133,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -146,7 +146,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -116,7 +116,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -129,7 +129,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -142,7 +142,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -115,7 +115,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -128,7 +128,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -141,7 +141,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -113,7 +113,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = why.to_string();
|
||||
res.body() = why.to_string();
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -126,7 +126,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
@@ -139,7 +139,7 @@ handle_request(
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
res.set(http::field::content_type, "text/html");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body = "An error occurred: '" + what.to_string() + "'";
|
||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
||||
res.prepare_payload();
|
||||
return res;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user