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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 8 14:07:15 UTC 2020


 wsd/LOOLWSD.cpp |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 848bacaa7f9bd7e55b4c088059cc9d0799fa2bdc
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Jun 8 14:43:04 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Jun 8 16:06:57 2020 +0200

    Proxy: shutdown socket with error if we can't find documentbroker.
    
    Also called if/as/when the document is unloading as you connect.
    
    Change-Id: I494dc207219298e07fba664cd2cbdd5d5b8ac889
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95809
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index f2c01965e..457e109b5 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -3016,6 +3016,21 @@ private:
                         });
                 });
         }
+        else
+        {
+            auto streamSocket = std::static_pointer_cast<StreamSocket>(disposition.getSocket());
+            LOG_ERR("Failed to find document");
+            // badness occurred:
+            std::ostringstream oss;
+            oss << "HTTP/1.1 400\r\n"
+                << "Date: " << Util::getHttpTimeNow() << "\r\n"
+                << "User-Agent: LOOLWSD WOPI Agent\r\n"
+                << "Content-Length: \r\n"
+                << "\r\n";
+            // FIXME: send docunloading & re-try on client ?
+            streamSocket->send(oss.str());
+            streamSocket->shutdown();
+        }
     }
 
     void handleClientWsUpgrade(const Poco::Net::HTTPRequest& request,


More information about the Libreoffice-commits mailing list