Remember to shutdown the socket after serving files.

re-factor to make it hard not to.

Change-Id: I26ebc48b4660276ede64a22167ac4779cebf5cd4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95440
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
Michael Meeks
2020-06-03 16:06:10 +01:00
parent a3fc39e325
commit 714640993b
6 changed files with 32 additions and 31 deletions

View File

@ -1278,10 +1278,10 @@ enum class WSOpCode : unsigned char {
namespace HttpHelper
{
/// Sends file as HTTP response.
void sendFile(const std::shared_ptr<StreamSocket>& socket, const std::string& path, const std::string& mediaType,
Poco::Net::HTTPResponse& response, bool noCache = false, bool deflate = false,
const bool headerOnly = false);
/// Sends file as HTTP response and shutdown the socket.
void sendFileAndShutdown(const std::shared_ptr<StreamSocket>& socket, const std::string& path, const std::string& mediaType,
Poco::Net::HTTPResponse *optResponse = nullptr, bool noCache = false, bool deflate = false,
const bool headerOnly = false);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */