QSslSocket::ignoreSslErrors() not working as expected?



  • Hello everybody,

    I don't seem to understand how QSslSocket::ignoreSslErrors() is supposed to work. The signal QSslSocket::sslErrors() is still being emitted after calling ignoreSslErrors() (even though expected it to not be emitted in the first place). Ok, so next I thought that what the documentation meant by "This slot tells QSslSocket to ignore errors [...] and continue connecting." is, that after calling ignoreSslErrors(), even though sslErrors() is being emitted, QSslSocket::waitForEncrypted() should return true (provided that no other socket error occured). But this isn't the case if I call QSslSocket::ignoreSslErrors() right before QSslSocket::connectToHostEncrypted(). Only if I call ignoreSslErrors() in the slot connected to the signal sslErrors() does it work.

    But how am I supposed to ignore the errors the user flagged as being ok to ignore? I'm currently presenting a dialog with the errors and the corresponding certificates to the user. If he wishes to continue, I'll ignore those specific reported QSslErrors with ignoreSslErrors() right before calling connectToHostEncrypted(). This however does change nothing - sslErrors() is being emitted and waitForEncrypted() returns false.

    Any help would be really appreciated.

    Thanks in advance and greetings...



  • I'm running into this one right now... QSslSocket appears to have a slot QSslSocket::ignoreSslErrors() as well as a function QsslSocket::ignoreSslErrors(const QList<QSslError> & errors).

    The documentation for the slot says you can intercept errors from the QSslSocket::sslErrors() signal and call the slot to ignore the errors and continue the connection. On the other hand...

    The function claims that it tells QSslSocket to ignore only the errors given in the list passed in as a parameter. Calling this function like so:

    @sock->ignoreSslErrors({QSslError::HostNameMismatch, QSslError::SelfSignedCertificate});@

    Seems to still fire ssl errors for the errors I've requested it ignore. I'll try the signal/slot method next, but this may be worth filing a bug report over.



  • EDIT: Works with the signal/slot method


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.