mirror of https://github.com/Icinga/icinga2.git
parent
a9f14f11e4
commit
f51a76e13d
|
@ -143,13 +143,17 @@ void HttpServerConnection::ProcessMessageAsync(HttpRequest& request)
|
||||||
user.reset();
|
user.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String requestUrl = request.RequestUrl->Format();
|
||||||
|
|
||||||
Log(LogInformation, "HttpServerConnection")
|
Log(LogInformation, "HttpServerConnection")
|
||||||
<< "Request: " << request.RequestMethod << " " << request.RequestUrl->Format()
|
<< "Request: " << request.RequestMethod << " " << requestUrl
|
||||||
<< " (" << (user ? user->GetName() : "<unauthenticated>") << ")";
|
<< " (" << (user ? user->GetName() : "<unauthenticated>") << ")";
|
||||||
|
|
||||||
HttpResponse response(m_Stream, request);
|
HttpResponse response(m_Stream, request);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
Log(LogWarning, "HttpServerConnection")
|
||||||
|
<< "Unauthorized request: " << request.RequestMethod << " " << requestUrl;
|
||||||
response.SetStatus(401, "Unauthorized");
|
response.SetStatus(401, "Unauthorized");
|
||||||
response.AddHeader("Content-Type", "text/html");
|
response.AddHeader("Content-Type", "text/html");
|
||||||
response.AddHeader("WWW-Authenticate", "Basic realm=\"Icinga 2\"");
|
response.AddHeader("WWW-Authenticate", "Basic realm=\"Icinga 2\"");
|
||||||
|
|
Loading…
Reference in New Issue