From ceea8a24d3e43a70614b9792bb3bfb7e13acfe8d Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 13 Jul 2015 08:29:48 +0200 Subject: [PATCH] Add missing HTTP response headers refs #9594 --- lib/remote/httpconnection.cpp | 1 + lib/remote/httphandler.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/remote/httpconnection.cpp b/lib/remote/httpconnection.cpp index 654988ca4..6aee8a19c 100644 --- a/lib/remote/httpconnection.cpp +++ b/lib/remote/httpconnection.cpp @@ -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 = "

Unauthorized

"; response.WriteBody(msg.CStr(), msg.GetLength()); diff --git a/lib/remote/httphandler.cpp b/lib/remote/httphandler.cpp index fde43c2b5..d785952ac 100644 --- a/lib/remote/httphandler.cpp +++ b/lib/remote/httphandler.cpp @@ -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 = "

Not found

"; response.WriteBody(msg.CStr(), msg.GetLength()); response.Finish(); -- 2.40.0