forked from swallat/qhttpserver
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsslserver.cpp
More file actions
36 lines (32 loc) · 1.04 KB
/
sslserver.cpp
File metadata and controls
36 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <QSsl>
#include <QSslSocket>
#include <QDebug>
#include "sslserver.h"
SslServer::SslServer(const QSslCertificate cert, const QSslKey key, QObject *parent) :
QTcpServer(parent),
m_sslCertificate(cert),
m_sslKey(key)
{
}
void SslServer::incomingConnection(qintptr handle)
{
QSslSocket* sock = new QSslSocket(this);
if (sock->setSocketDescriptor(handle)) {
sock->setPrivateKey(m_sslKey);
sock->setLocalCertificate(m_sslCertificate);
sock->startServerEncryption();
connect(sock, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslSocket_sslErrors(QList<QSslError>)));
connect(sock, SIGNAL(encrypted()), this, SLOT(sslSocket_encrypted()));
connect(this, SIGNAL(ignoreSslErrors()), sock, SLOT(ignoreSslErrors()));
addPendingConnection(sock);
} else {
qWarning() << "Failed to init QSslSocket with handle: " << handle << "!";
delete sock;
}
}
void SslServer::sslSocket_encrypted()
{
}
void SslServer::sslSocket_sslErrors(const QList<QSslError> &sslErrors)
{
}