[Libreoffice-commits] online.git: 4 commits - loolwsd/FileServer.cpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp loolwsd/loolwsd.spec.in loolwsd/loolwsd.xml.in loolwsd/Makefile.am loolwsd/Storage.cpp
Andras Timar
andras.timar at collabora.com
Sun Aug 28 21:06:58 UTC 2016
loolwsd/FileServer.cpp | 2 +-
loolwsd/LOOLWSD.cpp | 20 +++++++++++++-------
loolwsd/LOOLWSD.hpp | 7 +++++++
loolwsd/Makefile.am | 2 ++
loolwsd/Storage.cpp | 2 +-
loolwsd/loolwsd.spec.in | 1 +
loolwsd/loolwsd.xml.in | 1 +
7 files changed, 26 insertions(+), 9 deletions(-)
New commits:
commit 274d68644d8adf20628e92c3d5e55f9687196adb
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Aug 28 23:06:15 2016 +0200
loolwsd: handle HTTP HEAD request for /
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 9bf6916..9a38e9a 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -875,7 +875,7 @@ public:
bool responded = false;
try
{
- if (request.getMethod() == HTTPRequest::HTTP_GET && request.getURI() == "/")
+ if ((request.getMethod() == HTTPRequest::HTTP_GET || request.getMethod() == HTTPRequest::HTTP_HEAD) && request.getURI() == "/")
{
std::string mimeType = "text/plain";
std::string responseString = "OK";
@@ -883,10 +883,13 @@ public:
response.setContentType(mimeType);
response.setChunkedTransferEncoding(false);
std::ostream& ostr = response.send();
- ostr << responseString;
+ if (request.getMethod() == HTTPRequest::HTTP_GET)
+ {
+ ostr << responseString;
+ }
responded = true;
}
- if (request.getMethod() == HTTPRequest::HTTP_GET && request.getURI() == "/favicon.ico")
+ else if (request.getMethod() == HTTPRequest::HTTP_GET && request.getURI() == "/favicon.ico")
{
std::string mimeType = "image/vnd.microsoft.icon";
std::string faviconPath = Path(Application::instance().commandPath()).parent().toString() + "favicon.ico";
@@ -898,7 +901,7 @@ public:
response.sendFile(faviconPath, mimeType);
responded = true;
}
- if (request.getMethod() == HTTPRequest::HTTP_GET && request.getURI() == "/hosting/discovery")
+ else if (request.getMethod() == HTTPRequest::HTTP_GET && request.getURI() == "/hosting/discovery")
{
// http://server/hosting/discovery
responded = handleGetWOPIDiscovery(request, response);
@@ -1200,7 +1203,6 @@ public:
logger << Log::end;
// Routing
- // FIXME: Some browsers (all?) hit for /favicon.ico. Create a nice favicon and add to routes
Poco::URI requestUri(request.getURI());
std::vector<std::string> reqPathSegs;
requestUri.getPathSegments(reqPathSegs);
commit 1403a7999a1405ba6adf9b9325b62e07c8119692
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Aug 28 21:49:43 2016 +0200
loolwsd: add loolstress to rpm
diff --git a/loolwsd/loolwsd.spec.in b/loolwsd/loolwsd.spec.in
index f444cce..6cb7970 100644
--- a/loolwsd/loolwsd.spec.in
+++ b/loolwsd/loolwsd.spec.in
@@ -101,6 +101,7 @@ tar cf - . | (cd %{buildroot}/usr/share/loolwsd/loleaflet && tar xf -)
/usr/bin/loolmap
/usr/bin/loolforkit
/usr/bin/loolmount
+/usr/bin/loolstress
/usr/bin/looltool
/usr/share/loolwsd/discovery.xml
/usr/share/loolwsd/favicon.ico
commit 05a7101789ed8e4d46e7738de1ef3f398edb642e
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Aug 28 21:48:47 2016 +0200
loolwsd: add missing headers to dist
diff --git a/loolwsd/Makefile.am b/loolwsd/Makefile.am
index ef8c794..4a3ee81 100644
--- a/loolwsd/Makefile.am
+++ b/loolwsd/Makefile.am
@@ -106,6 +106,8 @@ noinst_HEADERS = Admin.hpp \
Rectangle.hpp \
Storage.hpp \
TileCache.hpp \
+ TileDesc.hpp \
+ TraceFile.hpp \
Unit.hpp \
UnitHTTP.hpp \
UserMessages.hpp \
commit b0619d387b88d439376852e06ccc49e41841a981
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Aug 28 21:41:28 2016 +0200
loolwsd: add support of SSL termination
diff --git a/loolwsd/FileServer.cpp b/loolwsd/FileServer.cpp
index a18ee17..9cce160 100644
--- a/loolwsd/FileServer.cpp
+++ b/loolwsd/FileServer.cpp
@@ -209,7 +209,7 @@ void FileServerRequestHandler::preprocessFile(HTTPServerRequest& request, HTTPSe
{
HTMLForm form(request, request.stream());
- const auto host = (LOOLWSD::isSSLEnabled() ? "wss://" : "ws://") + (LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName);
+ const auto host = ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination) ? "wss://" : "ws://") + (LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName);
const auto path = Poco::Path(LOOLWSD::FileServerRoot, getRequestPathname(request));
Log::debug("Preprocessing file: " + path.toString());
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 3793624..9bf6916 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -804,7 +804,7 @@ private:
const std::string urlsrc = "urlsrc";
const auto& config = Application::instance().config();
const std::string loleafletHtml = config.getString("loleaflet_html", "loleaflet.html");
- const std::string uriValue = (LOOLWSD::isSSLEnabled() ? "https://" : "http://") +
+ const std::string uriValue = ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "https://" : "http://") +
(LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName) +
"/loleaflet/" LOOLWSD_VERSION_HASH "/" + loleafletHtml + "?";
@@ -1266,7 +1266,7 @@ std::string lcl_getLaunchURI()
aAbsTopSrcDir = Poco::Path(aAbsTopSrcDir).absolute().toString();
std::string aLaunchURI(" ");
- aLaunchURI += ((LOOLWSD::isSSLEnabled()) ? "https://" : "http://");
+ aLaunchURI += ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "https://" : "http://");
aLaunchURI += LOOLWSD_TEST_HOST ":";
aLaunchURI += std::to_string(ClientPortNumber);
aLaunchURI += LOOLWSD_TEST_LOLEAFLET_UI;
@@ -1290,6 +1290,7 @@ std::string LOOLWSD::ServerName;
std::string LOOLWSD::FileServerRoot;
std::string LOOLWSD::LOKitVersion;
Util::RuntimeConstant<bool> LOOLWSD::SSLEnabled;
+Util::RuntimeConstant<bool> LOOLWSD::SSLTermination;
static std::string UnitTestLibrary;
@@ -1349,6 +1350,7 @@ void LOOLWSD::initialize(Application& self)
{ "logging.color", "true" },
{ "logging.level", "trace" },
{ "ssl.enable", "true" },
+ { "ssl.termination", "true" },
{ "ssl.cert_file_path", LOOLWSD_CONFIGDIR "/cert.pem" },
{ "ssl.key_file_path", LOOLWSD_CONFIGDIR "/key.pem" },
{ "ssl.ca_file_path", LOOLWSD_CONFIGDIR "/ca-chain.cert.pem" },
@@ -1429,6 +1431,8 @@ void LOOLWSD::initialize(Application& self)
Log::warn("SSL support: SSL is disabled.");
}
+ LOOLWSD::SSLTermination.set(getConfigValue<bool>(conf, "ssl.termination", true));
+
Cache = getPathFromConfig("tile_cache_path");
SysTemplate = getPathFromConfig("sys_template_path");
LoTemplate = getPathFromConfig("lo_template_path");
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index babcb08..540dd8a 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -65,6 +65,12 @@ public:
}
static
+ bool isSSLTermination()
+ {
+ return LOOLWSD::SSLTermination.get();
+ }
+
+ static
void dumpEventTrace(const std::string& pId, const std::string& sessionId, const std::string& data);
static
@@ -82,6 +88,7 @@ protected:
private:
static Util::RuntimeConstant<bool> SSLEnabled;
+ static Util::RuntimeConstant<bool> SSLTermination;
void initializeSSL();
void displayHelp();
diff --git a/loolwsd/Storage.cpp b/loolwsd/Storage.cpp
index 4487e5b..f44482e 100644
--- a/loolwsd/Storage.cpp
+++ b/loolwsd/Storage.cpp
@@ -242,7 +242,7 @@ namespace {
static inline
Poco::Net::HTTPClientSession* lcl_getHTTPClientSession(const Poco::URI& uri)
{
- return (LOOLWSD::isSSLEnabled()) ? new Poco::Net::HTTPSClientSession(uri.getHost(), uri.getPort(), Poco::Net::SSLManager::instance().defaultClientContext())
+ return (LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? new Poco::Net::HTTPSClientSession(uri.getHost(), uri.getPort(), Poco::Net::SSLManager::instance().defaultClientContext())
: new Poco::Net::HTTPClientSession(uri.getHost(), uri.getPort());
}
diff --git a/loolwsd/loolwsd.xml.in b/loolwsd/loolwsd.xml.in
index f369449..cd3533f 100644
--- a/loolwsd/loolwsd.xml.in
+++ b/loolwsd/loolwsd.xml.in
@@ -35,6 +35,7 @@
<ssl desc="SSL settings">
<enable type="bool" default="true">true</enable>
+ <termination type="bool" default="true">true</enable>
<cert_file_path desc="Path to the cert file" relative="false">/etc/loolwsd/cert.pem</cert_file_path>
<key_file_path desc="Path to the key file" relative="false">/etc/loolwsd/key.pem</key_file_path>
<ca_file_path desc="Path to the ca file" relative="false">/etc/loolwsd/ca-chain.cert.pem</ca_file_path>
More information about the Libreoffice-commits
mailing list