summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2010-07-12 16:32:06 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-07-16 08:30:19 (GMT)
commit151983bd827c8a05b8798560ade4d911a04156c3 (patch)
tree8d42664f8355211e6fc36e9b1d80924a4102ac49 /src
parente64b427db8f835f8e9272ffdcde285b152cfd9ba (diff)
downloadQt-151983bd827c8a05b8798560ade4d911a04156c3.zip
Qt-151983bd827c8a05b8798560ade4d911a04156c3.tar.gz
Qt-151983bd827c8a05b8798560ade4d911a04156c3.tar.bz2
QSslSocket: Improve error handling
Reviewed-by: Markus Goetz Task-number: QT-3567 (cherry picked from commit c25c7c9bdfade6b906f37ac8bad44f6f0de57597)
Diffstat (limited to 'src')
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index c6e340f..46213ff 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -965,8 +965,20 @@ void QSslSocketBackendPrivate::transmit()
#endif
plainSocket->disconnectFromHost();
break;
+ case SSL_ERROR_SYSCALL: // some IO error
+ case SSL_ERROR_SSL: // error in the SSL library
+ // we do not know exactly what the error is, nor whether we can recover from it,
+ // so just return to prevent an endless loop in the outer "while" statement
+ q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR()));
+ q->setSocketError(QAbstractSocket::UnknownSocketError);
+ emit q->error(QAbstractSocket::UnknownSocketError);
+ return;
default:
- // ### Handle errors better.
+ // SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT: can only happen with a
+ // BIO_s_connect() or BIO_s_accept(), which we do not call.
+ // SSL_ERROR_WANT_X509_LOOKUP: can only happen with a
+ // SSL_CTX_set_client_cert_cb(), which we do not call.
+ // So this default case should never be triggered.
q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);