Admin: review error handling on auth. failure.

This commit is contained in:
Michael Meeks
2017-03-15 16:25:29 +00:00
parent 909b5f8ac3
commit 0089723f69
2 changed files with 9 additions and 26 deletions

View File

@ -232,10 +232,10 @@ void AdminRequestHandler::sendTextFrame(const std::string& message)
sendFrame(message);
}
bool AdminRequestHandler::handleInitialRequest(const std::weak_ptr<StreamSocket> &socketWeak,
const Poco::Net::HTTPRequest& request)
bool AdminRequestHandler::handleInitialRequest(
const std::weak_ptr<StreamSocket> &socketWeak,
const Poco::Net::HTTPRequest& request)
{
HTTPResponse response;
auto socket = socketWeak.lock();
// Different session id pool for admin sessions (?)
@ -260,28 +260,12 @@ bool AdminRequestHandler::handleInitialRequest(const std::weak_ptr<StreamSocket>
return true;
}
// FIXME: ... should we move ourselves to an Admin poll [!?] ...
// Probably [!] ... and use this termination thing ? ...
// Perhaps that should be the 'Admin' instance / sub-class etc.
// FIXME: have name 'admin' etc.
// []() { return TerminationFlag.load(); });
#if 0
catch(const Poco::Net::NotAuthenticatedException& exc)
{
LOG_INF("Admin::NotAuthenticated");
response.set("WWW-Authenticate", "Basic realm=\"online\"");
response.setStatusAndReason(HTTPResponse::HTTP_UNAUTHORIZED);
response.setContentLength(0);
socket->send(response);
}
catch (const std::exception& exc)
{
LOG_INF("Admin::handleRequest: Exception: " << exc.what());
response.setStatusAndReason(HTTPResponse::HTTP_BAD_REQUEST);
response.setContentLength(0);
socket->send(response);
}
#endif
HTTPResponse response;
response.setStatusAndReason(HTTPResponse::HTTP_BAD_REQUEST);
response.setContentLength(0);
LOG_INF("Admin::handleInitialRequest bad request");
socket->send(response);
return false;
}

View File

@ -51,7 +51,6 @@ private:
private:
Admin* _admin;
// std::shared_ptr<LOOLWebSocket> _adminWs; FIXME - this is us now !
int _sessionId;
bool _isAuthenticated;
};