From f1f4cbd996aa00b6e4d3d04d0223d02fd553dd96 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 26 May 2020 18:19:28 +0200 Subject: Fix Authorization (WIP) --- response.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'response.cpp') diff --git a/response.cpp b/response.cpp index 67cb322..5f4f3f2 100644 --- a/response.cpp +++ b/response.cpp @@ -248,14 +248,14 @@ response_type generate_response(request_type& req, Server& server) if (auth.size() != 0) { std::string authorization{req[http::field::authorization]}; if (authorization.substr(0, 6) != "Basic "s) - return HttpStatusAndStats("400", "Bad Authorization Type", req_ctx, res); + return HttpStatusAndStats("401", "Bad Authorization Type", req_ctx, res); authorization = authorization.substr(6); authorization = decode64(authorization); size_t pos {authorization.find(':')}; if (pos == authorization.npos) - return HttpStatusAndStats("400", "Bad Authorization Encoding", req_ctx, res); + return HttpStatusAndStats("401", "Bad Authorization Encoding", req_ctx, res); std::string login{authorization.substr(0, pos)}; std::string password{authorization.substr(pos + 1)}; @@ -268,7 +268,7 @@ response_type generate_response(request_type& req, Server& server) // For now, WWW-Authenticate: Basic realm="..." will only be generated for static-files. // All other plugins are expected to present their own login pages if (req_ctx.GetPluginName() == "static-files") - res.set(http::field::www_authenticate, "Basic realm=\"Webbox Login\""); + res.set(http::field::www_authenticate, "Basic realm=\"Reichwein.IT Webserver Login\""); return HttpStatusAndStats("401", "Bad Authorization", req_ctx, res); } -- cgit v1.2.3