PDA

View Full Version : Re: QWebView not displaying some SSL page on Windows/Qt 4.8/MingW



divide
31st March 2012, 10:51
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


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:


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 );
};


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.

divide
31st March 2012, 19:21
I found the solution after a lot of research in Arora browser source 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) ;