[Libreoffice-commits] online.git: wsd/ProxyProtocol.cpp
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 7 16:04:15 UTC 2020
wsd/ProxyProtocol.cpp | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 90b6216427898097b58feeb84c1e6176837539ec
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu May 7 16:05:14 2020 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu May 7 18:03:57 2020 +0200
Proxy: send 200 back when there is no queue.
Keep errors for errors.
Change-Id: I6f93bf90e21e68b66fc3d1532ae3db2f2431fca5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93655
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/wsd/ProxyProtocol.cpp b/wsd/ProxyProtocol.cpp
index f11d7d942..26ea53e39 100644
--- a/wsd/ProxyProtocol.cpp
+++ b/wsd/ProxyProtocol.cpp
@@ -167,7 +167,8 @@ void ProxyProtocolHandler::handleRequest(bool isWaiting, const std::shared_ptr<S
}
}
- if (!flushQueueTo(streamSocket) && isWaiting)
+ bool sentMsg = flushQueueTo(streamSocket);
+ if (!sentMsg && isWaiting)
{
LOG_TRC("proxy: queue a waiting out socket #" << streamSocket->getFD());
// longer running 'write socket' (marked 'read' by the client)
@@ -185,7 +186,21 @@ void ProxyProtocolHandler::handleRequest(bool isWaiting, const std::shared_ptr<S
}
else
{
- LOG_TRC("Return a reply immediately");
+ if (!sentMsg)
+ {
+ // FIXME: we should really wait around a bit.
+ LOG_TRC("Nothing to send - closing immediately");
+ std::ostringstream oss;
+ oss << "HTTP/1.1 200 OK\r\n"
+ "Last-Modified: " << Util::getHttpTimeNow() << "\r\n"
+ "User-Agent: " WOPI_AGENT_STRING "\r\n"
+ "Content-Length: " << 0 << "\r\n"
+ "\r\n";
+ streamSocket->send(oss.str());
+ }
+ else
+ LOG_TRC("Returned a reply immediately");
+
socket->shutdown();
}
}
More information about the Libreoffice-commits
mailing list