Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13737

QSslSocket::startServerEncryption does not signal immediate errors

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.7.0
    • Network: SSL
    • None
    • Linux, 64 bit, gcc, X11, KDE

    Description

      QSslSocket::startServerEncryption has code paths for immediate errors (e.g. loading the local certificate), but when this happens, it only sets an error string in the socket (QIODevice::errorString) and does not provide a way to know that there actually was an error. The error code in the socket is QAbstractSocket::UnknownSocketError, just like when there is no error.

      Either it should set an error code, or – at least in Qt5 – it should return a boolean. Meanwhile there could be a getter for "there was an error during startServerEncryption".

      Note that waitForEncrypted hangs after such an error (since nothing else is happening), so a way to know that it should not be called is quite important.

      The testcase is a patch for tst_qnetworkreply.cpp.
      Run the test with ./tst_qnetworkreply ioPostToHttpsUploadProgress

      You will see the actual error ("loading private key") but only because I added an unconditional qDebug() << serverSocket->errorString(). The question is: what to put instead of if(true) to detect that there indeed was an error?

      Attachments

        1. tst_qnetworkreply.diff
          1 kB
          David Faure (Private)
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            richmoore Richard Moore (qtnetwork)
            dfaure David Faure (Private)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes