QNAM: Assign proper channel before sslErrors() emission

There can be a race condition where another channel connects
and gets the sslErrors() from the socket first. Then the
QSslConfiguration from the wrong socket (the default
channel 0's socket) was used.

Task-number: QTBUG-18722
Change-Id: Ibbfa48c27f181563745daf540fa792a57cc09682
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Markus Goetz 2015-09-22 14:26:24 -04:00 committed by Markus Goetz (Woboq GmbH)
parent c28bc5f113
commit 63cf5d3d26

View File

@ -1066,6 +1066,8 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
connection->d_func()->pauseConnection();
if (pendingEncrypt && !reply)
connection->d_func()->dequeueRequest(socket);
if (reply) // a reply was actually dequeued.
reply->d_func()->connectionChannel = this; // set correct channel like in sendRequest() and queueRequest();
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP) {
if (reply)
emit reply->sslErrors(errors);