Support SSL certificate bundles. Issue #4896.

This commit is contained in:
UnDifferential 2016-03-05 02:41:18 -05:00 committed by Brandon Rutledge
parent 15ec515872
commit f50a8d4f59
3 changed files with 15 additions and 10 deletions

View file

@ -65,11 +65,12 @@ void WebUI::init()
#ifndef QT_NO_OPENSSL
if (pref->isWebUiHttpsEnabled()) {
QSslCertificate cert(pref->getWebUiHttpsCertificate());
QList<QSslCertificate> certs = QSslCertificate::fromData(pref->getWebUiHttpsCertificate());
QSslKey key;
key = QSslKey(pref->getWebUiHttpsKey(), QSsl::Rsa);
if (!cert.isNull() && !key.isNull())
httpServer_->enableHttps(cert, key);
bool certsIsNull = std::any_of(certs.begin(), certs.end(), [](QSslCertificate c) { return c.isNull(); });
if (!certsIsNull && !certs.empty() && !key.isNull())
httpServer_->enableHttps(certs, key);
else
httpServer_->disableHttps();
}