wsd/LOOLWSD.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
New commits: commit 230aa62d17e4237e344fcf7d95491dbbd97ec660 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue Jun 4 14:45:26 2019 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue Jun 4 14:55:08 2019 +0200 Answer 404 when the file to download does not exist. This gives a better idea what has happened to those using the Download_As postMessage. Without this, the attempted download just gets stuck. Change-Id: Ic23bbca3761d795251664cf09956468fab13ed80 Reviewed-on: https://gerrit.libreoffice.org/73448 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> (cherry picked from commit 00c02138645c89560130be759500cfa0dad86fa8) Reviewed-on: https://gerrit.libreoffice.org/73450 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 80f657b22..01780a86a 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2540,7 +2540,6 @@ private: + JAILED_DOCUMENT_ROOT + tokens[4] + "/" + fileName); const std::string filePathAnonym = LOOLWSD::anonymizeUrl(filePath.toString()); LOG_INF("HTTP request for: " << filePathAnonym); - bool responded = false; if (filePath.isAbsolute() && File(filePath).exists()) { const Poco::URI postRequestUri(request.getURI()); @@ -2565,7 +2564,6 @@ private: try { HttpHelper::sendFile(socket, filePath.toString(), contentType, response); - responded = true; } catch (const Exception& exc) { @@ -2578,8 +2576,15 @@ private: else { LOG_ERR("Download file [" << filePathAnonym << "] not found."); + std::ostringstream oss; + oss << "HTTP/1.1 404 Not Found\r\n" + << "Date: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n" + << "User-Agent: " << HTTP_AGENT_STRING << "\r\n" + << "Content-Length: 0\r\n" + << "\r\n"; + socket->send(oss.str()); + socket->shutdown(); } - (void)responded; return; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits