remove obsolete Poco headers, and Poco SSL pieces.

This commit is contained in:
Michael Meeks 2017-03-16 17:43:33 +00:00
parent a6de441ed0
commit e7ebe0fdaa
10 changed files with 12 additions and 83 deletions

View file

@ -141,7 +141,6 @@ wsd_headers = wsd/Admin.hpp \
wsd/Exceptions.hpp \
wsd/FileServer.hpp \
wsd/LOOLWSD.hpp \
wsd/LOOLWebSocket.hpp \
wsd/QueueHandler.hpp \
wsd/SenderQueue.hpp \
wsd/Storage.hpp \
@ -154,6 +153,7 @@ shared_headers = common/Common.hpp \
common/IoUtil.hpp \
common/FileUtil.hpp \
common/Log.hpp \
common/LOOLWebSocket.hpp \
common/Protocol.hpp \
common/Session.hpp \
common/Unit.hpp \

View file

@ -18,7 +18,6 @@
namespace IoUtil
{
/// Synchronously process LOOLWebSocket requests and dispatch to handler.
/// Handler returns false to end.
void SocketProcessor(const std::shared_ptr<LOOLWebSocket>& ws,

View file

@ -15,6 +15,8 @@
#include "Socket.hpp"
#include "Log.hpp"
#include <Poco/Net/SocketAddress.h>
class SocketFactory
{
public:

View file

@ -13,6 +13,10 @@
#include <poll.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <atomic>
#include <cassert>
@ -28,7 +32,6 @@
#include <Poco/Timespan.h>
#include <Poco/Timestamp.h>
#include <Poco/Net/SocketAddress.h>
#include <Poco/Net/HTTPResponse.h>
#include "Common.hpp"

View file

@ -15,14 +15,7 @@
#include <Poco/Net/HTTPCookie.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPRequestHandler.h>
#include <Poco/Net/HTTPServerParams.h>
#include <Poco/Net/HTTPServerRequest.h>
#include <Poco/Net/HTTPServerResponse.h>
#include <Poco/Net/NetException.h>
#include <Poco/Net/SecureServerSocket.h>
#include <Poco/StringTokenizer.h>
#include <Poco/Util/ServerApplication.h>
#include <Poco/Util/Timer.h>
#include "Admin.hpp"
@ -47,10 +40,7 @@
using namespace LOOLProtocol;
using Poco::StringTokenizer;
using Poco::Net::HTTPRequestHandler;
using Poco::Net::HTTPResponse;
using Poco::Net::HTTPServerRequest;
using Poco::Net::HTTPServerResponse;
using Poco::Util::Application;
/// Process incoming websocket messages
@ -118,9 +108,7 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
{
const std::string result = model.query(tokens[0]);
if (!result.empty())
{
sendTextFrame(tokens[0] + ' ' + result);
}
}
else if (tokens[0] == "subscribe" && tokens.count() > 1)
{

View file

@ -13,8 +13,6 @@
#include <mutex>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPRequestHandler.h>
#include <Poco/Net/HTTPServer.h>
#include <Poco/Runnable.h>
#include <Poco/Types.h>
#include <Poco/Util/Timer.h>
@ -41,8 +39,7 @@ public:
const Poco::Net::HTTPRequest& request);
private:
void handleWSRequests(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response, int sessionId);
/// Sends text frames simply to authenticated clients.
void sendTextFrame(const std::string& message);
/// Process incoming websocket messages

View file

@ -21,11 +21,8 @@
#include <Poco/Net/HTTPBasicCredentials.h>
#include <Poco/Net/HTMLForm.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPRequestHandler.h>
#include <Poco/Net/NameValueCollection.h>
#include <Poco/Net/NetException.h>
#include <Poco/Net/SecureServerSocket.h>
#include <Poco/Net/WebSocket.h>
#include <Poco/RegularExpression.h>
#include <Poco/Runnable.h>
#include <Poco/StreamCopier.h>
@ -42,8 +39,6 @@ using Poco::FileInputStream;
using Poco::Net::HTMLForm;
using Poco::Net::HTTPRequest;
using Poco::Net::HTTPResponse;
using Poco::Net::HTTPServerRequest;
using Poco::Net::HTTPServerResponse;
using Poco::Net::NameValueCollection;
using Poco::Net::HTTPBasicCredentials;
using Poco::StreamCopier;

View file

@ -11,13 +11,9 @@
#define INCLUDED_FILESERVER_HPP
#include <string>
#include "Socket.hpp"
#include <Poco/MemoryStream.h>
#include <Poco/Net/HTTPRequestHandler.h>
#include <Poco/Net/HTTPServerRequest.h>
#include <Poco/Net/HTTPServerResponse.h>
#include "Socket.hpp"
/// Handles file requests over HTTP(S).
class FileServerRequestHandler

View file

@ -59,29 +59,15 @@
#include <Poco/File.h>
#include <Poco/FileStream.h>
#include <Poco/MemoryStream.h>
#include <Poco/Net/AcceptCertificateHandler.h>
#include <Poco/Net/ConsoleCertificateHandler.h>
#include <Poco/Net/Context.h>
#include <Poco/Net/HTMLForm.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPRequestHandler.h>
#include <Poco/Net/HTTPRequestHandlerFactory.h>
#include <Poco/Net/HTTPServer.h>
#include <Poco/Net/HTTPServerParams.h>
#include <Poco/Net/HTTPServerRequest.h>
#include <Poco/Net/HTTPServerResponse.h>
#include <Poco/Net/IPAddress.h>
#include <Poco/Net/InvalidCertificateHandler.h>
#include <Poco/Net/KeyConsoleHandler.h>
#include <Poco/Net/MessageHeader.h>
#include <Poco/Net/NameValueCollection.h>
#include <Poco/Net/Net.h>
#include <Poco/Net/NetException.h>
#include <Poco/Net/PartHandler.h>
#include <Poco/Net/PrivateKeyPassphraseHandler.h>
#include <Poco/Net/SSLManager.h>
#include <Poco/Net/SecureServerSocket.h>
#include <Poco/Net/ServerSocket.h>
#include <Poco/Net/SocketAddress.h>
#include <Poco/Path.h>
#include <Poco/Pipe.h>
@ -112,7 +98,7 @@
#include "ServerSocket.hpp"
#include "Session.hpp"
#if ENABLE_SSL
#include "SslSocket.hpp"
# include "SslSocket.hpp"
#endif
#include "Storage.hpp"
#include "TraceFile.hpp"
@ -123,11 +109,11 @@
#include "FileUtil.hpp"
#ifdef KIT_IN_PROCESS
#include <Kit.hpp>
# include <Kit.hpp>
#endif
#ifdef FUZZER
#include <tools/Replay.hpp>
# include <tools/Replay.hpp>
#endif
#include "common/SigUtil.hpp"
@ -139,17 +125,10 @@ using Poco::Exception;
using Poco::File;
using Poco::Net::HTMLForm;
using Poco::Net::HTTPRequest;
using Poco::Net::HTTPRequestHandler;
using Poco::Net::HTTPRequestHandlerFactory;
using Poco::Net::HTTPResponse;
using Poco::Net::HTTPServer;
using Poco::Net::HTTPServerParams;
using Poco::Net::HTTPServerRequest;
using Poco::Net::HTTPServerResponse;
using Poco::Net::MessageHeader;
using Poco::Net::NameValueCollection;
using Poco::Net::PartHandler;
using Poco::Net::SecureServerSocket;
using Poco::Net::SocketAddress;
using Poco::Net::WebSocket;
using Poco::Path;
@ -866,9 +845,7 @@ void LOOLWSD::initialize(Application& self)
void LOOLWSD::initializeSSL()
{
if (!LOOLWSD::isSSLEnabled())
{
return;
}
const auto ssl_cert_file_path = getPathFromConfig("ssl.cert_file_path");
LOG_INF("SSL Cert file: " << ssl_cert_file_path);
@ -885,34 +862,6 @@ void LOOLWSD::initializeSSL()
ssl_key_file_path,
ssl_ca_file_path);
#endif
Poco::Crypto::initializeCrypto();
Poco::Net::initializeSSL();
Poco::Net::Context::Params sslParams;
sslParams.certificateFile = ssl_cert_file_path;
sslParams.privateKeyFile = ssl_key_file_path;
sslParams.caLocation = ssl_ca_file_path;
// Don't ask clients for certificate
sslParams.verificationMode = Poco::Net::Context::VERIFY_NONE;
// FIXME: ConsoleCertificateHandler will block on stdin upon error!
Poco::SharedPtr<Poco::Net::PrivateKeyPassphraseHandler> consoleHandler = new Poco::Net::KeyConsoleHandler(true);
Poco::SharedPtr<Poco::Net::InvalidCertificateHandler> invalidCertHandler = new Poco::Net::ConsoleCertificateHandler(true);
Poco::Net::Context::Ptr sslContext = new Poco::Net::Context(Poco::Net::Context::SERVER_USE, sslParams);
Poco::Net::SSLManager::instance().initializeServer(consoleHandler, invalidCertHandler, sslContext);
// Init client
Poco::Net::Context::Params sslClientParams;
// TODO: Be more strict and setup SSL key/certs for owncloud server and us
sslClientParams.verificationMode = Poco::Net::Context::VERIFY_NONE;
Poco::SharedPtr<Poco::Net::PrivateKeyPassphraseHandler> consoleClientHandler = new Poco::Net::KeyConsoleHandler(false);
Poco::SharedPtr<Poco::Net::InvalidCertificateHandler> invalidClientCertHandler = new Poco::Net::AcceptCertificateHandler(false);
Poco::Net::Context::Ptr sslClientContext = new Poco::Net::Context(Poco::Net::Context::CLIENT_USE, sslClientParams);
Poco::Net::SSLManager::instance().initializeClient(consoleClientHandler, invalidClientCertHandler, sslClientContext);
}
void LOOLWSD::dumpNewSessionTrace(const std::string& id, const std::string& sessionId, const std::string& uri, const std::string& path)