message::version is a member function (API Change):

fix #778

* The version data member is replaced with accessor
  member functions.

Actions Required:

* Call member function message::version instead of accessing
  the version member at call sites.
This commit is contained in:
Vinnie Falco
2017-09-12 17:13:02 -07:00
parent 54fe7cacf7
commit 38e28966ea
33 changed files with 218 additions and 178 deletions
@@ -115,7 +115,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -128,7 +128,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -141,7 +141,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -182,7 +182,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -194,7 +194,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -111,7 +111,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -124,7 +124,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -137,7 +137,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -178,7 +178,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -190,7 +190,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -114,7 +114,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -127,7 +127,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -140,7 +140,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -181,7 +181,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -193,7 +193,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -110,7 +110,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -123,7 +123,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -136,7 +136,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -177,7 +177,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -189,7 +189,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -115,7 +115,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -128,7 +128,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -141,7 +141,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -182,7 +182,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -194,7 +194,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -100,7 +100,7 @@ private:
void
process_request()
{
response_.version = 11;
response_.version(11);
response_.set(http::field::connection, "close");
switch(request_.method())
@@ -116,7 +116,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -129,7 +129,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -142,7 +142,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -183,7 +183,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -195,7 +195,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -112,7 +112,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -125,7 +125,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -138,7 +138,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -179,7 +179,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -191,7 +191,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -111,7 +111,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -124,7 +124,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -137,7 +137,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -178,7 +178,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -190,7 +190,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -109,7 +109,7 @@ handle_request(
auto const bad_request =
[&req](boost::beast::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version};
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -122,7 +122,7 @@ handle_request(
auto const not_found =
[&req](boost::beast::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version};
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -135,7 +135,7 @@ handle_request(
auto const server_error =
[&req](boost::beast::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version};
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive());
@@ -176,7 +176,7 @@ handle_request(
// Respond to HEAD request
if(req.method() == http::verb::head)
{
http::response<http::empty_body> res{http::status::ok, req.version};
http::response<http::empty_body> res{http::status::ok, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());
@@ -188,7 +188,7 @@ handle_request(
http::response<http::file_body> res{
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version)};
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
res.set(http::field::content_type, mime_type(path));
res.content_length(body.size());