hand certificate and private key to QSslSocket instances

This commit is contained in:
Stephen Birarda 2014-04-24 14:35:18 -07:00
parent 96de0c1af1
commit 0bc17b0852
3 changed files with 5 additions and 2 deletions

View file

@ -42,7 +42,7 @@ HTTPConnection::HTTPConnection (QTcpSocket* socket, HTTPManager* parentManager)
HTTPConnection::~HTTPConnection() {
// log the destruction
if (_socket->error() != QAbstractSocket::UnknownSocketError) {
qDebug() << _socket->errorString();
qDebug() << _socket->errorString() << "-" << _socket->error();
}
}

View file

@ -14,7 +14,7 @@
HTTPSConnection::HTTPSConnection(QSslSocket* sslSocket, HTTPSManager* parentManager) :
HTTPConnection(sslSocket, parentManager)
{
connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError>&)), this, SLOT(sslErrors(const QList<QSslError>&)));
connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError>&)), this, SLOT(handleSSLErrors(const QList<QSslError>&)));
sslSocket->startServerEncryption();
}

View file

@ -27,6 +27,9 @@ HTTPSManager::HTTPSManager(quint16 port, const QSslCertificate& certificate, con
void HTTPSManager::incomingConnection(qintptr socketDescriptor) {
QSslSocket* sslSocket = new QSslSocket(this);
sslSocket->setLocalCertificate(_certificate);
sslSocket->setPrivateKey(_privateKey);
if (sslSocket->setSocketDescriptor(socketDescriptor)) {
new HTTPSConnection(sslSocket, this);
} else {