]> granicus.if.org Git - icinga2/commitdiff
Add missing HTTP response headers
authorGunnar Beutner <gunnar@beutner.name>
Mon, 13 Jul 2015 06:29:48 +0000 (08:29 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 13 Jul 2015 06:29:48 +0000 (08:29 +0200)
refs #9594

lib/remote/httpconnection.cpp
lib/remote/httphandler.cpp

index 654988ca4b9de81ed099ad2c592af6494fdcf0e2..6aee8a19c039584e5c489e89852ac9ee3d2c4b0b 100644 (file)
@@ -149,6 +149,7 @@ void HttpConnection::ProcessMessageAsync(HttpRequest& request)
 
        if (!user) {
                response.SetStatus(401, "Unauthorized");
+               response.AddHeader("Content-Type", "text/html");
                response.AddHeader("WWW-Authenticate", "Basic realm=\"Icinga 2\"");
                String msg = "<h1>Unauthorized</h1>";
                response.WriteBody(msg.CStr(), msg.GetLength());
index fde43c2b503ccda3b856f5fe2adbc4303174c376..d785952acc528318cc254274866fe118d286d0e0 100644 (file)
@@ -88,6 +88,7 @@ void HttpHandler::ProcessRequest(const ApiUser::Ptr& user, HttpRequest& request,
 
        if (!handler || (!exact_match && !handler->CanAlsoHandleUrl(request.RequestUrl))) {
                response.SetStatus(404, "Not found");
+               response.AddHeader("Content-Type", "text/html");
                String msg = "<h1>Not found</h1>";
                response.WriteBody(msg.CStr(), msg.GetLength());
                response.Finish();