mirror of https://github.com/Icinga/icinga2.git
parent
8dedd47b89
commit
ceea8a24d3
|
@ -149,6 +149,7 @@ void HttpConnection::ProcessMessageAsync(HttpRequest& request)
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
response.SetStatus(401, "Unauthorized");
|
response.SetStatus(401, "Unauthorized");
|
||||||
|
response.AddHeader("Content-Type", "text/html");
|
||||||
response.AddHeader("WWW-Authenticate", "Basic realm=\"Icinga 2\"");
|
response.AddHeader("WWW-Authenticate", "Basic realm=\"Icinga 2\"");
|
||||||
String msg = "<h1>Unauthorized</h1>";
|
String msg = "<h1>Unauthorized</h1>";
|
||||||
response.WriteBody(msg.CStr(), msg.GetLength());
|
response.WriteBody(msg.CStr(), msg.GetLength());
|
||||||
|
|
|
@ -88,6 +88,7 @@ void HttpHandler::ProcessRequest(const ApiUser::Ptr& user, HttpRequest& request,
|
||||||
|
|
||||||
if (!handler || (!exact_match && !handler->CanAlsoHandleUrl(request.RequestUrl))) {
|
if (!handler || (!exact_match && !handler->CanAlsoHandleUrl(request.RequestUrl))) {
|
||||||
response.SetStatus(404, "Not found");
|
response.SetStatus(404, "Not found");
|
||||||
|
response.AddHeader("Content-Type", "text/html");
|
||||||
String msg = "<h1>Not found</h1>";
|
String msg = "<h1>Not found</h1>";
|
||||||
response.WriteBody(msg.CStr(), msg.GetLength());
|
response.WriteBody(msg.CStr(), msg.GetLength());
|
||||||
response.Finish();
|
response.Finish();
|
||||||
|
|
Loading…
Reference in New Issue