[Libreoffice-commits] online.git: test/integration-http-server.cpp wsd/ClientSession.cpp

Jan Holesovsky kendy at collabora.com
Thu Oct 26 16:16:44 UTC 2017


 test/integration-http-server.cpp |    6 +++++-
 wsd/ClientSession.cpp            |   15 ++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit bf1aa3326fe652e14b727e9e16d7eab05cfa0576
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Oct 26 12:12:13 2017 +0200

    Fix convert-to after the Save As work.
    
    Change-Id: I1871dd8331367798ee42b2ca35505847b43b639d
    Reviewed-on: https://gerrit.libreoffice.org/43881
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/test/integration-http-server.cpp b/test/integration-http-server.cpp
index 71786205..f93874ff 100644
--- a/test/integration-http-server.cpp
+++ b/test/integration-http-server.cpp
@@ -239,7 +239,11 @@ void HTTPServerTest::testConvertTo()
     form.set("format", "txt");
     form.addPart("data", new Poco::Net::FilePartSource(srcPath));
     form.prepareSubmit(request);
-    // If this results in a Poco::Net::ConnectionRefusedException, loolwsd is not running.
+
+    // FIXME From some reason we are getting Poco::Net::ConnectionRefusedException
+    // What happens is that the file is just partially transferred -
+    // ConvertToPartHandler::handlePart() gets just some 3.6k bytes; no idea
+    // why yet
     form.write(session->sendRequest(request));
 
     Poco::Net::HTTPResponse response;
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index d3cf7106..be9f542f 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -656,17 +656,26 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
     }
     else if (tokens.size() == 3 && tokens[0] == "saveas:")
     {
+        bool isConvertTo = static_cast<bool>(_saveAsSocket);
+
         std::string encodedURL;
         if (!getTokenString(tokens[1], "url", encodedURL))
         {
             LOG_ERR("Bad syntax for: " << firstLine);
-            return false;
+            // we must not return early with convert-to so that we clean up
+            // the session
+            if (!isConvertTo)
+            {
+                sendTextFrame("error: cmd=saveas kind=syntax");
+                return false;
+            }
         }
 
         std::string encodedWopiFilename;
-        if (!getTokenString(tokens[2], "filename", encodedWopiFilename))
+        if (!isConvertTo && !getTokenString(tokens[2], "filename", encodedWopiFilename))
         {
             LOG_ERR("Bad syntax for: " << firstLine);
+            sendTextFrame("error: cmd=saveas kind=syntax");
             return false;
         }
 
@@ -698,7 +707,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
 
         LOG_TRC("Save-as URL: " << resultURL.toString());
 
-        if (!_saveAsSocket)
+        if (!isConvertTo)
         {
             // Normal SaveAs - save to Storage and log result.
             if (resultURL.getScheme() == "file" && !resultURL.getPath().empty())


More information about the Libreoffice-commits mailing list