Buildable code

This commit is contained in:
alesapin 2021-04-06 16:42:38 +03:00
parent 1c8e33414f
commit d913f327ed
2 changed files with 3 additions and 4 deletions

View File

@ -104,7 +104,7 @@ void InterserverIOHTTPHandler::handleRequest(HTTPServerRequest & request, HTTPSe
try
{
if (checkAuthentication(request))
if (auto [message, success] = checkAuthentication(request); success)
{
processQuery(request, response, used_output);
used_output.out->finalize();
@ -121,7 +121,7 @@ void InterserverIOHTTPHandler::handleRequest(HTTPServerRequest & request, HTTPSe
{
if (e.code() == ErrorCodes::WRONG_PASSWORD)
{
response.setStatusAndReason(Poco::Net::HTTPServerResponse::HTTP_UNAUTHORIZED);
response.setStatusAndReason(HTTPServerResponse::HTTP_UNAUTHORIZED);
if (!response.sent())
writeString("Unauthorized.", *used_output.out);
LOG_WARNING(log, "Query processing failed request: '{}' authentication failed", request.getURI());

View File

@ -47,10 +47,9 @@ private:
void processQuery(HTTPServerRequest & request, HTTPServerResponse & response, Output & used_output);
bool checkAuthentication(Poco::Net::HTTPServerRequest & request) const;
std::pair<String, bool> checkAuthentication(HTTPServerRequest & request) const;
const std::string default_user;
const std::string default_password;
std::pair<String, bool> checkAuthentication(HTTPServerRequest & request) const;
};
}