View | Details | Raw Unified | Return to bug 26937
Collapse All | Expand All

(-)arora-0.11.0/src/network/networkaccessmanager.cpp.fake-certificate-issuer (-1 / +24 lines)
Lines 249-260 void NetworkAccessManager::proxyAuthenti Link Here
249
    }
249
    }
250
}
250
}
251
251
252
// TODO (QT5): use QString::htmlEscape or whatever https://qt.gitorious.org/qt/qtbase/merge_requests/56
253
// ends up with.
254
// original author: David Faure
255
static QString htmlEscape(const QString &plain)
256
{
257
    QString rich;
258
    rich.reserve(int(plain.length() * 1.1));
259
        for (int i = 0; i < plain.length(); ++i) {
260
        if (plain.at(i) == QLatin1Char('<'))
261
            rich += QLatin1String("&lt;");
262
        else if (plain.at(i) == QLatin1Char('>'))
263
            rich += QLatin1String("&gt;");
264
        else if (plain.at(i) == QLatin1Char('&'))
265
            rich += QLatin1String("&amp;");
266
        else if (plain.at(i) == QLatin1Char('"'))
267
            rich += QLatin1String("&quot;");
268
        else
269
            rich += plain.at(i);
270
    }
271
    rich.squeeze();
272
    return rich;
273
}
274
252
#ifndef QT_NO_OPENSSL
275
#ifndef QT_NO_OPENSSL
253
QString NetworkAccessManager::certToFormattedString(QSslCertificate cert)
276
QString NetworkAccessManager::certToFormattedString(QSslCertificate cert)
254
{
277
{
255
    QStringList message;
278
    QStringList message;
256
    message << cert.subjectInfo(QSslCertificate::CommonName);
279
    message << cert.subjectInfo(QSslCertificate::CommonName);
257
    message << tr("Issuer: %1").arg(cert.issuerInfo(QSslCertificate::CommonName));
280
    message << tr("Issuer: %1").arg(htmlEscape(cert.issuerInfo(QSslCertificate::CommonName)));
258
    message << tr("Not valid before: %1").arg(cert.effectiveDate().toString());
281
    message << tr("Not valid before: %1").arg(cert.effectiveDate().toString());
259
    message << tr("Valid until: %1").arg(cert.expiryDate().toString());
282
    message << tr("Valid until: %1").arg(cert.expiryDate().toString());
260
283

Return to bug 26937