Results 1 to 8 of 8

Thread: Use of QWebView to browse "https" secure sites

  1. #1
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Use of QWebView to browse "https" secure sites

    Hello,

    I can't find how to browse secure sites (https) with use of QWebView. For example I load "www.yahoo.com" and then when I want to go to yahoo mail the site is not being load. I've used the browser application from QT examples and demos and find out that this browser also does not support entering secure sites. Please let me know if there is a way to solve this problem somehow.

    Thanks,
    Hayk

  2. #2
    Join Date
    Jun 2008
    Location
    The Netherlands
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Use of QWebView to browse "https" secure sites

    From http://labs.trolltech.com/blogs/2008...it-demobrowser :

    » Posted by Cepera
    on Tuesday, March 25, 2008 @ 07:52
    Looks like to turn on https OpenSSL should be installed on Windows.
    And Qt should be configured with -openssl-linked option.

    If images on web pages doesn’t work - it means imageformats not configured properly or plugins didn’t copied into target release directory.
    Qt may be configured with build-in support of image formats: -qt-libpng -qt-libjpeg -qt-libtiff -qt-gif -qt-libmng

    Hope that helps

  3. #3
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Use of QWebView to browse "https" secure sites

    I don't have image loading errors. I just can't browse to secure sites (https) for example the mail.yahoo.com. As far as I understand this secure sites use SSL. When I remove all Certificates from my Firefox browser I see that when entering this type of sites they send me a certificate, and only after adding this certificate they let me to enter their sites.

  4. #4
    Join Date
    Jun 2008
    Location
    The Netherlands
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Use of QWebView to browse "https" secure sites

    Quote Originally Posted by grigoryan_hayk View Post
    I don't have image loading errors. I just can't browse to secure sites (https) for example the mail.yahoo.com. As far as I understand this secure sites use SSL. When I remove all Certificates from my Firefox browser I see that when entering this type of sites they send me a certificate, and only after adding this certificate they let me to enter their sites.
    I know, I just included that piece too for completeness sake. HTTPS does indeed work with SSL certificates. To get these working with QWebView you'll need to do the following:
    (as mentioned in my other post)

    - You need OpenSSL installed on your pc
    - Then you need to recompile Qt with the -openssl-linked option

    After this https links should work for you!
    pvdk

  5. #5
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Use of QWebView to browse "https" secure sites

    Thanks,
    I'll try to install OpenSSl library and then build QT source with the flag that you've told.

  6. #6
    Join Date
    Jan 2006
    Location
    Athens - Greece
    Posts
    219
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Use of QWebView to browse "https" secure sites

    Quote Originally Posted by pvdk View Post
    - You need OpenSSL installed on your pc
    - Then you need to recompile Qt with the -openssl-linked option
    Do you have any experience on installing custom certificates under linux?
    I can't seem to find a way to tell QtWebkit to trust a given site by accepting it's certificate.
    https works for me but the above not. I think only signed by well known authorities certificates work. Maybe this has to be setup in the OS level and not QtWebkit?
    I love deadlines. I like the whooshing sound they make as they fly by.
    --
    Douglas Adams

  7. #7
    Join Date
    Apr 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Use of QWebView to browse "https" secure sites

    Please review arora sources. The main points are:
    1. Set up a network access manager for the QWebPage instance via setNetworkAccessManager().
    2. Override sslErrors() methods in the manager class.

    After that you'll have two choices:
    1. Ignore all SSL errors (via QNetworkReply::ignoreSslErrors()), but this is not secure.
    2. Register a new SSL certificate for the required site (via QSslConfiguration::setCaCertificates() or related methods).

  8. #8
    Join Date
    Sep 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Use of QWebView to browse "https" secure sites

    Quote Originally Posted by nuald View Post
    Please review arora sources. The main points are:
    1. Set up a network access manager for the QWebPage instance via setNetworkAccessManager().
    2. Override sslErrors() methods in the manager class.

    After that you'll have two choices:
    1. Ignore all SSL errors (via QNetworkReply::ignoreSslErrors()), but this is not secure.
    2. Register a new SSL certificate for the required site (via QSslConfiguration::setCaCertificates() or related methods).
    This might work smoothly in QWebPage. But in the the QWebEngine it is not possible to handle the ssl error like that. It is needed to:
    • Subclass QWebEnginePage and override the certificateError method, if you want to just ignore all errors, just make it return true OR if you want to deal with each error individally just check the QWebEngineCertificateError and return true/false depending of the error type
    • In your QWebEngineView don't load the page directly, do:
      Qt Code:
      1. QWebEngineView* webView = new QWebEngineView(this);
      2. CustomPage* page = new CustomPage(webView);
      3. page->load(QUrl("https://www.self-signed-wild-page.com"));
      4. webview->setPage(page);
      5. webview->show();
      To copy to clipboard, switch view to plain text mode 

    And it's done =D

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.