Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.7.0
-
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?