Ignore warnings for boost beast

This commit is contained in:
badaix 2022-12-29 11:49:23 +01:00
parent 853c3f622f
commit ae035f5df9
3 changed files with 17 additions and 5 deletions

View file

@ -127,8 +127,8 @@ boost::beast::string_view mime_type(boost::beast::string_view path)
std::string path_cat(boost::beast::string_view base, boost::beast::string_view path) std::string path_cat(boost::beast::string_view base, boost::beast::string_view path)
{ {
if (base.empty()) if (base.empty())
return static_cast<std::string>(path); return std::string(path);
std::string result = static_cast<std::string>(base); std::string result = std::string(base);
char constexpr path_separator = '/'; char constexpr path_separator = '/';
if (result.back() == path_separator) if (result.back() == path_separator)
result.resize(result.size() - 1); result.resize(result.size() - 1);
@ -171,7 +171,7 @@ void ControlSessionHttp::handle_request(http::request<Body, http::basic_fields<A
res.set(http::field::server, HTTP_SERVER_NAME); res.set(http::field::server, HTTP_SERVER_NAME);
res.set(http::field::content_type, "text/html"); res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive()); res.keep_alive(req.keep_alive());
res.body() = static_cast<std::string>(why); res.body() = std::string(why);
res.prepare_payload(); res.prepare_payload();
return res; return res;
}; };
@ -182,7 +182,7 @@ void ControlSessionHttp::handle_request(http::request<Body, http::basic_fields<A
res.set(http::field::server, HTTP_SERVER_NAME); res.set(http::field::server, HTTP_SERVER_NAME);
res.set(http::field::content_type, "text/html"); res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive()); res.keep_alive(req.keep_alive());
res.body() = "The resource '" + static_cast<std::string>(target) + "' was not found."; res.body() = "The resource '" + std::string(target) + "' was not found.";
res.prepare_payload(); res.prepare_payload();
return res; return res;
}; };
@ -204,7 +204,7 @@ void ControlSessionHttp::handle_request(http::request<Body, http::basic_fields<A
res.set(http::field::server, HTTP_SERVER_NAME); res.set(http::field::server, HTTP_SERVER_NAME);
res.set(http::field::content_type, "text/html"); res.set(http::field::content_type, "text/html");
res.keep_alive(req.keep_alive()); res.keep_alive(req.keep_alive());
res.body() = "An error occurred: '" + static_cast<std::string>(what) + "'"; res.body() = "An error occurred: '" + std::string(what) + "'";
res.prepare_payload(); res.prepare_payload();
return res; return res;
}; };

View file

@ -24,7 +24,10 @@
// 3rd party headers // 3rd party headers
#include <boost/asio/strand.hpp> #include <boost/asio/strand.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
#include <boost/beast/core.hpp> #include <boost/beast/core.hpp>
#pragma GCC diagnostic pop
#include <boost/beast/websocket.hpp> #include <boost/beast/websocket.hpp>
// standard headers // standard headers

View file

@ -19,9 +19,18 @@
#ifndef STREAM_SESSION_WS_HPP #ifndef STREAM_SESSION_WS_HPP
#define STREAM_SESSION_WS_HPP #define STREAM_SESSION_WS_HPP
// local headers
#include "stream_session.hpp" #include "stream_session.hpp"
// 3rd party headers
#include <boost/asio/strand.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
#include <boost/beast/core.hpp> #include <boost/beast/core.hpp>
#pragma GCC diagnostic pop
#include <boost/beast/websocket.hpp> #include <boost/beast/websocket.hpp>
// standard headers
#include <deque> #include <deque>
namespace beast = boost::beast; // from <boost/beast.hpp> namespace beast = boost::beast; // from <boost/beast.hpp>