Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSslSocket::ignoreSslErrors() not working as expected?
QtWS25 Last Chance

QSslSocket::ignoreSslErrors() not working as expected?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sir_Diddymus
    wrote on last edited by
    #1

    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...

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kshots
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kshots
        wrote on last edited by
        #3

        EDIT: Works with the signal/slot method

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved