[Libreoffice-commits] online.git: loolwsd/DocumentBroker.hpp loolwsd/LOOLWSD.cpp loolwsd/Storage.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Wed Mar 23 00:05:53 UTC 2016
loolwsd/DocumentBroker.hpp | 4 ++--
loolwsd/LOOLWSD.cpp | 1 +
loolwsd/Storage.hpp | 21 ++++++++++++---------
3 files changed, 15 insertions(+), 11 deletions(-)
New commits:
commit 8081db3fd9d47c37e6cca6e89efbb4c50d772384
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Mar 22 18:46:04 2016 -0400
loolwsd: fixed file info for local files
Change-Id: I8e2588d55d5ecccb9d0becafad4757b7fcb99eaf
Reviewed-on: https://gerrit.libreoffice.org/23453
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 471df0c..89087a0 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -79,9 +79,9 @@ public:
void validate(const Poco::URI& uri)
{
- Log::info("validating: " + uri.toString());
+ Log::info("Validating: " + uri.toString());
auto storage = createStorage("", "", uri);
- storage->getFileInfo(uri.toString());
+ storage->getFileInfo(uri);
}
/// Loads a document from the public URI into the jail.
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 8c518fc..ae896a3 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -579,6 +579,7 @@ private:
// Validate the URI and Storage before moving on.
docBroker->validate(uriPublic);
+ Log::debug("Validated [" + uriPublic.toString() + "].");
auto ws = std::make_shared<WebSocket>(request, response);
auto session = std::make_shared<MasterProcessSession>(id, LOOLSession::Kind::ToClient, ws, docBroker);
diff --git a/loolwsd/Storage.hpp b/loolwsd/Storage.hpp
index 574c844..fbc1708 100644
--- a/loolwsd/Storage.hpp
+++ b/loolwsd/Storage.hpp
@@ -66,7 +66,7 @@ public:
const std::string& getUri() const { return _uri; }
/// Returns information about the file.
- virtual FileInfo getFileInfo(const std::string& uri) = 0;
+ virtual FileInfo getFileInfo(const Poco::URI& uri) = 0;
/// Returns a local file path for the given URI.
/// If necessary copies the file locally first.
@@ -104,10 +104,12 @@ public:
{
}
- FileInfo getFileInfo(const std::string& uri)
+ FileInfo getFileInfo(const Poco::URI& uri)
{
- const auto filename = Poco::Path(uri).getFileName();
- const auto size = Poco::File(uri).getSize();
+ const auto path = uri.getPath();
+ Log::debug("Getting info for local uri [" + uri.toString() + "], path [" + path + "].");
+ const auto filename = Poco::Path(path).getFileName();
+ const auto size = Poco::File(path).getSize();
return FileInfo({filename, size});
}
@@ -185,9 +187,9 @@ public:
{
}
- FileInfo getFileInfo(const std::string& uri)
+ FileInfo getFileInfo(const Poco::URI& uri)
{
- Log::info("FileInfo for URI [" + uri + "].");
+ Log::debug("Getting info for wopi uri [" + uri.toString() + "].");
Poco::URI uriObject(uri);
Poco::Net::HTTPClientSession session(uriObject.getHost(), uriObject.getPort());
@@ -199,7 +201,7 @@ public:
std::istream& rs = session.receiveResponse(response);
auto logger = Log::trace();
- logger << "WOPI::CheckFileInfo header for URI [" << uri << "]:\n";
+ logger << "WOPI::CheckFileInfo header for URI [" << uri.toString() << "]:\n";
for (auto& pair : response)
{
logger << '\t' + pair.first + ": " + pair.second << " / ";
@@ -232,7 +234,7 @@ public:
{
Log::info("Downloading URI [" + _uri + "].");
- _fileInfo = getFileInfo(_uri);
+ _fileInfo = getFileInfo(Poco::URI(_uri));
if (_fileInfo.Size == 0 && _fileInfo.Filename.empty())
{
//TODO: Should throw a more appropriate exception.
@@ -320,8 +322,9 @@ public:
{
}
- FileInfo getFileInfo(const std::string& uri)
+ FileInfo getFileInfo(const Poco::URI& uri)
{
+ Log::debug("Getting info for webdav uri [" + uri.toString() + "].");
(void)uri;
assert(!"Not Implemented!");
return FileInfo({"bazinga", 0});
More information about the Libreoffice-commits
mailing list