Results 1 to 2 of 2

Thread: getting error Failure "SSL handshake failed"

  1. #1
    Join Date
    Nov 2015
    Location
    India
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default getting error Failure "SSL handshake failed"

    Qt Code:
    1. void MainWindow::on_pushButton_clicked()
    2. {
    3. QNetworkReply* reply;
    4. Request_reply( reply);
    5.  
    6. }
    7. int MainWindow:: Request_reply(QNetworkReply* reply) {
    8.  
    9. // create custom temporary event loop on stack
    10. QEventLoop eventLoop;
    11.  
    12. // "quit()" the event-loop, when the network request "finished()"
    13. QNetworkAccessManager mgr;
    14. QObject::connect(&mgr, SIGNAL(finished(QNetworkReply*)), &eventLoop, SLOT(quit()));
    15.  
    16. // the HTTP request
    17. //QNetworkRequest req( QUrl( QString("http://time.jsontest.com/") ) );
    18. QNetworkRequest req( QUrl( QString("https://10.201.58.87:2342/kirk/1.0/") ) );
    19. reply = mgr.get(req);
    20. eventLoop.exec(); // blocks stack until "finished()" has been called
    21.  
    22. if (reply->error() == QNetworkReply::NoError) {
    23.  
    24. QString strReply = (QString)reply->readAll();
    25.  
    26. //parse json
    27. qDebug() << "INFO:" << strReply;
    28. QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
    29.  
    30. QJsonObject jsonObj = jsonResponse.object();
    31.  
    32. qDebug() << "name:" << jsonObj["name"].toString();
    33. qDebug() << "build_version:" << jsonObj["build_version"].toString();
    34. QString str = jsonObj["name"].toString();
    35. ui->label1->setText(str);
    36.  
    37. //delete reply;
    38. }
    39. else {
    40. //failure
    41. qDebug() << "Failure" <<reply->errorString();
    42. delete reply;
    43. }
    44. return 0;
    45. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by anda_skoa; 25th November 2015 at 13:36. Reason: missing [code] tags

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: getting error Failure "SSL handshake failed"

    Take a look at QNetworkReply::ignoreSslErrors. Most likely you have a certificate error unless the certificates used by 10.201.58.87 are verifiable, which most self-signed certificates are not.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. cmake error with Failed to find "glu32" in ""
    By kennethadammiller in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2013, 00:12
  2. Replies: 32
    Last Post: 26th August 2012, 00:10
  3. QNetworkAccessManager: "SSL handshake failed"
    By kleag in forum Qt Programming
    Replies: 9
    Last Post: 6th November 2009, 11:41
  4. "Treat wchar_t as Built-in Type" to "yes" link error
    By sungaoyong in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 12:45
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 16:58

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.