[Libreoffice-commits] online.git: loolwsd/Admin.cpp loolwsd/Common.hpp loolwsd/FileServer.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sat Apr 16 17:29:53 UTC 2016


 loolwsd/Admin.cpp      |    6 +++---
 loolwsd/Common.hpp     |    2 --
 loolwsd/FileServer.hpp |    4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 4254ddad7752663915a58f5ec87213a027a6b69a
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Apr 16 12:28:55 2016 -0400

    loolwsd: consistently set HTTP status and reason everywhere
    
    Change-Id: Ie538e4907e3a3a514918000bb585d2aaf182e468
    Reviewed-on: https://gerrit.libreoffice.org/24132
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/Admin.cpp b/loolwsd/Admin.cpp
index e647ae7..3ba553a 100644
--- a/loolwsd/Admin.cpp
+++ b/loolwsd/Admin.cpp
@@ -310,7 +310,7 @@ void AdminRequestHandler::handleWSRequests(HTTPServerRequest& request, HTTPServe
     {
         Log::info("NotAuthenticatedException");
         response.set("WWW-Authenticate", "Basic realm=\"ws-online\"");
-        response.setStatus(HTTPResponse::HTTP_UNAUTHORIZED);
+        response.setStatusAndReason(HTTPResponse::HTTP_UNAUTHORIZED);
         response.setContentLength(0);
         response.send();
     }
@@ -350,13 +350,13 @@ void AdminRequestHandler::handleRequest(HTTPServerRequest& request, HTTPServerRe
     {
         Log::info("Admin::NotAuthenticated");
         response.set("WWW-Authenticate", "Basic realm=\"online\"");
-        response.setStatus(HTTPResponse::HTTP_UNAUTHORIZED);
+        response.setStatusAndReason(HTTPResponse::HTTP_UNAUTHORIZED);
         response.setContentLength(0);
         response.send();
     }
     catch (const std::exception& exc)
     {
-        Log::info("Unknown Exception caught");
+        Log::info(std::string("Admin::handleRequest: Exception: ") + exc.what());
         response.setStatusAndReason(HTTPResponse::HTTP_BAD_REQUEST);
         response.setContentLength(0);
         response.send();
diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp
index 43a67e9..d287736 100644
--- a/loolwsd/Common.hpp
+++ b/loolwsd/Common.hpp
@@ -11,8 +11,6 @@
 #ifndef INCLUDED_COMMON_HPP
 #define INCLUDED_COMMON_HPP
 
-#include <string>
-
 // The maximum number of client connections we can accept.
 constexpr int MAX_SESSIONS = 1024;
 
diff --git a/loolwsd/FileServer.hpp b/loolwsd/FileServer.hpp
index 293e34e..d869e11 100644
--- a/loolwsd/FileServer.hpp
+++ b/loolwsd/FileServer.hpp
@@ -171,14 +171,14 @@ public:
         {
             Log::error("FileServerRequestHandler::NotAuthenticated: " + exc.displayText());
             response.set("WWW-Authenticate", "Basic realm=\"online\"");
-            response.setStatus(HTTPResponse::HTTP_UNAUTHORIZED);
+            response.setStatusAndReason(HTTPResponse::HTTP_UNAUTHORIZED);
             response.setContentLength(0);
             response.send();
         }
         catch (const Poco::FileNotFoundException& exc)
         {
             Log::error("FileServerRequestHandler: " + exc.displayText());
-            response.setStatus(HTTPResponse::HTTP_NOT_FOUND);
+            response.setStatusAndReason(HTTPResponse::HTTP_NOT_FOUND);
             response.setContentLength(0);
             response.send();
         }


More information about the Libreoffice-commits mailing list