|
|
|
@ -11,6 +11,7 @@ |
|
|
|
|
#include <qbrowserlib/log.hxx> |
|
|
|
|
#include <QtNetwork/QNetworkReply> |
|
|
|
|
#include <QtNetwork/QSslError> |
|
|
|
|
#include <QtNetwork/QSslConfiguration> |
|
|
|
|
#include <map> |
|
|
|
|
|
|
|
|
|
#include <cassert> |
|
|
|
@ -216,6 +217,28 @@ class DownloadManager: public QObject { |
|
|
|
|
<<"C="<<err->certificate().subjectInfo(QSslCertificate::CountryName) |
|
|
|
|
<<"ST="<<err->certificate().subjectInfo(QSslCertificate::StateOrProvinceName); |
|
|
|
|
LOG<<"Certificate:\n"<<err->certificate().toPem(); |
|
|
|
|
switch (err->error()) { |
|
|
|
|
case QSslError::SelfSignedCertificate: |
|
|
|
|
case QSslError::SelfSignedCertificateInChain: { |
|
|
|
|
QSslConfiguration sslConfig |
|
|
|
|
(QSslConfiguration::defaultConfiguration()); |
|
|
|
|
QList<QSslCertificate> certs(sslConfig.caCertificates()); |
|
|
|
|
for (QList<QSslCertificate>::iterator cert(certs.begin()); |
|
|
|
|
cert!=certs.end(); ++cert) { |
|
|
|
|
if (err->certificate().subjectInfo(QSslCertificate::CommonName) == |
|
|
|
|
cert->subjectInfo(QSslCertificate::CommonName)) { |
|
|
|
|
LOG<<"Found matching CN:" |
|
|
|
|
<<cert->subjectInfo(QSslCertificate::CommonName); |
|
|
|
|
if (err->certificate()==*cert) { |
|
|
|
|
LOG<<"QT-BUG! Certificate matches known certificate"; |
|
|
|
|
} else { |
|
|
|
|
LOG<<"CERTIFICATE ERROR! Certificates are different"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} break; |
|
|
|
|
default:; // ignore
|
|
|
|
|
} |
|
|
|
|
_downloads[reply].error += |
|
|
|
|
tr("<h1>SSL Error</h1>" |
|
|
|
|
"<dl><dt>URL:</dt><dd>%1</dd>" |
|
|
|
@ -237,7 +260,7 @@ class DownloadManager: public QObject { |
|
|
|
|
"<tr><th>Location:</th><td>%12</td></tr>" |
|
|
|
|
"<tr><th>Organizational Unit:</th><td>%13</td></tr>" |
|
|
|
|
"<tr><th>Country:</th><td>%14</td></tr>" |
|
|
|
|
"<tr><th>State or Provive:</th><td>%15</td></tr>" |
|
|
|
|
"<tr><th>State or Province:</th><td>%15</td></tr>" |
|
|
|
|
"</table>") |
|
|
|
|
.arg(reply->url().toString()) |
|
|
|
|
.arg(err->errorString()) |
|
|
|
|