Results 1 to 1 of 1

Thread: Ignore SSL Errors

  1. #1
    Join Date
    Apr 2012
    Posts
    1
    Qt products
    Qt4

    Default Re: Ignore SSL Errors

    Hi there,

    I'm quite new to QT and I cannot find a working example, just suggestions like function X, but I don't know how. I need to get some files over https. My code without ssl is:

    Qt Code:
    1. http = new QHttp(this);
    2. http->setHost("search.for.updates.com");
    3. connect(http, SIGNAL(done(bool)), this, SLOT(checkUpdate()));
    4. http->get("/latest");
    To copy to clipboard, switch view to plain text mode 

    This works.
    Now I need SSL, but my test certificate is not validated (StartSSL, Class 1).

    Qt Code:
    1. http = new QHttp(this);
    2. http->setHost("search.for.updates.com", QHttp::ConnectionModeHttps);
    3. connect(http, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(handleSslErrors(const QList<QSslError> & errors)));
    4. connect(http, SIGNAL(done(bool)), this, SLOT(checkUpdate()));
    5. http->get("/latest");
    To copy to clipboard, switch view to plain text mode 

    How must the handleSslErrors Function look like? I tried this and other variations, but it just don't work.

    Qt Code:
    1. void MainWindow::handleSslErrors(const QList<QSslError> & errors) {
    2. foreach (QSslError error, errors)
    3. {
    4. error->ignoreSslErrors();
    5. }
    6. }
    To copy to clipboard, switch view to plain text mode 

    Can anybody give me a hint? Thanks in advance.


    Added after 11 minutes:


    Ok I found out, this works, but the response is still empty:

    Qt Code:
    1. void MainWindow::handleSslErrors(const QList<QSslError> & errors) {
    2. http->ignoreSslErrors();
    3. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Oliver76; 27th April 2012 at 15:16.

Similar Threads

  1. Some Signal Ignore
    By nicolas1 in forum Qt Programming
    Replies: 2
    Last Post: 31st December 2008, 02:07
  2. Ignore all events from a widgets
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 25th October 2007, 16:56

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.