Re: QWebView not displaying some SSL page on Windows/Qt 4.8/MingW
Hi,
I have installed the OpenSSL dll.
When I try to display some page in a QWebView, nothing happen:
https://www.labanquepostale.fr/index.html
https://www.paypal.com/
Still, it works with other pages like:
https://www.secure.bnpparibas.net
https://www.creditmutuel.fr/groupe/fr/index.html
Code:
QWebView *webview=new QWebView();
webview
->load
(QUrl("https://www.labanquepostale.fr/index.html"));
webview->show();
I even tried to derivate QWebView to ignore SSL errors, but none pops and I still can't see my page:
Code:
class QWebViewExt : public QWebView
{
Q_OBJECT // must include this if you use Qt signals/slots
public:
QWebViewExt();
private slots:
void sslErrorHandler( QNetworkReply *reply, const QList<QSslError> &errors );
};
Code:
QWebViewExt::QWebViewExt()
{
connect( this->page()->networkAccessManager(),
SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )),
this,
SLOT(sslErrorHandler(QNetworkReply*, const QList<QSslError> & )));
}
void QWebViewExt::sslErrorHandler( QNetworkReply *reply, const QList<QSslError> &errors )
{
qDebug() << "sslErrorHandler:";
foreach (QSslError err, errors)
qDebug() << "ssl error: " << err;
reply->ignoreSslErrors();
}
What's the problem ?
Using the "webkit/FancyBrowser" example from the SDK I can see the loading block at 10%. But I have no problem seeing the page in Chrome.
Re: QWebView not displaying some SSL page on Windows/Qt 4.8/MingW
I found the solution after a lot of research in Arora browser source code:
Code:
QSslConfiguration sslCfg = QSslConfiguration::defaultConfiguration();
QList<QSslCertificate> ca_list = sslCfg.caCertificates();
QList<QSslCertificate> ca_new = QSslCertificate::fromData("CaCertificates");
ca_list += ca_new;
sslCfg.setCaCertificates(ca_list);
sslCfg.setProtocol(QSsl::AnyProtocol);
QSslConfiguration::setDefaultConfiguration(sslCfg);