[Libreoffice-commits] online.git: wsd/FileServer.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jun 11 20:17:22 UTC 2018


 wsd/FileServer.cpp |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 18750d2d39948e6fda38e2c9b8be15b375c896cb
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Feb 23 19:16:57 2018 -0500

    wsd: warn for invalid file requests by clients instead of error
    
    Also, logs append new-line automatically.
    
    Change-Id: Ie5b09e454236cab2cdaa14d6f8be7b67e8fb1000
    Reviewed-on: https://gerrit.libreoffice.org/52416
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 1783b0596..5f721f920 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -439,7 +439,7 @@ void FileServerRequestHandler::handleRequest(const HTTPRequest& request, Poco::M
     }
     catch (const Poco::FileNotFoundException& exc)
     {
-        LOG_ERR("FileServerRequestHandler: " << exc.displayText());
+        LOG_WRN("FileServerRequestHandler: " << exc.displayText());
 
         // 404 not found
         std::ostringstream oss;
@@ -458,7 +458,7 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const
     struct stat fileStat;
     DIR *workingdir;
 
-    LOG_TRC("Pre-reading directory: " << basePath << path << "\n");
+    LOG_TRC("Pre-reading directory: " << basePath << path);
     workingdir = opendir((basePath + path).c_str());
 
     while ((currentFile = readdir(workingdir)) != nullptr)
@@ -474,7 +474,7 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const
 
         else if (S_ISREG(fileStat.st_mode))
         {
-            LOG_TRC("Reading file: '" << basePath << relPath << " as '" << relPath << "'\n");
+            LOG_TRC("Reading file: '" << basePath << relPath << " as '" << relPath << "'");
 
             std::ifstream file(basePath + relPath, std::ios::binary);
 
@@ -489,7 +489,8 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const
             compressedFile.reserve(fileStat.st_size);
             std::string uncompressedFile;
             uncompressedFile.reserve(fileStat.st_size);
-            do {
+            do
+            {
                 file.read(&buf[0], fileStat.st_size);
                 const long unsigned int size = file.gcount();
                 if (size == 0)
@@ -600,7 +601,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
             {
                 tokenTtl = std::stoul(accessTokenTtl);
             }
-            catch(const std::exception& exc)
+            catch (const std::exception& exc)
             {
                 LOG_ERR("access_token_ttl must be represented as the number of milliseconds since January 1, 1970 UTC, when the token will expire");
             }


More information about the Libreoffice-commits mailing list