4 #include <QSslCertificate> 5 #include <QSslConfiguration> 13 : QObject(), useQtSettings(true)
15 Q_ASSERT(settings != 0);
21 cleanupTimer.start(settings->value(
"cleanupInterval",1000).toInt());
28 Q_ASSERT(settings != 0);
46 qDebug(
"HttpConnectionHandlerPool (%p): destroyed",
this);
68 if (
pool.count()<maxConnectionHandlers)
77 pool.append(freeHandler);
94 if (++idleCounter > maxIdleHandlers)
96 pool.removeOne(handler);
97 qDebug(
"HttpConnectionHandlerPool: Removed connection handler (%p), pool size is now %i",handler,
pool.size());
112 if (!sslKeyFileName.isEmpty() && !sslCertFileName.isEmpty())
115 qWarning(
"HttpConnectionHandlerPool::loadSslConfig: SSL is not supported");
118 QFileInfo configFile(
settings->fileName());
120 if (QDir::isRelativePath(sslKeyFileName) &&
settings->format()!=QSettings::NativeFormat)
122 if (QDir::isRelativePath(sslKeyFileName))
125 sslKeyFileName=QFileInfo(configFile.absolutePath(),sslKeyFileName).absoluteFilePath();
128 if (QDir::isRelativePath(sslCertFileName) &&
settings->format()!=QSettings::NativeFormat)
130 if (QDir::isRelativePath(sslCertFileName))
133 sslCertFileName=QFileInfo(configFile.absolutePath(),sslCertFileName).absoluteFilePath();
137 QFile certFile(sslCertFileName);
138 if (!certFile.open(QIODevice::ReadOnly))
140 qCritical(
"HttpConnectionHandlerPool: cannot open sslCertFile %s", qPrintable(sslCertFileName));
143 QSslCertificate certificate(&certFile, QSsl::Pem);
147 QFile keyFile(sslKeyFileName);
148 if (!keyFile.open(QIODevice::ReadOnly))
150 qCritical(
"HttpConnectionHandlerPool: cannot open sslKeyFile %s", qPrintable(sslKeyFileName));
153 QSslKey sslKey(&keyFile, QSsl::Rsa, QSsl::Pem);
163 qDebug(
"HttpConnectionHandlerPool: SSL settings loaded");
QSslConfiguration * sslConfiguration
virtual ~HttpConnectionHandlerPool()
HttpConnectionHandlerPool(QSettings *settings, HttpRequestHandler *requestHandler)
QList< HttpConnectionHandler * > pool
const HttpListenerSettings * listenerSettings
HttpRequestHandler * requestHandler
HttpConnectionHandler * getConnectionHandler()