diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index b54966e..4b0dff0 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -580,11 +580,11 @@ Dictionary::Ptr ConsoleCommand::SendRequest() http::request request(http::verb::post, std::string(l_Url->Format(false)), 10); - request.set(http::field::user_agent, "Icinga/DebugConsole/" + Application::GetAppVersion()); - request.set(http::field::host, l_Url->GetHost() + ":" + l_Url->GetPort()); + request.set(http::field::user_agent, std::string{"Icinga/DebugConsole/" + Application::GetAppVersion()}); + request.set(http::field::host, std::string{l_Url->GetHost() + ":" + l_Url->GetPort()}); request.set(http::field::accept, "application/json"); - request.set(http::field::authorization, "Basic " + Base64::Encode(l_Url->GetUsername() + ":" + l_Url->GetPassword())); + request.set(http::field::authorization, std::string{"Basic " + Base64::Encode(l_Url->GetUsername() + ":" + l_Url->GetPassword())}); try { http::write(*l_TlsStream, request); diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index 3df9c91..b9b26df 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -489,8 +489,8 @@ void ElasticsearchWriter::SendRequest(const String& body) http::request request (http::verb::post, std::string(url->Format(true)), 10); - request.set(http::field::user_agent, "Icinga/" + Application::GetAppVersion()); - request.set(http::field::host, url->GetHost() + ":" + url->GetPort()); + request.set(http::field::user_agent, std::string{"Icinga/" + Application::GetAppVersion()}); + request.set(http::field::host, std::string{url->GetHost() + ":" + url->GetPort()}); /* Specify required headers by Elasticsearch. */ request.set(http::field::accept, "application/json"); @@ -506,7 +506,7 @@ void ElasticsearchWriter::SendRequest(const String& body) String password = GetPassword(); if (!username.IsEmpty() && !password.IsEmpty()) - request.set(http::field::authorization, "Basic " + Base64::Encode(username + ":" + password)); + request.set(http::field::authorization, std::string{"Basic " + Base64::Encode(username + ":" + password)}); request.body() = body; request.content_length(request.body().size()); diff --git a/lib/perfdata/influxdb2writer.cpp b/lib/perfdata/influxdb2writer.cpp index 57fc94e..c447f60 100644 --- a/lib/perfdata/influxdb2writer.cpp +++ b/lib/perfdata/influxdb2writer.cpp @@ -25,7 +25,7 @@ boost::beast::http::request Influxdb2Writer::As { auto request (AssembleBaseRequest(std::move(body))); - request.set(boost::beast::http::field::authorization, "Token " + GetAuthToken()); + request.set(boost::beast::http::field::authorization, std::string{"Token " + GetAuthToken()}); return std::move(request); } diff --git a/lib/perfdata/influxdbcommonwriter.cpp b/lib/perfdata/influxdbcommonwriter.cpp index 36d88e2..f898832 100644 --- a/lib/perfdata/influxdbcommonwriter.cpp +++ b/lib/perfdata/influxdbcommonwriter.cpp @@ -538,8 +538,8 @@ boost::beast::http::request InfluxdbCommonWrite auto url (AssembleUrl()); http::request request (http::verb::post, std::string(url->Format(true)), 10); - request.set(http::field::user_agent, "Icinga/" + Application::GetAppVersion()); - request.set(http::field::host, url->GetHost() + ":" + url->GetPort()); + request.set(http::field::user_agent, std::string{"Icinga/" + Application::GetAppVersion()}); + request.set(http::field::host, std::string{url->GetHost() + ":" + url->GetPort()}); request.body() = std::move(body); request.content_length(request.body().size()); diff --git a/lib/perfdata/influxdbwriter.cpp b/lib/perfdata/influxdbwriter.cpp index 30240f7..d7548e2 100644 --- a/lib/perfdata/influxdbwriter.cpp +++ b/lib/perfdata/influxdbwriter.cpp @@ -30,7 +30,7 @@ boost::beast::http::request InfluxdbWriter::Ass if (basicAuth) { request.set( boost::beast::http::field::authorization, - "Basic " + Base64::Encode(basicAuth->Get("username") + ":" + basicAuth->Get("password")) + std::string{"Basic " + Base64::Encode(basicAuth->Get("username") + ":" + basicAuth->Get("password"))} ); } diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index cb07557..b6f1969 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -511,7 +511,7 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc) parser.header_limit(1024 * 1024); parser.body_limit(-1); - response.set(http::field::server, l_ServerHeader); + response.set(http::field::server, std::string{l_ServerHeader}); if (!EnsureValidHeaders(*m_Stream, buf, parser, response, m_ShuttingDown, yc)) { break; diff --git a/plugins/check_nscp_api.cpp b/plugins/check_nscp_api.cpp index 3f6843e..2eae6d2 100644 --- a/plugins/check_nscp_api.cpp +++ b/plugins/check_nscp_api.cpp @@ -365,11 +365,11 @@ static Dictionary::Ptr FetchData(const String& host, const String& port, const S http::request request (http::verb::get, std::string(url->Format(true)), 10); - request.set(http::field::user_agent, "Icinga/check_nscp_api/" + String(VERSION)); - request.set(http::field::host, host + ":" + port); + request.set(http::field::user_agent, std::string{"Icinga/check_nscp_api/" + String(VERSION)}); + request.set(http::field::host, std::string{host + ":" + port}); request.set(http::field::accept, "application/json"); - request.set("password", password); + request.set("password", std::string{password}); if (l_Debug) { std::cout << "Sending request to " << url->Format(false, false) << "'.\n";