From 1b19f66037bd4942b7e699628f9bd8bde89a69bb Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sun, 25 May 2014 21:39:22 +0100 Subject: Ensure all encrypted bytes are sent when closing QSslSocket. If you do sock->write(data) followed by sock->close() then the data written is not transmitted unless you flush when using QSslSocket but is when using QTcpSocket. This change makes QSslSocket work like QTcpSocket. Change-Id: Ia2e1c021dc48ac0d573f78da782ea77641c03bc1 Reviewed-by: Peter Hartmann --- src/network/ssl/qsslsocket.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index c5ae517fb0..de6e879a71 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -777,6 +777,8 @@ void QSslSocket::close() qDebug() << "QSslSocket::close()"; #endif Q_D(QSslSocket); + if (encryptedBytesToWrite()) + flush(); if (d->plainSocket) d->plainSocket->close(); QTcpSocket::close(); -- cgit v1.2.3 From 34590e84d4aaceb5874d8acb6a2b7a95c153cd6a Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Tue, 13 May 2014 20:19:12 +0200 Subject: Doc: be more explicit about need to set expected SSL cert in errors Note added in QNetworkReply and QSslSocket documentation. Task-number: QTBUG-16770 Change-Id: I2dd8cfb913ec29a96b5465a905cd213713b8d537 Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index de6e879a71..90f6e25b97 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1771,7 +1771,8 @@ void QSslSocket::ignoreSslErrors() This method tells QSslSocket to ignore only the errors given in \a errors. - Note that you can set the expected certificate in the SSL error: + \note Because most SSL errors are associated with a certificate, for most + of them you must set the expected certificate this SSL error is related to. If, for instance, you want to connect to a server that uses a self-signed certificate, consider the following snippet: -- cgit v1.2.3