Results 1 to 2 of 2

Thread: Re: QWebView not displaying some SSL page on Windows/Qt 4.8/MingW

  1. #1
    Join Date
    Oct 2009
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

    Qt Code:
    1. QWebView *webview=new QWebView();
    2. webview->load(QUrl("https://www.labanquepostale.fr/index.html"));
    3. webview->show();
    To copy to clipboard, switch view to plain text mode 

    I even tried to derivate QWebView to ignore SSL errors, but none pops and I still can't see my page:

    Qt Code:
    1. class QWebViewExt : public QWebView
    2. {
    3. Q_OBJECT // must include this if you use Qt signals/slots
    4. public:
    5. QWebViewExt();
    6. private slots:
    7. void sslErrorHandler( QNetworkReply *reply, const QList<QSslError> &errors );
    8. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    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. }
    8.  
    9.  
    10. void QWebViewExt::sslErrorHandler( QNetworkReply *reply, const QList<QSslError> &errors )
    11. {
    12. qDebug() << "sslErrorHandler:";
    13. foreach (QSslError err, errors)
    14. qDebug() << "ssl error: " << err;
    15.  
    16. reply->ignoreSslErrors();
    17. }
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by divide; 31st March 2012 at 16:07.

  2. #2
    Join Date
    Oct 2009
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default 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:

    Qt 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;
    5.  
    6. sslCfg.setCaCertificates(ca_list);
    7. sslCfg.setProtocol(QSsl::AnyProtocol);
    8. QSslConfiguration::setDefaultConfiguration(sslCfg);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 4
    Last Post: 25th October 2010, 14:22
  2. Editing in text box of web page : QWebView
    By girishgowda in forum Qt Programming
    Replies: 0
    Last Post: 13th July 2010, 11:42
  3. Html page Display in QWebView
    By Tavit in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2010, 15:39
  4. QWebView problem to display the web page
    By ansar in forum Qt Programming
    Replies: 4
    Last Post: 2nd March 2010, 12:36
  5. Displaying Page Number on a widget
    By LiCodeX in forum Newbie
    Replies: 1
    Last Post: 23rd August 2007, 08:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.