Skip to content

Commit

Permalink
Add missing HTTP response headers
Browse files Browse the repository at this point in the history
refs #9594
  • Loading branch information
gunnarbeutner committed Jul 13, 2015
1 parent 8dedd47 commit ceea8a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/remote/httpconnection.cpp
Expand Up @@ -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());
Expand Down
1 change: 1 addition & 0 deletions lib/remote/httphandler.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit ceea8a2

Please sign in to comment.