1#include "BaseWebServer.h"
3#include "Utility/Singletons/HTTPSSingleton.h"
4#include "Exceptions/SSLException.h"
10 BaseWebServer::BaseWebServer() :
13 utility::HTTPSSingleton& httpsSettings = utility::HTTPSSingleton::get();
15 if (useHTTPS = httpsSettings.getUseHTTPS(); useHTTPS)
17 context = SSL_CTX_new(TLS_server_method());
21 throw web::exceptions::SSLException(__LINE__, __FILE__);
24 if (
int errorCode = SSL_CTX_use_certificate_file(context, httpsSettings.getPathToCertificate().string().data(), SSL_FILETYPE_PEM); errorCode != 1)
26 throw web::exceptions::SSLException(__LINE__, __FILE__, errorCode);
29 if (
int errorCode = SSL_CTX_use_PrivateKey_file(context, httpsSettings.getPathToKey().string().data(), SSL_FILETYPE_PEM); errorCode != 1)
31 throw web::exceptions::SSLException(__LINE__, __FILE__, errorCode);
36 BaseWebServer::~BaseWebServer()
40 SSL_CTX_free(context);