March 31, 2012

divide divide
Lab Rat
34 posts

some SSL pages not displaying on Windows/Qt 4.8/MingW ?


QWebView can’t display pages like:

But it has no problem with other pages like:

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.

I also tried to ignore SSL errors, but no SSL error pops during the loading:

  1. QWebViewExt::QWebViewExt()
  2. {
  3.     connect(this->page()->networkAccessManager(),
  4.              SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError>&)),
  5.              this,
  6.              SLOT(sslErrorHandler(QNetworkReply*,const QList<QSslError>&)));
  7. }
  10. void QWebViewExt::sslErrorHandler(QNetworkReply *reply, const QList<QSslError> &errors)
  11. {
  12.     qDebug() << "sslErrorHandler:";
  13.     foreach (QSslError err, errors)
  14.       qDebug() << "ssl error: " << err;
  16.     reply->ignoreSslErrors();
  17. }

3 replies

March 31, 2012

divide divide
Lab Rat
34 posts

I found the solution after a lot of research in Arora browser source code:

  1.             QSslConfiguration sslCfg = QSslConfiguration::defaultConfiguration();
  2.             QList<QSslCertificate> ca_list = sslCfg.caCertificates();
  3.             QList<QSslCertificate> ca_new = QSslCertificate::fromData("CaCertificates");
  4.             ca_list += ca_new;
  6.             sslCfg.setCaCertificates(ca_list);
  7.             sslCfg.setProtocol(QSsl::AnyProtocol);
  8.             QSslConfiguration::setDefaultConfiguration(sslCfg);

May 13, 2012

substorm substorm
Lab Rat
1 posts

Can you post some more details where the QSslConfiguration code is set? If the sslErrorHandler is not even called, there is no point to set it there right? I ran into a similar problem and am trying to understand how to fix it in the simplest way using the fancybrowser example. Thanks.

May 14, 2012

divide divide
Lab Rat
34 posts

You have to set the ssl configuration thing (as above) before anything else in your program (at least, before calling any web thing).

Also, actually you still have to use the modified QWebView too (QWebViewExt as in my first post), since in some case the ssl config is not enough.

Then you shouldn’t have troubles accessing ssl websites.

  ‹‹ UPnp in Qt      QtWebkit crash while browsing web pages inside Qt Creator ››

You must log in to post a reply. Not a member yet? Register here!