2016-03-31 01:48:34 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.
Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.
This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.
Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).
Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 09:23:07 -05:00
|
|
|
#include "Storage.hpp"
|
2016-04-08 06:49:33 -05:00
|
|
|
#include "config.h"
|
|
|
|
|
2016-11-11 08:32:29 -06:00
|
|
|
#include <algorithm>
|
2016-03-31 01:48:34 -05:00
|
|
|
#include <cassert>
|
|
|
|
#include <fstream>
|
loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.
Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.
This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.
Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).
Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 09:23:07 -05:00
|
|
|
#include <string>
|
2016-03-31 01:48:34 -05:00
|
|
|
|
loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.
Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.
This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.
Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).
Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 09:23:07 -05:00
|
|
|
#include <Poco/JSON/Object.h>
|
|
|
|
#include <Poco/JSON/Parser.h>
|
|
|
|
#include <Poco/Net/DNS.h>
|
2016-11-11 08:32:29 -06:00
|
|
|
#include <Poco/Exception.h>
|
2016-04-08 04:24:52 -05:00
|
|
|
#include <Poco/Net/HTTPClientSession.h>
|
loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.
Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.
This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.
Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).
Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 09:23:07 -05:00
|
|
|
#include <Poco/Net/HTTPRequest.h>
|
|
|
|
#include <Poco/Net/HTTPResponse.h>
|
2016-03-31 01:48:34 -05:00
|
|
|
#include <Poco/Net/HTTPSClientSession.h>
|
2016-04-19 03:17:50 -05:00
|
|
|
#include <Poco/Net/NetworkInterface.h>
|
2016-03-31 01:48:34 -05:00
|
|
|
#include <Poco/Net/SSLManager.h>
|
|
|
|
#include <Poco/StreamCopier.h>
|
|
|
|
|
|
|
|
#include "Auth.hpp"
|
2016-04-16 11:55:56 -05:00
|
|
|
#include "Common.hpp"
|
|
|
|
#include "Exceptions.hpp"
|
2016-11-12 15:38:13 -06:00
|
|
|
#include "common/FileUtil.hpp"
|
2016-07-18 06:45:36 -05:00
|
|
|
#include "LOOLWSD.hpp"
|
loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.
Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.
This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.
Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).
Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 09:23:07 -05:00
|
|
|
#include "Log.hpp"
|
2016-04-07 15:59:27 -05:00
|
|
|
#include "Unit.hpp"
|
loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.
Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.
This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.
Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).
Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 09:23:07 -05:00
|
|
|
#include "Util.hpp"
|
2016-03-31 01:48:34 -05:00
|
|
|
|
2016-06-07 02:18:49 -05:00
|
|
|
bool StorageBase::FilesystemEnabled;
|
|
|
|
bool StorageBase::WopiEnabled;
|
|
|
|
Util::RegexListMatcher StorageBase::WopiHosts;
|
2016-04-16 07:13:59 -05:00
|
|
|
|
2016-03-31 01:48:34 -05:00
|
|
|
std::string StorageBase::getLocalRootPath() const
|
|
|
|
{
|
|
|
|
auto localPath = _jailPath;
|
|
|
|
if (localPath[0] == '/')
|
|
|
|
{
|
|
|
|
// Remove the leading /
|
|
|
|
localPath.erase(0, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// /chroot/jailId/user/doc/childId
|
|
|
|
const auto rootPath = Poco::Path(_localStorePath, localPath);
|
|
|
|
Poco::File(rootPath).createDirectories();
|
|
|
|
|
|
|
|
return rootPath.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t StorageBase::getFileSize(const std::string& filename)
|
|
|
|
{
|
|
|
|
return std::ifstream(filename, std::ifstream::ate | std::ifstream::binary).tellg();
|
|
|
|
}
|
|
|
|
|
2016-04-16 07:13:59 -05:00
|
|
|
void StorageBase::initialize()
|
|
|
|
{
|
|
|
|
const auto& app = Poco::Util::Application::instance();
|
2016-06-07 02:18:49 -05:00
|
|
|
FilesystemEnabled = app.config().getBool("storage.filesystem[@allow]", false);
|
2016-04-16 07:13:59 -05:00
|
|
|
|
|
|
|
// Parse the WOPI settings.
|
2016-06-07 02:18:49 -05:00
|
|
|
WopiHosts.clear();
|
|
|
|
WopiEnabled = app.config().getBool("storage.wopi[@allow]", false);
|
|
|
|
if (WopiEnabled)
|
2016-04-16 07:13:59 -05:00
|
|
|
{
|
|
|
|
for (size_t i = 0; ; ++i)
|
|
|
|
{
|
|
|
|
const std::string path = "storage.wopi.host[" + std::to_string(i) + "]";
|
2016-04-16 17:12:10 -05:00
|
|
|
const auto host = app.config().getString(path, "");
|
|
|
|
if (!host.empty())
|
2016-04-16 07:13:59 -05:00
|
|
|
{
|
2016-04-16 17:12:10 -05:00
|
|
|
if (app.config().getBool(path + "[@allow]", false))
|
2016-04-16 07:13:59 -05:00
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Adding trusted WOPI host: [" << host << "].");
|
2016-06-07 02:18:49 -05:00
|
|
|
WopiHosts.allow(host);
|
2016-04-16 17:12:10 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Adding blocked WOPI host: [" << host << "].");
|
2016-06-07 02:18:49 -05:00
|
|
|
WopiHosts.deny(host);
|
2016-04-16 07:13:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!app.config().has(path))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-19 03:17:50 -05:00
|
|
|
bool isLocalhost(const std::string& targetHost)
|
|
|
|
{
|
2016-04-19 08:32:22 -05:00
|
|
|
std::string targetAddress;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
targetAddress = Poco::Net::DNS::resolveOne(targetHost).toString();
|
|
|
|
}
|
|
|
|
catch (const Poco::Exception& exc)
|
|
|
|
{
|
|
|
|
Log::warn("Poco::Net::DNS::resolveOne(\"" + targetHost + "\") failed: " + exc.displayText());
|
|
|
|
try
|
|
|
|
{
|
|
|
|
targetAddress = Poco::Net::IPAddress(targetHost).toString();
|
|
|
|
}
|
|
|
|
catch (const Poco::Exception& exc1)
|
|
|
|
{
|
|
|
|
Log::warn("Poco::Net::IPAddress(\"" + targetHost + "\") failed: " + exc1.displayText());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-19 03:17:50 -05:00
|
|
|
Poco::Net::NetworkInterface::NetworkInterfaceList list = Poco::Net::NetworkInterface::list(true,true);
|
2016-04-28 01:43:19 -05:00
|
|
|
for (auto& netif : list)
|
2016-04-19 03:17:50 -05:00
|
|
|
{
|
|
|
|
std::string address = netif.address().toString();
|
2016-04-26 02:34:32 -05:00
|
|
|
address = address.substr(0, address.find('%', 0));
|
2016-04-19 03:17:50 -05:00
|
|
|
if (address == targetAddress)
|
2016-04-19 08:32:22 -05:00
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("WOPI host is on the same host as the WOPI client: \"" <<
|
|
|
|
targetAddress << "\". Connection is allowed.");
|
2016-04-19 03:17:50 -05:00
|
|
|
return true;
|
2016-04-19 08:32:22 -05:00
|
|
|
}
|
2016-04-19 03:17:50 -05:00
|
|
|
}
|
2016-11-03 19:26:40 -05:00
|
|
|
|
|
|
|
LOG_INF("WOPI host is not on the same host as the WOPI client: \"" <<
|
|
|
|
targetAddress << "\". Connection is not allowed.");
|
2016-04-19 03:17:50 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-10-14 05:09:43 -05:00
|
|
|
std::unique_ptr<StorageBase> StorageBase::create(const Poco::URI& uri, const std::string& jailRoot, const std::string& jailPath)
|
2016-04-07 15:59:27 -05:00
|
|
|
{
|
Attempt to handle unauthorized WOPI usage better
Use the previously unused UnauthorizedRequestException for this, and
throw a such in StorageBase::create() when the WOPI host doesn't match
any of those configured.
In a developer debug build, without access to any real WOPI
functionality, you can test by setting the FAKE_UNAUTHORIZED
environment variable and attempting to edit a plain local file:
URI. That will cause such an exception to be thrown in that function.
Catch that UnauthorizedRequestException in
ClientRequestHandler::handleGetRequest(), and send an 'error:
cmd=internal kind=unauthorized' message to the client. Handle that in
loleaflet in the same place where the 'error: cmd=internal
kild=diskfull' message is handled, and in the same fashion, giving up
on the document.
Actually, using exceptions for relatively non-exceptional situations
like this is lame and makes understanding the code harder, but that is
just my personal preference...
FIXME: By the time StorageBase::create() gets called we have already
sent three 'statusindicator:' messages ('find', 'connect', and
'ready') to the client. We should ideally do the checks we do in
StorageBase::create() much earlier.
Also consider that ClientRequestHandler::handleClientRequest() has
code that catches UnauthorizedRequestException and
BadRequestException, and tries to set the HTTP response in those
cases. I am not sure if that functionality has ever been exercised,
though. Currently, we upgrade the HTTP connection to WebSocket early,
and only after that we check whether the WOPI host is authorized
etc. By that time it is too late to return an HTTP response to the
user. If that even is what we ideally should do? If not, then we
probably should drop the code that constructs HTTP responses and
attempts to send them.
Also, if I, as a test, force an HTTPResponse::HTTP_BAD_REQUEST to be
sent before the HTTP connection is upgraded to WebSocket, loleaflet
throws up the generic "Well, this is embarrassing" dialog anyway. At
least in Firefox on Linux. (Instead of the browser showing some own
dialog, which I was half-expecting to happen.)
2016-10-17 08:55:20 -05:00
|
|
|
// FIXME: By the time this gets called we have already sent to the client three
|
|
|
|
// 'statusindicator:' messages: 'find', 'connect' and 'ready'. We should ideally do the checks
|
|
|
|
// here much earlier. Also, using exceptions is lame and makes understanding the code harder,
|
|
|
|
// but that is just my personal preference.
|
|
|
|
|
2016-04-07 15:59:27 -05:00
|
|
|
std::unique_ptr<StorageBase> storage;
|
|
|
|
|
2016-10-14 05:09:43 -05:00
|
|
|
if (UnitWSD::get().createStorage(uri, jailRoot, jailPath, storage))
|
2016-04-16 07:13:59 -05:00
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Storage load hooked.");
|
2016-08-31 10:05:10 -05:00
|
|
|
if (storage)
|
2016-11-03 19:26:40 -05:00
|
|
|
{
|
2016-08-31 10:05:10 -05:00
|
|
|
return storage;
|
2016-11-03 19:26:40 -05:00
|
|
|
}
|
2016-04-16 07:13:59 -05:00
|
|
|
}
|
2016-04-07 15:59:27 -05:00
|
|
|
else if (uri.isRelative() || uri.getScheme() == "file")
|
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Public URI [" << uri.toString() << "] is a file.");
|
|
|
|
|
Attempt to handle unauthorized WOPI usage better
Use the previously unused UnauthorizedRequestException for this, and
throw a such in StorageBase::create() when the WOPI host doesn't match
any of those configured.
In a developer debug build, without access to any real WOPI
functionality, you can test by setting the FAKE_UNAUTHORIZED
environment variable and attempting to edit a plain local file:
URI. That will cause such an exception to be thrown in that function.
Catch that UnauthorizedRequestException in
ClientRequestHandler::handleGetRequest(), and send an 'error:
cmd=internal kind=unauthorized' message to the client. Handle that in
loleaflet in the same place where the 'error: cmd=internal
kild=diskfull' message is handled, and in the same fashion, giving up
on the document.
Actually, using exceptions for relatively non-exceptional situations
like this is lame and makes understanding the code harder, but that is
just my personal preference...
FIXME: By the time StorageBase::create() gets called we have already
sent three 'statusindicator:' messages ('find', 'connect', and
'ready') to the client. We should ideally do the checks we do in
StorageBase::create() much earlier.
Also consider that ClientRequestHandler::handleClientRequest() has
code that catches UnauthorizedRequestException and
BadRequestException, and tries to set the HTTP response in those
cases. I am not sure if that functionality has ever been exercised,
though. Currently, we upgrade the HTTP connection to WebSocket early,
and only after that we check whether the WOPI host is authorized
etc. By that time it is too late to return an HTTP response to the
user. If that even is what we ideally should do? If not, then we
probably should drop the code that constructs HTTP responses and
attempts to send them.
Also, if I, as a test, force an HTTPResponse::HTTP_BAD_REQUEST to be
sent before the HTTP connection is upgraded to WebSocket, loleaflet
throws up the generic "Well, this is embarrassing" dialog anyway. At
least in Firefox on Linux. (Instead of the browser showing some own
dialog, which I was half-expecting to happen.)
2016-10-17 08:55:20 -05:00
|
|
|
#if ENABLE_DEBUG
|
|
|
|
if (std::getenv("FAKE_UNAUTHORIZED"))
|
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_FTL("Faking an UnauthorizedRequestException");
|
Attempt to handle unauthorized WOPI usage better
Use the previously unused UnauthorizedRequestException for this, and
throw a such in StorageBase::create() when the WOPI host doesn't match
any of those configured.
In a developer debug build, without access to any real WOPI
functionality, you can test by setting the FAKE_UNAUTHORIZED
environment variable and attempting to edit a plain local file:
URI. That will cause such an exception to be thrown in that function.
Catch that UnauthorizedRequestException in
ClientRequestHandler::handleGetRequest(), and send an 'error:
cmd=internal kind=unauthorized' message to the client. Handle that in
loleaflet in the same place where the 'error: cmd=internal
kild=diskfull' message is handled, and in the same fashion, giving up
on the document.
Actually, using exceptions for relatively non-exceptional situations
like this is lame and makes understanding the code harder, but that is
just my personal preference...
FIXME: By the time StorageBase::create() gets called we have already
sent three 'statusindicator:' messages ('find', 'connect', and
'ready') to the client. We should ideally do the checks we do in
StorageBase::create() much earlier.
Also consider that ClientRequestHandler::handleClientRequest() has
code that catches UnauthorizedRequestException and
BadRequestException, and tries to set the HTTP response in those
cases. I am not sure if that functionality has ever been exercised,
though. Currently, we upgrade the HTTP connection to WebSocket early,
and only after that we check whether the WOPI host is authorized
etc. By that time it is too late to return an HTTP response to the
user. If that even is what we ideally should do? If not, then we
probably should drop the code that constructs HTTP responses and
attempts to send them.
Also, if I, as a test, force an HTTPResponse::HTTP_BAD_REQUEST to be
sent before the HTTP connection is upgraded to WebSocket, loleaflet
throws up the generic "Well, this is embarrassing" dialog anyway. At
least in Firefox on Linux. (Instead of the browser showing some own
dialog, which I was half-expecting to happen.)
2016-10-17 08:55:20 -05:00
|
|
|
throw UnauthorizedRequestException("No acceptable WOPI hosts found matching the target host in config.");
|
|
|
|
}
|
|
|
|
#endif
|
2016-06-07 02:18:49 -05:00
|
|
|
if (FilesystemEnabled)
|
2016-04-07 15:59:27 -05:00
|
|
|
{
|
2016-10-14 05:09:43 -05:00
|
|
|
return std::unique_ptr<StorageBase>(new LocalStorage(uri, jailRoot, jailPath));
|
2016-04-07 15:59:27 -05:00
|
|
|
}
|
|
|
|
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_ERR("Local Storage is disabled by default. Enable in the config file or on the command-line to enable.");
|
2016-04-07 15:59:27 -05:00
|
|
|
}
|
2016-06-07 02:18:49 -05:00
|
|
|
else if (WopiEnabled)
|
2016-04-07 15:59:27 -05:00
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Public URI [" << uri.toString() << "] considered WOPI.");
|
2016-04-26 02:34:32 -05:00
|
|
|
const auto& targetHost = uri.getHost();
|
2016-06-07 02:18:49 -05:00
|
|
|
if (WopiHosts.match(targetHost) || isLocalhost(targetHost))
|
2016-04-16 11:55:56 -05:00
|
|
|
{
|
2016-10-14 05:09:43 -05:00
|
|
|
return std::unique_ptr<StorageBase>(new WopiStorage(uri, jailRoot, jailPath));
|
2016-04-16 11:55:56 -05:00
|
|
|
}
|
|
|
|
|
Attempt to handle unauthorized WOPI usage better
Use the previously unused UnauthorizedRequestException for this, and
throw a such in StorageBase::create() when the WOPI host doesn't match
any of those configured.
In a developer debug build, without access to any real WOPI
functionality, you can test by setting the FAKE_UNAUTHORIZED
environment variable and attempting to edit a plain local file:
URI. That will cause such an exception to be thrown in that function.
Catch that UnauthorizedRequestException in
ClientRequestHandler::handleGetRequest(), and send an 'error:
cmd=internal kind=unauthorized' message to the client. Handle that in
loleaflet in the same place where the 'error: cmd=internal
kild=diskfull' message is handled, and in the same fashion, giving up
on the document.
Actually, using exceptions for relatively non-exceptional situations
like this is lame and makes understanding the code harder, but that is
just my personal preference...
FIXME: By the time StorageBase::create() gets called we have already
sent three 'statusindicator:' messages ('find', 'connect', and
'ready') to the client. We should ideally do the checks we do in
StorageBase::create() much earlier.
Also consider that ClientRequestHandler::handleClientRequest() has
code that catches UnauthorizedRequestException and
BadRequestException, and tries to set the HTTP response in those
cases. I am not sure if that functionality has ever been exercised,
though. Currently, we upgrade the HTTP connection to WebSocket early,
and only after that we check whether the WOPI host is authorized
etc. By that time it is too late to return an HTTP response to the
user. If that even is what we ideally should do? If not, then we
probably should drop the code that constructs HTTP responses and
attempts to send them.
Also, if I, as a test, force an HTTPResponse::HTTP_BAD_REQUEST to be
sent before the HTTP connection is upgraded to WebSocket, loleaflet
throws up the generic "Well, this is embarrassing" dialog anyway. At
least in Firefox on Linux. (Instead of the browser showing some own
dialog, which I was half-expecting to happen.)
2016-10-17 08:55:20 -05:00
|
|
|
throw UnauthorizedRequestException("No acceptable WOPI hosts found matching the target host [" + targetHost + "] in config.");
|
2016-04-16 07:13:59 -05:00
|
|
|
}
|
|
|
|
|
2016-04-16 11:55:56 -05:00
|
|
|
throw BadRequestException("No Storage configured or invalid URI.");
|
2016-04-07 15:59:27 -05:00
|
|
|
}
|
|
|
|
|
2016-10-26 07:47:42 -05:00
|
|
|
std::atomic<unsigned> LocalStorage::LastLocalStorageId;
|
2016-09-30 04:02:09 -05:00
|
|
|
|
2016-10-26 06:15:28 -05:00
|
|
|
LocalStorage::LocalFileInfo LocalStorage::getLocalFileInfo(const Poco::URI& uriPublic)
|
2016-03-31 01:48:34 -05:00
|
|
|
{
|
2016-10-16 11:40:52 -05:00
|
|
|
const auto path = Poco::Path(uriPublic.getPath());
|
|
|
|
Log::debug("Getting info for local uri [" + uriPublic.toString() + "], path [" + path.toString() + "].");
|
2016-10-26 06:15:28 -05:00
|
|
|
|
|
|
|
if (!_fileInfo.isValid())
|
|
|
|
{
|
|
|
|
const auto& filename = path.getFileName();
|
|
|
|
const auto file = Poco::File(path);
|
|
|
|
const auto lastModified = file.getLastModified();
|
|
|
|
const auto size = file.getSize();
|
|
|
|
|
2016-11-08 07:37:28 -06:00
|
|
|
_fileInfo = FileInfo({filename, "localhost", lastModified, size});
|
2016-10-26 06:15:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set automatic userid and username
|
|
|
|
return LocalFileInfo({"localhost", std::string("Local Host #") + std::to_string(LastLocalStorageId++)});
|
2016-03-31 01:48:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string LocalStorage::loadStorageFileToLocal()
|
|
|
|
{
|
|
|
|
const auto rootPath = getLocalRootPath();
|
|
|
|
|
|
|
|
// /chroot/jailId/user/doc/childId/file.ext
|
2016-10-14 04:28:19 -05:00
|
|
|
const auto filename = Poco::Path(_uri.getPath()).getFileName();
|
2016-03-31 01:48:34 -05:00
|
|
|
_jailedFilePath = Poco::Path(rootPath, filename).toString();
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Public URI [" << _uri.getPath() <<
|
|
|
|
"] jailed to [" + _jailedFilePath + "].");
|
2016-03-31 01:48:34 -05:00
|
|
|
|
2016-09-30 08:09:53 -05:00
|
|
|
// Despite the talk about URIs it seems that _uri is actually just a pathname here
|
2016-10-14 04:28:19 -05:00
|
|
|
const auto publicFilePath = _uri.getPath();
|
2016-09-30 08:09:53 -05:00
|
|
|
|
2016-11-12 15:38:13 -06:00
|
|
|
if (!FileUtil::checkDiskSpace(publicFilePath))
|
2016-11-03 19:26:40 -05:00
|
|
|
{
|
2016-09-30 08:09:53 -05:00
|
|
|
throw StorageSpaceLowException("Low disk space for " + publicFilePath);
|
2016-11-03 19:26:40 -05:00
|
|
|
}
|
2016-09-30 08:09:53 -05:00
|
|
|
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Linking " << publicFilePath << " to " << _jailedFilePath);
|
2016-03-31 01:48:34 -05:00
|
|
|
if (!Poco::File(_jailedFilePath).exists() && link(publicFilePath.c_str(), _jailedFilePath.c_str()) == -1)
|
|
|
|
{
|
|
|
|
// Failed
|
|
|
|
Log::warn("link(\"" + publicFilePath + "\", \"" + _jailedFilePath + "\") failed. Will copy.");
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Fallback to copying.
|
|
|
|
if (!Poco::File(_jailedFilePath).exists())
|
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Copying " << publicFilePath << " to " << _jailedFilePath);
|
2016-03-31 01:48:34 -05:00
|
|
|
Poco::File(publicFilePath).copyTo(_jailedFilePath);
|
|
|
|
_isCopy = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (const Poco::Exception& exc)
|
|
|
|
{
|
|
|
|
Log::error("copyTo(\"" + publicFilePath + "\", \"" + _jailedFilePath + "\") failed: " + exc.displayText());
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
|
2016-10-14 05:09:43 -05:00
|
|
|
_isLoaded = true;
|
2016-03-31 01:48:34 -05:00
|
|
|
// Now return the jailed path.
|
|
|
|
return Poco::Path(_jailPath, filename).toString();
|
|
|
|
}
|
|
|
|
|
2016-10-16 11:40:52 -05:00
|
|
|
bool LocalStorage::saveLocalFileToStorage(const Poco::URI& uriPublic)
|
2016-03-31 01:48:34 -05:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Copy the file back.
|
|
|
|
if (_isCopy && Poco::File(_jailedFilePath).exists())
|
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Copying " << _jailedFilePath << " to " << uriPublic.getPath());
|
2016-10-16 11:40:52 -05:00
|
|
|
Poco::File(_jailedFilePath).copyTo(uriPublic.getPath());
|
2016-03-31 01:48:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (const Poco::Exception& exc)
|
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_ERR("copyTo(\"" << _jailedFilePath << "\", \"" << uriPublic.getPath() <<
|
|
|
|
"\") failed: " << exc.displayText());
|
2016-03-31 01:48:34 -05:00
|
|
|
throw;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-07-18 06:45:36 -05:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
static inline
|
2016-10-04 07:10:45 -05:00
|
|
|
Poco::Net::HTTPClientSession* getHTTPClientSession(const Poco::URI& uri)
|
2016-07-18 06:45:36 -05:00
|
|
|
{
|
2016-08-28 14:41:28 -05:00
|
|
|
return (LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? new Poco::Net::HTTPSClientSession(uri.getHost(), uri.getPort(), Poco::Net::SSLManager::instance().defaultClientContext())
|
2016-07-18 06:45:36 -05:00
|
|
|
: new Poco::Net::HTTPClientSession(uri.getHost(), uri.getPort());
|
|
|
|
}
|
|
|
|
|
2016-11-11 08:32:29 -06:00
|
|
|
int getLevenshteinDist(const std::string& string1, const std::string& string2) {
|
|
|
|
int matrix[string1.size() + 1][string2.size() + 1];
|
|
|
|
|
|
|
|
for (size_t i = 0; i < string1.size() + 1; i++)
|
|
|
|
{
|
|
|
|
for (size_t j = 0; j < string2.size() + 1; j++)
|
|
|
|
{
|
|
|
|
if (i == 0)
|
|
|
|
{
|
|
|
|
matrix[i][j] = j;
|
|
|
|
}
|
|
|
|
else if (j == 0)
|
|
|
|
{
|
|
|
|
matrix[i][j] = i;
|
|
|
|
}
|
|
|
|
else if (string1[i - 1] == string2[j - 1])
|
|
|
|
{
|
|
|
|
matrix[i][j] = matrix[i - 1][j - 1];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
matrix[i][j] = 1 + std::min(std::min(matrix[i][j - 1], matrix[i - 1][j]),
|
|
|
|
matrix[i - 1][j - 1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return matrix[string1.size()][string2.size()];
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void getWOPIValue(const Poco::JSON::Object::Ptr &object, const std::string& key, T& value)
|
2016-10-21 03:57:17 -05:00
|
|
|
{
|
2016-11-11 08:32:29 -06:00
|
|
|
std::vector<std::string> propertyNames;
|
|
|
|
object->getNames(propertyNames);
|
|
|
|
|
|
|
|
// Check each property name against given key
|
|
|
|
// and accept with a mis-spell tolerance of 2
|
|
|
|
// TODO: propertyNames can be pruned after getting its value
|
|
|
|
for (const auto& userInput: propertyNames)
|
|
|
|
{
|
|
|
|
std::string string1(key), string2(userInput);
|
|
|
|
std::transform(key.begin(), key.end(), string1.begin(), tolower);
|
|
|
|
std::transform(userInput.begin(), userInput.end(), string2.begin(), tolower);
|
|
|
|
int levDist = getLevenshteinDist(string1, string2);
|
|
|
|
|
|
|
|
if (levDist > 2) /* Mis-spelling tolerance */
|
|
|
|
continue;
|
|
|
|
else if (levDist > 0 || key != userInput)
|
|
|
|
{
|
2016-11-11 11:02:16 -06:00
|
|
|
LOG_WRN("Incorrect JSON property [" << userInput << "]. Did you mean " << key << " ?");
|
|
|
|
return;
|
2016-11-11 08:32:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
const Poco::Dynamic::Var valueVar = object->get(userInput);
|
|
|
|
value = valueVar.convert<T>();
|
|
|
|
}
|
|
|
|
catch (const Poco::Exception& exc)
|
|
|
|
{
|
|
|
|
LOG_ERR("getWOPIValue: " << exc.displayText() <<
|
|
|
|
(exc.nested() ? " (" + exc.nested()->displayText() + ")" : ""));
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG_WRN("Missing JSON property [" << key << "]");
|
2016-10-21 03:57:17 -05:00
|
|
|
}
|
|
|
|
|
2016-07-18 06:45:36 -05:00
|
|
|
} // anonymous namespace
|
|
|
|
|
2016-10-26 06:15:28 -05:00
|
|
|
WopiStorage::WOPIFileInfo WopiStorage::getWOPIFileInfo(const Poco::URI& uriPublic)
|
2016-03-31 01:48:34 -05:00
|
|
|
{
|
2016-10-16 11:40:52 -05:00
|
|
|
Log::debug("Getting info for wopi uri [" + uriPublic.toString() + "].");
|
2016-10-14 05:09:43 -05:00
|
|
|
|
2016-10-14 07:46:49 -05:00
|
|
|
const auto startTime = std::chrono::steady_clock::now();
|
2016-10-16 11:40:52 -05:00
|
|
|
std::unique_ptr<Poco::Net::HTTPClientSession> psession(getHTTPClientSession(uriPublic));
|
2016-07-18 06:45:36 -05:00
|
|
|
|
2016-10-16 11:40:52 -05:00
|
|
|
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, uriPublic.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
|
2016-03-31 01:48:34 -05:00
|
|
|
request.set("User-Agent", "LOOLWSD WOPI Agent");
|
2016-07-18 06:45:36 -05:00
|
|
|
psession->sendRequest(request);
|
2016-03-31 01:48:34 -05:00
|
|
|
|
|
|
|
Poco::Net::HTTPResponse response;
|
|
|
|
|
2016-10-14 07:46:49 -05:00
|
|
|
std::istream& rs = psession->receiveResponse(response);
|
2016-03-31 01:48:34 -05:00
|
|
|
auto logger = Log::trace();
|
2016-10-16 11:40:52 -05:00
|
|
|
logger << "WOPI::CheckFileInfo header for URI [" << uriPublic.toString() << "]:\n";
|
2016-03-31 01:48:34 -05:00
|
|
|
for (auto& pair : response)
|
|
|
|
{
|
|
|
|
logger << '\t' + pair.first + ": " + pair.second << " / ";
|
|
|
|
}
|
|
|
|
|
|
|
|
logger << Log::end;
|
|
|
|
|
|
|
|
// Parse the response.
|
|
|
|
std::string filename;
|
|
|
|
size_t size = 0;
|
2016-11-08 02:14:14 -06:00
|
|
|
std::string ownerId;
|
2016-08-29 08:41:37 -05:00
|
|
|
std::string userId;
|
|
|
|
std::string userName;
|
2016-10-19 09:52:53 -05:00
|
|
|
bool canWrite = false;
|
2016-11-08 07:37:28 -06:00
|
|
|
bool enableOwnerTermination = false;
|
2016-10-25 02:13:00 -05:00
|
|
|
std::string postMessageOrigin;
|
2016-11-10 06:21:39 -06:00
|
|
|
bool hidePrintOption = false;
|
|
|
|
bool hideSaveOption = false;
|
|
|
|
bool hideExportOption = false;
|
2016-03-31 01:48:34 -05:00
|
|
|
std::string resMsg;
|
|
|
|
Poco::StreamCopier::copyToString(rs, resMsg);
|
2016-10-14 07:46:49 -05:00
|
|
|
|
|
|
|
const auto endTime = std::chrono::steady_clock::now();
|
2016-10-23 07:05:46 -05:00
|
|
|
const std::chrono::duration<double> callDuration = (endTime - startTime);
|
|
|
|
Log::debug("WOPI::CheckFileInfo returned: " + resMsg + ". Call duration: " + std::to_string(callDuration.count()) + "s");
|
2016-04-15 01:49:35 -05:00
|
|
|
const auto index = resMsg.find_first_of('{');
|
2016-03-31 01:48:34 -05:00
|
|
|
if (index != std::string::npos)
|
|
|
|
{
|
|
|
|
const std::string stringJSON = resMsg.substr(index);
|
|
|
|
Poco::JSON::Parser parser;
|
|
|
|
const auto result = parser.parse(stringJSON);
|
2016-04-15 01:49:35 -05:00
|
|
|
const auto& object = result.extract<Poco::JSON::Object::Ptr>();
|
2016-11-11 08:32:29 -06:00
|
|
|
getWOPIValue(object, "BaseFileName", filename);
|
|
|
|
getWOPIValue(object, "Size", size);
|
|
|
|
getWOPIValue(object, "OwnerId", ownerId);
|
|
|
|
getWOPIValue(object, "UserId", userId);
|
|
|
|
getWOPIValue(object, "UserFriendlyName", userName);
|
|
|
|
getWOPIValue(object, "UserCanWrite", canWrite);
|
|
|
|
getWOPIValue(object, "PostMessageOrigin", postMessageOrigin);
|
|
|
|
getWOPIValue(object, "HidePrintOption", hidePrintOption);
|
|
|
|
getWOPIValue(object, "HideSaveOption", hideSaveOption);
|
|
|
|
getWOPIValue(object, "HideExportOption", hideExportOption);
|
|
|
|
getWOPIValue(object, "EnableOwnerTermination", enableOwnerTermination);
|
2016-03-31 01:48:34 -05:00
|
|
|
}
|
2016-10-21 03:57:17 -05:00
|
|
|
else
|
|
|
|
Log::error("WOPI::CheckFileInfo is missing JSON payload");
|
2016-03-31 01:48:34 -05:00
|
|
|
|
2016-10-26 06:15:28 -05:00
|
|
|
if (!_fileInfo.isValid())
|
|
|
|
{
|
|
|
|
// WOPI doesn't support file last modified time.
|
2016-11-08 02:14:14 -06:00
|
|
|
_fileInfo = FileInfo({filename, ownerId, Poco::Timestamp(), size});
|
2016-10-26 06:15:28 -05:00
|
|
|
}
|
|
|
|
|
2016-11-10 06:21:39 -06:00
|
|
|
return WOPIFileInfo({userId, userName, canWrite, postMessageOrigin, hidePrintOption, hideSaveOption, hideExportOption, enableOwnerTermination, callDuration});
|
2016-03-31 01:48:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/// uri format: http://server/<...>/wopi*/files/<id>/content
|
|
|
|
std::string WopiStorage::loadStorageFileToLocal()
|
|
|
|
{
|
|
|
|
// WOPI URI to download files ends in '/contents'.
|
|
|
|
// Add it here to get the payload instead of file info.
|
|
|
|
Poco::URI uriObject(_uri);
|
2016-10-05 03:14:38 -05:00
|
|
|
uriObject.setPath(uriObject.getPath() + "/contents");
|
|
|
|
Log::debug("Wopi requesting: " + uriObject.toString());
|
2016-03-31 01:48:34 -05:00
|
|
|
|
2016-10-14 07:46:49 -05:00
|
|
|
const auto startTime = std::chrono::steady_clock::now();
|
2016-10-04 07:10:45 -05:00
|
|
|
std::unique_ptr<Poco::Net::HTTPClientSession> psession(getHTTPClientSession(uriObject));
|
2016-07-18 06:45:36 -05:00
|
|
|
|
2016-10-05 03:14:38 -05:00
|
|
|
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, uriObject.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
|
2016-03-31 01:48:34 -05:00
|
|
|
request.set("User-Agent", "LOOLWSD WOPI Agent");
|
2016-07-18 06:45:36 -05:00
|
|
|
psession->sendRequest(request);
|
2016-03-31 01:48:34 -05:00
|
|
|
|
|
|
|
Poco::Net::HTTPResponse response;
|
2016-07-18 06:45:36 -05:00
|
|
|
std::istream& rs = psession->receiveResponse(response);
|
2016-03-31 01:48:34 -05:00
|
|
|
|
|
|
|
auto logger = Log::trace();
|
2016-11-20 05:07:22 -06:00
|
|
|
logger << "WOPI::GetFile header for URI [" << uriObject.toString() << "]:\n";
|
2016-03-31 01:48:34 -05:00
|
|
|
for (auto& pair : response)
|
|
|
|
{
|
|
|
|
logger << '\t' + pair.first + ": " + pair.second << " / ";
|
|
|
|
}
|
|
|
|
|
|
|
|
logger << Log::end;
|
|
|
|
|
2016-04-19 02:10:07 -05:00
|
|
|
_jailedFilePath = Poco::Path(getLocalRootPath(), _fileInfo._filename).toString();
|
2016-03-31 01:48:34 -05:00
|
|
|
std::ofstream ofs(_jailedFilePath);
|
|
|
|
std::copy(std::istreambuf_iterator<char>(rs),
|
|
|
|
std::istreambuf_iterator<char>(),
|
|
|
|
std::ostreambuf_iterator<char>(ofs));
|
2016-10-14 07:46:49 -05:00
|
|
|
const auto endTime = std::chrono::steady_clock::now();
|
|
|
|
const std::chrono::duration<double> diff = (endTime - startTime);
|
|
|
|
_wopiLoadDuration += diff;
|
2016-03-31 01:48:34 -05:00
|
|
|
const auto size = getFileSize(_jailedFilePath);
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("WOPI::GetFile downloaded " << size << " bytes from [" << uriObject.toString() <<
|
|
|
|
"] -> " << _jailedFilePath << " in " << diff.count() << "s : " <<
|
|
|
|
response.getStatus() << " " << response.getReason());
|
2016-03-31 01:48:34 -05:00
|
|
|
|
2016-10-14 05:09:43 -05:00
|
|
|
_isLoaded = true;
|
2016-03-31 01:48:34 -05:00
|
|
|
// Now return the jailed path.
|
2016-04-19 02:10:07 -05:00
|
|
|
return Poco::Path(_jailPath, _fileInfo._filename).toString();
|
2016-03-31 01:48:34 -05:00
|
|
|
}
|
|
|
|
|
2016-10-16 11:40:52 -05:00
|
|
|
bool WopiStorage::saveLocalFileToStorage(const Poco::URI& uriPublic)
|
2016-03-31 01:48:34 -05:00
|
|
|
{
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("Uploading URI [" << uriPublic.toString() << "] from [" << _jailedFilePath + "].");
|
2016-10-19 09:52:53 -05:00
|
|
|
// TODO: Check if this URI has write permission (canWrite = true)
|
2016-03-31 01:48:34 -05:00
|
|
|
const auto size = getFileSize(_jailedFilePath);
|
|
|
|
|
2016-10-16 11:40:52 -05:00
|
|
|
Poco::URI uriObject(uriPublic);
|
2016-10-05 03:14:38 -05:00
|
|
|
uriObject.setPath(uriObject.getPath() + "/contents");
|
|
|
|
Log::debug("Wopi posting: " + uriObject.toString());
|
2016-03-31 01:48:34 -05:00
|
|
|
|
2016-10-04 07:10:45 -05:00
|
|
|
std::unique_ptr<Poco::Net::HTTPClientSession> psession(getHTTPClientSession(uriObject));
|
2016-07-18 06:45:36 -05:00
|
|
|
|
2016-10-05 03:14:38 -05:00
|
|
|
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, uriObject.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
|
2016-10-10 02:12:01 -05:00
|
|
|
request.set("X-WOPI-Override", "PUT");
|
2016-03-31 01:48:34 -05:00
|
|
|
request.setContentType("application/octet-stream");
|
|
|
|
request.setContentLength(size);
|
|
|
|
|
2016-07-18 06:45:36 -05:00
|
|
|
std::ostream& os = psession->sendRequest(request);
|
2016-03-31 01:48:34 -05:00
|
|
|
std::ifstream ifs(_jailedFilePath);
|
|
|
|
Poco::StreamCopier::copyStream(ifs, os);
|
|
|
|
|
|
|
|
Poco::Net::HTTPResponse response;
|
2016-07-18 06:45:36 -05:00
|
|
|
std::istream& rs = psession->receiveResponse(response);
|
2016-03-31 01:48:34 -05:00
|
|
|
std::ostringstream oss;
|
|
|
|
Poco::StreamCopier::copyStream(rs, oss);
|
|
|
|
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("WOPI::PutFile response: " << oss.str());
|
2016-03-31 01:48:34 -05:00
|
|
|
const auto success = (response.getStatus() == Poco::Net::HTTPResponse::HTTP_OK);
|
2016-11-03 19:26:40 -05:00
|
|
|
LOG_INF("WOPI::PutFile uploaded " << size << " bytes from [" << _jailedFilePath <<
|
|
|
|
"] -> [" << uriObject.toString() << "]: " <<
|
|
|
|
response.getStatus() << " " << response.getReason());
|
2016-03-31 01:48:34 -05:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string WebDAVStorage::loadStorageFileToLocal()
|
|
|
|
{
|
|
|
|
// TODO: implement webdav GET.
|
2016-10-14 05:09:43 -05:00
|
|
|
_isLoaded = true;
|
2016-10-14 04:28:19 -05:00
|
|
|
return _uri.toString();
|
2016-03-31 01:48:34 -05:00
|
|
|
}
|
|
|
|
|
2016-10-16 11:40:52 -05:00
|
|
|
bool WebDAVStorage::saveLocalFileToStorage(const Poco::URI& /*uriPublic*/)
|
2016-03-31 01:48:34 -05:00
|
|
|
{
|
|
|
|
// TODO: implement webdav PUT.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|