summaryrefslogtreecommitdiff
path: root/src/webpage.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-07-23 18:29:15 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-23 18:39:24 +0200
commit85f454faabef5453c08eb5493d0afc63e23f650b (patch)
treefd618388294beb76f58047b3115522e185e813ab /src/webpage.cpp
parentUse KLocale::formatByteSize instead of a i18n call (diff)
downloadrekonq-85f454faabef5453c08eb5493d0afc63e23f650b.tar.xz
SSL fixes
I hope I addressed here a number of fixes in my first implementation: - working hasSSLValid() function (checking cert validity and chain errors) - escaping certificate strings - typos (Sha256/Md5, supportedCipherBits/usedCipherBits) - encryption check (at least I hope so) CCMAIL: rich@kde.org
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r--src/webpage.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 0c9b436d..3f4b4e1f 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -545,10 +545,11 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
QWebFrame* frame = qobject_cast<QWebFrame *>(reply->request().originatingObject());
const bool isMainFrameRequest = (frame == mainFrame());
- //const bool isUrlFrameLoading = (_loadingUrl == frame->url());
+ const bool isLoadingUrlReply = (_loadingUrl == reply->url());
if(isMainFrameRequest
&& _sslInfo.isValid()
+ && isLoadingUrlReply
&& !domainSchemeMatch(reply->url(), _sslInfo.url())
)
{
@@ -562,7 +563,7 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
{
case QNetworkReply::NoError: // no error. Simple :)
- if(isMainFrameRequest && !_sslInfo.isValid())
+ if(isMainFrameRequest && isLoadingUrlReply && !_sslInfo.isValid())
{
// Obtain and set the SSL information if any...
_sslInfo.restoreFrom(reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)), reply->url());
@@ -754,22 +755,15 @@ void WebPage::copyToTempFileResult(KJob* job)
bool WebPage::hasSslValid()
{
- bool v = true;
QList<QSslCertificate> certList = _sslInfo.certificateChain();
if (certList.isEmpty())
return false;
- Q_FOREACH(const QSslCertificate & cert, certList)
- {
- v &= cert.isValid();
- }
+ QSslCertificate firstCert = certList.at(0);
+ if (!firstCert.isValid())
+ return false;
- QList<QStringList> errorsList = SslInfoDialog::errorsFromString(_sslInfo.certificateErrors());
- Q_FOREACH(const QStringList & err, errorsList)
- {
- v &= err.isEmpty();
- }
-
- return v;
+ QStringList firstCertErrorsList = SslInfoDialog::errorsFromString(_sslInfo.certificateErrors()).at(0);
+ return firstCertErrorsList.isEmpty();
}