mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-23 03:05:48 +03:00
147 lines
7 KiB
Diff
147 lines
7 KiB
Diff
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<http::string_body> 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<http::string_body> 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<boost::beast::http::string_body> 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<boost::beast::http::string_body> InfluxdbCommonWrite
|
|
auto url (AssembleUrl());
|
|
http::request<http::string_body> 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<boost::beast::http::string_body> 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/httphandler.cpp b/lib/remote/httphandler.cpp
|
|
index e1bb4f4..1e5d12c 100644
|
|
--- a/lib/remote/httphandler.cpp
|
|
+++ b/lib/remote/httphandler.cpp
|
|
@@ -58,7 +58,7 @@ void HttpHandler::ProcessRequest(
|
|
Dictionary::Ptr node = m_UrlTree;
|
|
std::vector<HttpHandler::Ptr> handlers;
|
|
|
|
- Url::Ptr url = new Url(request.target().to_string());
|
|
+ Url::Ptr url = new Url(std::string{request.target()});
|
|
auto& path (url->GetPath());
|
|
|
|
for (std::vector<String>::size_type i = 0; i <= path.size(); i++) {
|
|
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
|
|
@@ -246,7 +246,7 @@ bool HandleAccessControl(
|
|
if (!allowedOrigins.empty()) {
|
|
auto& origin (request[http::field::origin]);
|
|
|
|
- if (allowedOrigins.find(origin.to_string()) != allowedOrigins.end()) {
|
|
+ if (allowedOrigins.find(std::string{origin}) != allowedOrigins.end()) {
|
|
response.set(http::field::access_control_allow_origin, origin);
|
|
}
|
|
|
|
@@ -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;
|
|
@@ -536,7 +536,7 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
|
|
if (!authenticatedUser) {
|
|
CpuBoundWork fetchingAuthenticatedUser (yc);
|
|
|
|
- authenticatedUser = ApiUser::GetByAuthHeader(request[http::field::authorization].to_string());
|
|
+ authenticatedUser = ApiUser::GetByAuthHeader(std::string{request[http::field::authorization]});
|
|
}
|
|
|
|
Log logMsg (LogInformation, "HttpServerConnection");
|
|
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<http::string_body> 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";
|